PDA

View Full Version : Clipping before transformation



The_Dj
06-28-2003, 11:50 AM
Hi, all.
glLoadIdentity();
<translate, rotate, scale>
<draw stuff>

That's OK,
But I want to clip the <stuff> to a smaller area thatn the screen, etc.

I have tried adding
glpushmatrix();
glloadientity();
<insert clipping here>
glpopmatrix();

just after the translations, but the clipped area is not a clear rectangle around the screen, it seems to be transforming the clipping plane anyway.

er, help?

Fuzzy_NZ
06-28-2003, 12:29 PM
Can you clear one thing up for me, do you mean Screen as whole viewing area or as the opengl viewing context/canvas
if my guess is correct you are creating the context as a full screen window, you might only want it to be over a part of the display not full screen

The_Dj
06-28-2003, 03:06 PM
I am wanting to clip the openGL canvas.
My code runs happily in a window or fullscreen.

I am just wanting to limit part of my scene to a fixed are. After this part is drawn, I will remove the clipping planes and draw other things in the rest of the screen/window.

zeckensack
06-28-2003, 08:56 PM
Search the spec for 'Scissor'. Works only for rectangular regions, but that might be sufficient for you. If it's not, you need user clip planes.



glScissor(x,y,width,height);
glEnable(GL_SCISSOR_TEST);

//draw stuff

glDisable(GL_SCISSOR_TEST);

The_Dj
06-29-2003, 03:44 PM
Hiya.

Yeah scissor does what I asked for, but sadly I hve moved teh goal-posts.

I was hoping to render part of my scene in a clipped area into the selection buffer, and scissor only stops screen pixel changes, so objects clipped with scissor still end up in the buffer :-(

I have resorted to the "correct" method of gluProject.

See new post for my new question.


Thanx for the help