We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › disabling OpenGL clipping/culling
Page Index Toggle Pages: 1
disabling OpenGL clipping/culling (Read 1547 times)
disabling OpenGL clipping/culling
Aug 20th, 2008, 4:56pm
 
I am having an issue with OpenGL's clipping/culling. I am drawing point sprites (although the problem happens all the same with standard GL points). When the vertex of the point is anywhere outside the screen, it seems like it doesn't get drawn at all, but in the case of my point sprites, they may be sometimes as wide as 40 pixels or so, so for example, if the vert is slightly to the left of the screen, even though I'd like to see the right side of it, it just pops off as soon as its out of the screen space.

This problem exists with plain old GL points as well, so I've deduced that it is nothing point sprite specific. I did a little searching and came up with this page: http://www.opengl.org/resources/faq/technical/clipping.htm

Question 10.050 is "I know my geometry is inside the view volume. How can I turn off OpenGL's view-volume clipping to maximize performance?"

Well, I know my geometry is actually OUTSIDE of the view volume, but I figured I'd try their suggestion of enabling glHint(GL_CLIP_VOLUME_CLIPPING_HINT_EXT,GL_FASTEST) but this doesn't help at all.

So that's where I'm at. I'd really like to eliminate this popping problem. Can anyone offer any advice?
Re: disabling OpenGL clipping/culling
Reply #1 - Aug 20th, 2008, 9:08pm
 
Here is a really simple, concise sketch that demonstrate the problem I'm talking about. Move the cursor near the edges of the screen to see...

Code:

import processing.opengl.*;
import javax.media.opengl.GL;

void setup()
{
size(640,480,OPENGL);
}

void draw()
{
background(0);
PGraphicsOpenGL pgl = (PGraphicsOpenGL)g;
GL gl = pgl.beginGL();
gl.glPointSize(50.0f);
gl.glColor3f(1.0f, 1.0f, 1.0f);
gl.glBegin(GL.GL_POINTS);
gl.glVertex2f(mouseX - 50.0f, mouseY);
gl.glVertex2f(mouseX + 50.0f, mouseY);
gl.glVertex2f(mouseX, mouseY - 50.0f);
gl.glVertex2f(mouseX, mouseY + 50.0f);
gl.glEnd();
pgl.endGL();
}
Re: disabling OpenGL clipping/culling
Reply #2 - Aug 20th, 2008, 9:20pm
 
Hmm...

I think this must be hardware related.

The example works fine for me using:

MacBook Pro nVidia GeForce 8600M GT

Processing 146

(I'm guessing you're on the mbp ATI)

Re: disabling OpenGL clipping/culling
Reply #3 - Aug 20th, 2008, 9:39pm
 
Yes, I am running on a MacBook Pro with an ATI x1600. This would not be the first time I have hit an ATI-specific graphics snag. *sigh*

Perhaps there is still some kind of GL mode to enable that would solve this problem? Seems like a pretty big bug... it would mean any particle system would clip weirdly.
Re: disabling OpenGL clipping/culling
Reply #4 - Aug 20th, 2008, 10:18pm
 
As far as I know, the spec says that if the point is outside the screen, it shouldn't be drawn.. and there's no way to turn such things off.
Re: disabling OpenGL clipping/culling
Reply #5 - Aug 20th, 2008, 10:31pm
 
Yea, in my searching, I got that impression in what I read about view volume culling, and yet you really wouldn't want to have your point sprite particles get clipped while part of them remains on the screen. And I've now heard reports from several people with Nvidia hardware that its not a problem for them.

*grumble grubmle ATI grumble grumble*
Page Index Toggle Pages: 1