Single Pass Multiviewport Rendering in OpenGL


I have been battling with this issue for some weeks now. Is it possible to render multiple viewports in a single pass using OpenGL? So I know for a fact that it is possible to render multiple views to different buffers in a single pass using geometry shaders. Now, I’ve been trying to not only send different views to different buffers but also to different viewports. I have been using Cg. My idea is to apply modelview transformations in the vertex shader, and on the geometry shader scale the geometry to be placed in the corresponding viewport and then specifying the clipping planes through the CLP0-CLP5 semantics. So, I have two main problems. First, the perspective division and viewport transformations are automatically done after the geometry shader is run (is this correct?), so I don’t know how to overrun that. Second, I am not sure about how the CLP0-CLP5 semantics work, I assume CLP0 corresponds to the left plane, CLP1 to the right, CLP2 to the bottom, CLP3 to the top, CLP4 to the near, and CLP5 to the far; now, do I specify these as floats? vectors? in world space? view space? Does anyone have any ideas or comments? Thanks.

PS. I apologize in advance, I am new to this forum, so I am not sure of what are the most commonly used etiquette rules, please let me know if I’m doing something wrong.

Not sure if your hardware can support this, but this new GL extension may do exactly what you need :

hey, thanks for the response. My concern is that, that is a pretty new extension. In order figure out if I can use it all I have to do is pretty much get the latest driver right?

sorry, I want to modify my post and don’t know how to.

New Post:
Thanks for the quick response. My concern is that, that is a pretty new extension. So, I don’t know how to update my libraries and drivers to be able to use this extension. I’m working with one of the latest NVIDIA cards, GeForce GTX 465, and have the latest driver (released on July 19, 2010). I tried updating the glew lib whose latest update is on July 13, 2010, and it doesn’t work (the extension was approved by ARB on July 9, 2010, and by the Khronos Board of Promoters on July 19, 2010). But, I wonder if it will work if I declare the functions manually. Any thoughts? Thanks.

Yes it works, but only with newest drivers, that means 259.09 (July 25th)! Your drivers are old and do not support GL 4.1.