CPU and GPU idle...

When the GPU has taken control over the calculations, (if I’m correct when you are using for example glBegin(GL_WHATEVER) Doesn’t the CPU halt and are in idle state while the GPU is working? If so is it possible to multithread the GPU rendering in one thread and the CPU calculations in one? And by doing so gaining some time for cpu calculation that would have been calculated after the GPU executions.

[This message has been edited by uzu_manga (edited 09-19-2002).]

Err, I believe you are way off here.

The GPU doesn’t execute any of your code (not counting vertex/pixel programs). It’s the CPU that executes all code. When you enter a glBegin/glEnd-pair, it’s still the CPU that executes the actual code (that is, all the calls to glVertex, glColor, glTexCoord, and all calculations therein), but the values are passed to the GPU. The CPU and GPU then work in parallel. The CPU passes data to the GPU, and the GPU draws it.

to get CPU and GPU working in parallel, you need to do your render calls in a way that lets the GPU work at it’s own pace while you are doing something else. specifically, you need to NOT use glBegin()/glEnd() etc, as the GPU is then being hand-fed one vertex at a time by your app, and it can’t do anything else cos it doesn’t know what your next call will be. if you use vertex arrays the GPU can wrok at it’s own pace after you make the call, and you will get much greater benefit if you use GL_NV_VERTEX_ARRAY_RANGE or GL_ATI_VERTEX_ARRAY_OBJECT. both these let you store your vertex data in AGP memory and send a whole bunch of indices to the GPU in a drawElements() call. the GPU can then work at it’s own pace reading the buffer and drawing the geometry while your app does something else.
if VAR or VAO aren’t possible, use GL_EXT_COMPILED_VERTEX_ARRAY, but this isn’t as fast as it must copy the data into AGP memory each time you lock the arrays. if you are multipassing the same geometry, it should do alright…
hope that helps