# GeometryInstance in batching - how does it work?

**URL:** <https://community.cesium.com/t/geometryinstance-in-batching-how-does-it-work/515>\
**Category:** CesiumJS\
**Created:** [June 5, 2013, 7:41am UTC](https://community.cesium.com/t/geometryinstance-in-batching-how-does-it-work/515 "2013-06-05T07:41:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Akos\_Maroy](https://avatars.discourse-cdn.com/v4/letter/a/8e8cbc/32.png) [@Akos\_Maroy](https://community.cesium.com/u/Akos_Maroy)\
**Post date:** [June 5, 2013, 7:41am UTC](https://community.cesium.com/t/geometryinstance-in-batching-how-does-it-work/515/1 "2013-06-05T07:41:43Z")

</div>

Hi,

```
I have been offline for two weeks, and I see that a new class,

```

GeometryInstance has been introduced, which has to be used to create  
a primitive now. whereas previously I could use:

```
var geometry = new Cesium.PolygonGeometry(opts);

var primitive = new Cesium.Primitive({

    geometries : [geometry],

    appearance : appearance

};

primitives.add(primitive);

now I'm trying:

var primitive = new Cesium.Primitive({

    geometryInstances : [ new Cesium.GeometryInstance({ geometry:

```

geometry }) ],

```
    appearance : appearance

};

primitives.add(primitive);

I'm getting errors:

```

Uncaught DeveloperError:  
Invalid renderState.blending.equationRgb.  
Error at new DeveloperError  
(lib/Cesium/Source/Core/DeveloperError.js:44:22) at new  
RenderState (lib/Cesium/Source/Renderer/RenderState.js:176:19) at  
Context.createRenderState  
(lib/Cesium/Source/Renderer/Context.js:1801:22) at  
Primitive.update (lib/Cesium/Source/Scene/Primitive.js:393:34) at  
CompositePrimitive.update  
(lib/Cesium/Source/Scene/CompositePrimitive.js:403:27) at  
Scene.render (lib/Cesium/Source/Scene/Scene.js:543:26) at  
declare.render  
(lib/Cesium/Source/Widgets/Dojo/CesiumViewerWidget.js:1178:24) at  
declare.updateAndRender  
(lib/Cesium/Source/Widgets/Dojo/CesiumViewerWidget.js:1203:18) at  
updateAndRender  
(lib/Cesium/Source/Widgets/Dojo/CesiumViewerWidget.js:1227:24) RenderState.js:176

```
what am I doing wrong?

Akos

but this gives me errors :(
```

---

<div class="post-metadata">

**Author:** ![patrick](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/patrick/32/2045_2.png) [@patrick](https://community.cesium.com/u/patrick)\
**Post date:** [June 5, 2013, 12:09pm UTC](https://community.cesium.com/t/geometryinstance-in-batching-how-does-it-work/515/2 "2013-06-05T12:09:11Z")

</div>

Hi Akos,

Your code looks right. It looks like the problem is with the appearance. We also moved to separate appearances classes. The joy of being on the bleeding edge.

I updated the Wall Sandcastle example in the batching branch. Have a look and let me know if you need more help syncing up your code.

Patrick

---

<div class="post-metadata">

**Author:** ![Akos\_Maroy](https://avatars.discourse-cdn.com/v4/letter/a/8e8cbc/32.png) [@Akos\_Maroy](https://community.cesium.com/u/Akos_Maroy)\
**Post date:** [June 5, 2013, 12:32pm UTC](https://community.cesium.com/t/geometryinstance-in-batching-how-does-it-work/515/3 "2013-06-05T12:32:43Z")

</div>

Patrick,

> Your code looks right. It looks like the problem is with the  
> appearance. We also moved to separate appearances classes. The joy  
> of being on the bleeding edge.

🙂

it seems that it was the pickData attribute again - as soon as I added  
pickData to the GeometryInstance constructor, everything was working  
fine again.

> I updated the Wall Sandcastle example in the batching branch. Have a  
> look and let me know if you need more help syncing up your code.

will look at it, thanks.

Akos

---

<div class="post-metadata">

**Author:** ![patrick](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/patrick/32/2045_2.png) [@patrick](https://community.cesium.com/u/patrick)\
**Post date:** [June 5, 2013, 12:34pm UTC](https://community.cesium.com/t/geometryinstance-in-batching-how-does-it-work/515/4 "2013-06-05T12:34:59Z")

</div>

Good eye. I still haven’t gotten to matching up the vertex formats yet. I’ll let you know when that is in.

Patrick
