I am just wonderring if there is a way and what is the best way to enable culling by using GL_FRONT_AND_BACK only for certain parts of a terrain. For example I have a range 0 - 1000 heights and I want to cull all the terrain hills which are below say 500 (height). So at the end when you re looking down at the whole terrain from a great distance you can see only hills above 500 and everyhing below are just holes left after culling which you can see through!
As primitive culling is only aware of the winding order in which you send your vertices and not of the position, culling is not an option (BTW, you cannot switch it on in the middle of a primitive either, but your suggestion may require it.)
The straigthforward solution would be a user clipping plane, but this might impact performance.
Another possibility is a 1D alpha texture aligned to your heights values and GL_ALPHA_TEST eliminating all fragments below your desired threshhold.
[This message has been edited by Relic (edited 01-29-2002).]
OK Relic! do you think that if I used 1D texture with GL_ALPHA_TEST then this would eliminate all terrain fragemnts below my height threshold? hmm… I have to try that!
The alpha texture should work, but it burns a texture unit. Might be a problem for you, might not.
Another option would be to just disable colour buffer writes, enable depth writes, and draw a big flat poly across your scene at height 500. Then go back to normal z-buffered render mode and draw your terrain as normal. Everything under the invisible poly will be hidden by the depth test.