View Full Version : Obtaining coordinates after clipping

03-31-2013, 04:14 AM
Hello All,

I have polygons in my application and i need to find what part of the polygon is currently in the view frustum. So, i thought i could use the coordinates that OpenGL generates after clipping. Is it possible for me to obtain these coordinates in any way?

Otherwise, i will have to do all computation on the CPU and find out what part of the polygon is currently visible. I want to avoid that. Any ideas/suggestions would be helpful.


03-31-2013, 12:32 PM
You probably can't retrieve the polygon fragments that came out of the fixed function clipping the GPU did. Most of the time it doesn't even clip them, but just rejects fragments outside the frustum (read up on 'guardband clipping').
What you can do, though, is to emulate clipping in the geometry shader and then stream back the resulting primitives into a VBO using transform feedback. Later on you can read back the VBO into system memory and work with them on the CPU.
Btw, how many polygons are we speaking of? If its just a few hundred or a thousand you might as well clip them on the CPU. Its not a super time consuming computation.

04-03-2013, 03:08 AM

Thanks for the help! i will read up on 'guardband clipping'. I am using OpenGL 2.0, so no geometry shaders :(. Well i am talking about 100s of polygon. Is this number too large to consider for CPU based clipping?