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,
Gazoo