PDA

View Full Version : problems with glScissor



Leseratte
12-08-2011, 04:46 AM
Hi all,

I'm really a beginner, so I hope my question is not too stupid :o

I wrote a little frame with mingw under windows. I initialized the OpenGL-window (create it with pixelformat etc.), so far no problems.

In the paint event I just do:



glDisable(GL_DEPTH_TEST);
glEnable(GL_SCISSOR_TEST);

glViewport(50, 50, 50, 50);
glScissor(50, 50, 50, 50);

glClearColor(1.0, 0.0, 0.0, 0.0f);
glClear(GL_COLOR_BUFFER_BIT);


No other opengl commands are used.

I expected a little red box (50 x 50) at the position x=50, y=50, but the entire window is filled red. What did I wrong? I thought glScissor limits the area in which OpenGL draws.

Thank you for your help.

tksuoran
12-08-2011, 05:43 AM
Are you using single or double buffering? Which GPU you have?

Leseratte
12-08-2011, 06:48 AM
Are you using single or double buffering? Which GPU you have?

I use double buffering and an onboard graphic adapter

Video Adapter: Intel(R) Q35 Express Chipset Family,
Video Processor: Imtel(R) GMA 3100

tksuoran
12-08-2011, 07:31 AM
What do you render to the rest of the pixels, are their contents well defined?

Leseratte
12-08-2011, 08:02 AM
I found the problem. It was a silly one :-(

Of course the rest of the pixels are not well defined, because it's only a little test program and I want to see, what happens, when I do not define the rest of the pixels.

It seems, that the debugger runs the program in the same adress-space each time, and because I did a previous run which filled the entire window with the same color, I always saw the color of the previous run, except the color of the little rect which is the same one.

After I restart the PC, it works like expected.

Sorry for this...
as I said - I'm a OpenGL-beginner...

AND THANKS!