PDA

View Full Version : scissor test



zadeh79
09-30-2006, 02:01 PM
scissor test is acting funny when I call it twice. anyone know why?

k_szczech
09-30-2006, 02:45 PM
Define "funny".

zadeh79
10-01-2006, 06:36 PM
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?

Bob
10-01-2006, 10:15 PM
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?

zadeh79
10-02-2006, 08:22 AM
Yes, the second glScissor call is intended to allow rendering anywhere to the screen when the charachter isn't between the specified x coordinates.

10-02-2006, 08:53 AM
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

zadeh79
10-03-2006, 11:10 AM
I have avoided calls to glScissor between glBegin and glEnd, but thanx for the suggestion.

zadeh79
10-05-2006, 07:38 PM
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;