[Solved] Is it to be expected for a ci::geom::SourceMods to render much slower than a ci::gl::BatchRef?


Hey Embers,

I’m working with some code which generates some 3D text geometry. It basically renders out some text via Cinder’s awesome text code, grabs some contours, applied the ci::geom::Extrude function and voila - 3D text geometry.

I allow for both a ci::geom::SourceMods object to be created, as well as a ci::gl::BatchRef. The ci::gl::BatchRef is created simply as a function of the other, thusly:

ci::gl::BatchRef		FactoryText3D::Create3DTextBatch( std::string const& text, Alignment alignment, int wrapWidth )
	auto batch = ci::gl::Batch::create( Create3DTextGeometry(text, alignment, wrapWidth), mGlsl );
	return batch;

where mGlsl is just the default Lambert shader.

As the topic title implies, the ci::geom::SourceMods renders far slower than the batch, and I don’t really get why. Like a factor of 3x slower or more. I’ve looked a bit at the different code which handles rendering for the SourceMods or BatchRef but I’m not wise enough to get the crucial difference.

I’m mostly asking out of curiosity, but wouldn’t also mind knowing what the preferred approach is. My current understanding is that Batches are generally where it’s at.

Thanks in advance,



A Batch creates the required Vao and Vbo and caches the attribute locations in the shader. This means that all that information is already available when it’s time to draw. The geom classes only store information in CPU memory and don’t know anything about the shader (and its attributes) used for rendering. So it needs to create all that information each time you draw it.