View Full Version : glPointSize and clipping volume

07-05-2007, 10:50 PM
When I use glPointSize it seems to invalidate the clipping volume. I use the glPointSize in a function that displays my scene correctly prior to the function but after, the clipping within the viewport is no longer working. Can someone help?

virtual void DrawVertex()
glVertex2f(p1.x, p1.y);
glVertex2f(p2.x, p2.y);
glVertex2f(p3.x, p3.y);

07-11-2007, 02:11 AM
Technically you should glScissor to guarantee fragments remain within the viewport. Points with size are an interesting issue in the spec due to center clipping not fragment level clipping and the obvious issues this causes.

But clipping should not break (it may be a side effect of the clip path for points being fudged to handle size elegantly).

You may incur a significant performance penalty falling off the clip path, so this sounds potentially nasty.

If it's just points then this is normal and correct behavior and you should use glScissor in addition to glViewport.

You don't provide a lot of info .... :-/

07-16-2007, 05:21 PM
Out of curiosity, if points are clipped according to their centre, the how does the glScissoring help? If the points are clipped, there will be no fragments at all? Or did I misunderstand the whole point? (hehe)

07-17-2007, 02:29 AM
Use a larger viewport, and glScissor to cut precisely where you want.
EDIT: because scissor works on individual pixels.

07-17-2007, 06:48 AM
Perhaps an alternative workaround would be to draw view aligned GL_QUADS instead of GL_POINTS, or use point sprites (though I'm not sure how those are clipped).

07-17-2007, 11:42 AM
I'm not trying to clip the points I'm trying to maintain the viewport that I've defined prior to rendering and which appears to be invalidated by using glPointSize.

I'm using glOrtho to define my viewing volume...

glOrtho( xMin, xMax, yMin, yMax, -1, 1);
glMatrixMode( GL_MODELVIEW );
glLoadIdentity(); I can call all my drawing functions and the viewing volume remains. However when I call my function that contains the glPointSize my viewing volume changes beyond the limits I have defined.
If I comment out glPointSize, the viewing volume is maintained.

Is this normal behavior of glPointSize?

07-17-2007, 03:03 PM
Look at Common OpenGL Pitfalls (http://www.opengl.org/resources/features/KilgardTechniques/oglpitfall/) pitfall number 10

07-18-2007, 01:31 AM
Look at Common OpenGL Pitfalls pitfall number 10 Thanks. That explains it.