opengl cliprect

Started by bedelf, May 02, 2005, 03:18:48

Previous topic - Next topic


Ok, say I'm using opengl for 2D stuff only, just making quads with textures on them, and my window is setup like this:

       glOrtho(0, width, height, 0, -1, 1);
       glViewport(0, 0, width, height);

Let's say my window is 800x600. I'm trying to find the easiest way to limit rendering to say a small box in the middle of the screen. Not nessesarily calculating what not to draw, but acually having it take no effect outside the box, with all my screen coordinates remaining the same. Similar, if not exactly like a java 2d clipRect() call. If part of the quad lands within the box, that part of the texture would show, the rest would do nothing.

I'm not having much luck searching around for this. Thanks in advance if anyone is up for this.



Cas :)


Part of me almost wants to believe that doesn't work so I don't feel stupid.



Ah man... there goes all that stencil buffer stuff I was learning.  :P