PDA

View Full Version : pipeline & transform-"upload"



dronus
10-11-2005, 02:47 AM
hello.

i currently doing some level-of-detail thing.
i rendered a perfect hierarchical world with almost "primitives" on the lowest level (there may be ~6 levels or more)
every "node" is nested in other ones of which the dimensions (eg radius or bounding box) are known

now i make heavy use of gl matrix stack, to draw all these nested transforms like:




glPushMatrix();
pp=object.getPosition();
glTranslatef(pp.x,pp.y,pp.z);
if (DETAIL_IS_VISIBLE)
RENDER CHILD NODES
RENDER PRIMITIVES, IF ANY
glPopMatrix();now the problem is to determine DETAIL_IS_VISIBLE.
in fact this is done by comparing the bounds of the nodes to the actual distance to the viewer...
which is gathered by

glGetFloat(GL_MODELVIEW_MATRIX, matrix);

now as the code looks somewhat as




glPushMatrix();
pp=object.getPosition();
glTranslatef(pp.x,pp.y,pp.z);
glGetFloat(GL_MODELVIEW_MATRIX, matrix);
if (DETAIL_IS_VISIBLE(matrix))
RENDER CHILD NODES
RENDER PRIMITIVES, IF ANY
glPopMatrix();the main question now uprises:
if i use gl for all transforming (as i do) because if want to let the GPU do all the job, what about the glGetFloat?? I am in fear that optimisations of gl will vanish. in fact, the glGetFloat forces gl to do all transforms happen to that point, beeing a kind of "glFinish". maybe its no problem because states/textures/other things are much more costly, and transfrom is done in sync fast, but maybe i synchronize gpu and cpu fully pulling the gpu on a very short chain, eleminating reordering optimisations...

as in fact, the whole geometry buildup relies on that detail mechanism, i cannot just "switch it of" to compare performance :-(
what i would have to do is to render a frame while "recording" the visibility states of all nodes, then rendering them without the call to glGetFloat in the exact same configuration.. which seems quite to complicated, modifing the whole thing just for a performance test.

so is there any experience on this like you would say "damn guy, NEVER pull transform data back from gl" or something else?

thanks & greets
Paul

dronus
10-18-2005, 04:13 AM
no experience, anyone?

its just a question of intermixing transforming and reading the transform from the gpu i think...

would be quite happy to find a solution without rewriting it all only for profiling...

many thanks
Paul