After reading several sources I am still a bit confused about using vertex lists and hidden object removal/frustum culling, clipping, etc.
If I created a terrain mesh larger than what can be seen in my view frustum and loaded it up in vertex lists, how then, do you go about having protions of the vertex list taken out that are out of view?
Obviously I want to limit the items that have to be sent to the video card but I don’t know how that would be applied when using vertex lists.
I have built a Quadtree implementation from scratch and I use the leaf nodes from it to draw out a mesh. Right now I loop through in immediate mode drawing each polygon out one by one. I want to convert this to vertex arrays and have the ones outside the frustum to not even make it to the drawing pipeline. So far Is till don’t understand how to accomplish this.
If someone can explain or provide links to something that explains how this is done I would be very appreciative.
From my understanding the OpenGL pipeline will perform clipping and culling (if you enable it) and will automatically discard fragments that lie outside of your view frustum at this stage. True they will still make it to the pipeline but they will be only subject to transformations which isn’t all that bad. The overhead of trying to determine which vertices would end up outside of the view frustum and dynamically updating your vertex arrays would probably end up being more work anyway.
additionally, vertex arrays (VARS) need to upload vertex data from system memory to video memory each time they are rendered. To further optimize you should investigate vertex buffer objects (VBOs) which allow your vertex data to be uploaded once to video memory and reside there which does away with the need to access the bus in order to upload your vertex data.
So you are basically saying I really don’t have to do anything but but a couple glEnable calls?
If that is the case then what is the purpose of quadtrees and octrees etc? I guess they would be used to keep different vertex lists out of the pipeline. Is that correct?
For this kind of optimization to work, you’ll need a coarse grain, because it would be slower to send the card only needed vertices each frame.
It is a good thing to cull by big chunks.