I implemented windows in my 3D engine a while ago and it worked perfectly till I bought a new ATI Radeon 9600 XT. To limit the geometry to the windows, I use glViewport. Now the Radeon only seems to do quick checking but no clipping so triangles that should be partially visible go over the side of the view port. Here is a screenshot (the skydome in the background goes over the border of the window):
Is this normal glViewport behavior? What can I do against it/what is a better way to implement clipping (and no, I don’t want to use stencil buffers, thats too slow)?
I’m not sure how that can happen with lines, maybe some sort of clever ‘optimization’. However, glViewPort indeed doesn’t clip and it’s well documented. Look here , issue #10
- The Viewport Does Not Clip or Scissor
It is a very common misconception that pixels cannot be rendered outside the OpenGL viewport. The viewport is often mistaken for a type of scissor. In fact, the viewport simply defines a transformation from normalized device coordinates (that is, post-projection matrix coordinates with the perspective divide applied) to window coordinates. The OpenGL specification makes no mention of clipping or culling when describing the operation of OpenGL’s viewport
Note that if you really do require a rectangular 2D scissor in your application, OpenGL does provide a true window space scissor. See glEnable(GL_SCISSOR_TEST)andglScissor.
Yeah it happens to lines and polygons…
Thank you, that helped.