Optimized Stroke function

HI!.
theres a function in processing:

hint(ENABLE_OPTIMIZED_STROKE);

i looking for a similar function in openframeworks. i dont know exactly what it does. but i could not find any openGl reference.

By default, all vertices are sent to the vertex shader already multiplied by the modelview matrix, and the modelview matrix in the vertex shader is set to the identity to avoid applying the transformation twice.

The reason for this seemingly puzzling approach is to optimize performance when drawing multiple shapes: since it is most efficient to minimize the number of buffer copies between CPU and GPU memory, the renderer batches as many shapes together as possible to draw them in a single call. However, if each shape had a different transformation, then it wouldn’t be possible to group them because they would have different uniform matrices. You can disable the batching with hint(DISABLE_OPTIMIZED_STROKE) . More here.

Thanks!

There is nothing like this directly available in OF as one function , and it’s really not a GL thing but just a way to avoid doing a lot of draw calls. In OF you would need to do it manually by acummulating the shapes vertices multiplied by the transformation matrix of each in one in an ofVboMesh and then drawing that

1 Like

Thanks. Could you give me a simple example? im using a sphere primitive, and i can understand how ofVboMesh works. I need to do this because im manipulating vertices in vertex shader, and when i draw it the vertices are moving when it not suposse to. in processing i fix it when that function.

HI.
Can you post your code please?
cheers