Some GL calls are used to pass data, other GL calls are used to effect commands on this data.
The data you pass is usually retained, e.g. if you change the ‘drawing color’ the same color is used until you change the color again.
If you have never seen GL code before, this may feel awkward – why not just have commands like triangle(a,b,c,color) or the like? The reason is, GL is built for speed versus convenience. Passing lots of vertices at once reduces communication between the CPU and GPU; passing a color just once and then painting together all shapes of the same color reduces communication between CPU and GPU. Reusing coordinates on the fly for drawing two triangles (this is what TRIANGLE_STRIP is for) reduces memory usage and communication between the CPU and GPU.


Comments