View Full Version : Drawing using large Arrays

02-05-2010, 11:22 AM
I am working on a simple CAD graphics engine currently limited to Opengl 1.1 functionality. The documents consist of 1000's of tiny arcs or lines. To optimize rendering I batch the lines and arcs together and render then using


This yields really good performance if I try to maximize the size of the arrays to a value the graphics card can handle. Rendering each line with individual calls to Opengl is too slow.

I am also performing the same algorithm for surfaces. The problem I face with both methods is that the color of all geometry currently has to be the same. To change the color (say for selectio) I have to move all the geometry for a given object (a line, a surface) into a different buffer.

This operation becomes costly depending on what is selected and how. Does anybody know a way I can render geometry in an array and render parts of it using different materials/colors? Solutions do not have to be limited to Opengl 1.1

Iulian B
02-05-2010, 02:43 PM
Solutions do not have to be limited to Opengl 1.1

then sure, just render everything with a custom shader, pass the selected/normal color as uniforms, tag the selected/unselected geometry with some vertex attrib and , taking that into consideration in the vertex shader, draw either one or the other :p.

Now, onto more OpenGL 1.1 methods, just either update by hand, in place, the color per each selected vertex in the buffer when the selection changes OR draw the selection as a second pass with a different color. When you are selecting it, you have the primitives either way so you can copy only what needed...