I want to draw 1000 to 2000 circles, each with its own 2D location and radius. I am going to use instancing to draw a mesh approximating a circle (16 vertices or something), but I obviously need instance specific data for position and radius. I’ve found some info on UBOs, Uniform Buffer Objects, that seem to be perfect for instance specific data (and skinning, among other things). I’d then use the gl_InstanceID in my shader to fetch the data, something similar to this:
gl_Position = position[gl_InstanceID] + circleVertex * radius[gl_InstanceID];
and then normalize the coordinates to screen coordinates.
This article provided good info on defining the uniform buffer stuff in the shader, but almost no info at all on creating and setting up the actual buffer with OpenGL commands in my program, nor any information on actually accessing the data in the vertex shader, so my code above is psuedocode until proven otherwise.
I can’t find any tutorials or even a working example, some I’m pretty much shooting blindly with my experimenting at the moment. I will obviously post a working example when (if?) I get it working.
I know you guys usually stick to your glBegins and vertex arrays, but please help me out here! (joke) xDDDDDD