PDA

View Full Version : Does OpenGL remove the processing of the objects that aren't in the view volume?



Ehsan Kamrani
10-23-2005, 03:42 AM
My question is about the terrains. terrains consist of many vertices. assume that we have created a terrain with 5000 vertices and the view volume can only show 1000 vertices. So i believe that only 1000 vertices are processed in my program. Am i correct?
Note that i have called the function DrawTerrain() in my Render function:

void Render()
{
DrawTerrain(); // Draw a terrain with 5000 vertices.
}

Does OpenGL remove the processing of the objects that aren't in the view volume? As an example, if i call the function DrawModel() in my render function and if it's not in the view volume, can i insure that it isn't processed by my graphics card?
-Ehsan-

Black Death
10-23-2005, 04:10 AM
OpenGL renders all objects between the near and far clipping plane. Those objects that fall outside are not rendered. I'm not sure what happens with models or terrain. I think that OpenGL renders only the visible triangles (that are between near and far clipping plane).

That's just what I think. I'm not sure...

jide
10-23-2005, 05:03 AM
Try to have a look at the OpenGL pipeline, that will really help you.

All the vertices you stippled pass the first stages of the pipeline. Only when those vertices are transform in eye coordinate space, they will be clipped, but not only with near and far clip planes, but with 6 planes (a truncated pyramid). It's only there that vertices out of the view will be dicarded (if full out) or clipped (if partially in the view).

So, I don't know what to really answer to your question. Anyway, hope that helps.

UrbanLegend
10-23-2005, 10:10 AM
HI

Do a google on CULLing, typically you want to cull the geometry that falls outside your frustum before you send data to OpenGL

john
10-23-2005, 05:18 PM
The answer is, of course, that OpenGL has to do SOME processing for EVERY vertex you give it. Vertices that are clipped because they fall outside the view frustum have less processing than those inside, but the processing and test to determine this is not zero.

Ehsan Kamrani
10-23-2005, 10:46 PM
Now i understand... Regarding the book *OpenGL A Primer*, the OpenGL pipeline consist of the following steps:
Transformation
Clipping
Projection
Rasterization

So all the vertices should pass the first 2 steps.But those vertices that are inside the view volume, move through the OpenGL pipeline. :)
Thank you
-Ehsan-