Results 1 to 8 of 8

Thread: glPointSize and clipping volume

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2001
    Location
    lincoln
    Posts
    7

    glPointSize and clipping volume

    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?

    Code :
    	virtual void DrawVertex()
    	{
    	     glPointSize(5.0);
    	     glBegin(GL_POINTS);
    	     glVertex2f(p1.x, p1.y);
    	     glVertex2f(p2.x, p2.y);
    	     glVertex2f(p3.x, p3.y);
    	     glEnd();
    	}

  2. #2
    Super Moderator OpenGL Guru imported_dorbie's Avatar
    Join Date
    Jul 2000
    Location
    Bay Area, CA, USA
    Posts
    3,966

    Re: glPointSize and clipping volume

    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 .... :-/

  3. #3
    Senior Member Regular Contributor
    Join Date
    Jan 2005
    Location
    Stockholm, Sweden
    Posts
    164

    Re: glPointSize and clipping volume

    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)

  4. #4
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: glPointSize and clipping volume

    Use a larger viewport, and glScissor to cut precisely where you want.
    EDIT: because scissor works on individual pixels.

  5. #5
    Senior Member Regular Contributor remdul's Avatar
    Join Date
    Mar 2004
    Location
    The Netherlands
    Posts
    346

    Re: glPointSize and clipping volume

    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).

  6. #6
    Junior Member Newbie
    Join Date
    Jun 2001
    Location
    lincoln
    Posts
    7

    Re: glPointSize and clipping volume

    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...

    Code :
    	glViewport(VIEWPORTP[0], VIEWPORTP[1], VIEWPORTP[2], VIEWPORTP[3]);
    	glMatrixMode(GL_PROJECTION);
    	glLoadIdentity();
    	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?

  7. #7
    Senior Member Frequent Contributor
    Join Date
    May 2005
    Location
    Prague, Czech Republic
    Posts
    913

    Re: glPointSize and clipping volume

    Look at Common OpenGL Pitfalls pitfall number 10

  8. #8
    Junior Member Newbie
    Join Date
    Jun 2001
    Location
    lincoln
    Posts
    7

    Re: glPointSize and clipping volume

    Look at Common OpenGL Pitfalls pitfall number 10
    Thanks. That explains it.

Similar Threads

  1. viewing volume clipping
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 09-14-2006, 02:18 AM
  2. volume clipping
    By Ultrasound in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 09-09-2002, 11:24 PM
  3. Volume Clipping
    By WM in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 03-24-2002, 01:10 PM
  4. Volume Clipping
    By WM in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 03-19-2002, 09:32 AM
  5. Clipping volume???
    By in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 08-26-2000, 07:32 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean