0

I'm using opengl 3.3 core profile to replace some old fixed function code.

What would be the recommended approach to take when drawing the following set of nine quads in many different rotated configurations?

All quads have the same scale but each of the eight quads surrounding the center quad can have potentially different rotations (though always attached to the center quad by at least one vertex), here are two example configurations:

example rotational configurations

The surrounding eight quads will all have the same constant color (different to the center quad) and I will want to cull their backfaces.

Should I perhaps create a VBO describing a single unit quad then make nine draw calls, each time uploading a different matrix uniform?

Or alternatively should I create a VBO describing a single unit quad then make a single (instanced) draw call uploading a uniform array of matricies?

Should I create one VBO describing all nine unit quads and update it every frame?

Is there a better approach?

Peter McG
  • 18,857
  • 8
  • 45
  • 53

2 Answers2

0

You could write a geometry shader which creates the shape on the fly, but you would still have to use uniforms or a variable VBO to modify it.

Depending on how often you want to update the shape, different methods work better.

  • If it changes each frame: I would stick with nine draw calls.
  • Not as often: you can edit VBO data (see OpenGL VBO updating data).

I don't have any timing data though, so you might want to benchmark both of them.

Community
  • 1
  • 1
weltensturm
  • 2,164
  • 16
  • 17
0

Personally I'd go with this:

Should I perhaps create a VBO describing a single unit quad then make nine draw calls, each time uploading a different matrix uniform?

Instancing probably won't gain you anything unless you're rendering hundreds of the things.

user673679
  • 1,327
  • 1
  • 16
  • 35