scissor test

scissor test is acting funny when I call it twice. anyone know why?

Define “funny”.

When I just use: glScissor(x, y , w, k) it works fine, but If I use the following, the rendering restriction does not occur consistently or accurately: (Rendering continues to occur at parts of the screen that it should not). Note, that I know the problem isn’t related to defining the ‘if’ condition incorrectly.

if (posx > .42 && posx < .80 && posy > .45)
glScissor(x, y, w, k);
else
glScissor(0, 0, 1000, 1000)

I am in PERSPECTIVE mode. Could it be I need to switch to ORTHO?

Are you aware that the coordinate system in which yoy specify the scissor box have the origin in the lower left corner of the window, with Y-axis increasing upwards?

Yes, the second glScissor call is intended to allow rendering anywhere to the screen when the charachter isn’t between the specified x coordinates.

Hi,

Have you read the glScissor documentation?

http://www.mevis.de/opengl/glScissor.html

Note in particular that the arguments are integral, you need to glEnable/glDisable the test, and in general you are urged to check for possible error conditions (glGetError) when it is safe to do so (outside of glBegin/glEnd).

Whatever you do, don’t get discouraged!

Cheers

I have avoided calls to glScissor between glBegin and glEnd, but thanx for the suggestion.

I figured something out. Apparently the problem is not with the scissor test, but it’s with the posx variable which seems to be acting unpredictably. Does anyone know why the variable might not be keeping track of the charachter’s position correctly? Could it be I have defined too many global variables?

GLfloat a = 0.0;
GLfloat s = 0.0;
GLfloat x = 0.0;
GLfloat y = 0.0;
int stance = 0;
int cycleone = 1;
int direction = 1;
int time = 0;
int switchstance = 1;
float posx = 0;
float posy = 0;