# gl::Color, getting batch transformations to work

**URL:** <https://discourse.libcinder.org/t/gl-color-getting-batch-transformations-to-work/1213>\
**Category:** Uncategorized\
**Created:** [July 9, 2018, 6:28pm UTC](https://discourse.libcinder.org/t/gl-color-getting-batch-transformations-to-work/1213 "2018-07-09T18:28:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![CarlJalal](https://avatars.discourse-cdn.com/v4/letter/c/77aa72/32.png) [@CarlJalal](https://discourse.libcinder.org/u/CarlJalal)\
**Post date:** [July 9, 2018, 6:28pm UTC](https://discourse.libcinder.org/t/gl-color-getting-batch-transformations-to-work/1213/1 "2018-07-09T18:28:37Z")

</div>

I’m having trouble getting at least color transformation to work.

```auto
for (int x = 0; x < xdim; ++x) {
	for (int y = 0; y < ydim; ++y) {
		for (int z = 0; z < zdim; ++z) {
			gl::ScopedModelMatrix scpModelMtx;
			int point = x*zdim*ydim + y * zdim + z;
			gl::color(ColorA(CM_HSV, float(status[point]) / 2.0, 1, 1,0.5));
			mSlices[point]->draw();
		}
	}
}

```

I produced the cubes on setup with the following code:

```auto
auto lambert = gl::ShaderDef().lambert().color();
gl::GlslProgRef	shader = gl::getStockShader(lambert);
for (int x = 0; x < xdim; ++x) {
	for (int y = 0; y < ydim; ++y) {
		for (int z = 0; z < zdim; ++z) {
			auto slice = geom::Cube().size(0.9, 0.9, 0.9);
			auto trans = geom::Translate(x, y, z);
			auto color = geom::Constant(geom::COLOR,
				ColorA(CM_HSV, 0.5, 1, 1,0.5));
			int point = x*y*z% ydim*zdim + y*z% zdim + z;
			point = x*zdim*ydim + y*zdim + z;
			mSlices[point] = gl::Batch::create(slice >> trans >> color, shader);
		}
	}
}
mCam.lookAt(vec3(20, 20, 20), vec3(0, 0, 0));

```

Thanks!

---

<div class="post-metadata">

**Author:** ![paul.houx](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/paul.houx/32/31_2.png) [@paul.houx](https://discourse.libcinder.org/u/paul.houx)\
**Post date:** [July 9, 2018, 6:36pm UTC](https://discourse.libcinder.org/t/gl-color-getting-batch-transformations-to-work/1213/2 "2018-07-09T18:36:02Z")

</div>

Can you describe what you expected to happen and what happened instead?

---

<div class="post-metadata">

**Author:** ![CarlJalal](https://avatars.discourse-cdn.com/v4/letter/c/77aa72/32.png) [@CarlJalal](https://discourse.libcinder.org/u/CarlJalal)\
**Post date:** [July 9, 2018, 6:38pm UTC](https://discourse.libcinder.org/t/gl-color-getting-batch-transformations-to-work/1213/3 "2018-07-09T18:38:41Z")

</div>

I fixed it by removing

```auto
auto color = geom::Constant(geom::COLOR, ColorA(CM_HSV, 0.5, 1, 1,0.5));

```

![cinder1](https://canada1.discourse-cdn.com/flex030/uploads/libcinder/original/1X/a8e286953a24bc0890b05dd1b02a6cb8c904a25e.PNG)  
became  
 ![image](https://canada1.discourse-cdn.com/flex030/uploads/libcinder/original/1X/c6b568383ccc5d0506f7a46dcb6a754f5d59124e.jpg)
