View Full Version : Move drawing area

01-22-2011, 07:49 AM

I'm getting a bit used to OpenGL now... But I couldn't find this on the net:
I'm rendering some stuff (2d ortho) and I'm trying to render on top of it, and I can move it with my scroll wheel now. Problem is: I want to cut it of at a certain point (I only want to draw the scrolling stuff in 1 area, x1,y1,x2,y2), so I can scroll a list of items with the scroll wheel. The scrolling is okay now, but I can't cut it off. I tried a bit with glViewport, but It's scaling the whole lot...

Can someone help me please? (C++ ;) )


01-22-2011, 08:38 AM
http://www.opengl.org/sdk/docs/man/xhtml/glScissor.xml ?

01-22-2011, 09:55 AM
Yeah, I just managed to solve it by using the glViewport and glOrtho commands, but what is faster, glScissor or my version?

01-22-2011, 10:57 AM
Try both and you will know :)

01-22-2011, 11:29 PM
I'll try it out later ;)
Solved :D

01-23-2011, 02:05 AM
To be precise, glViewport does not clip, so the correct way should still involve glScissor :)

01-24-2011, 08:18 AM
Yeah, I know :p
But it works, isn't it? :p
And it's no incorrect use, or is it?

01-24-2011, 10:54 AM
It is "incorrect" in that on a different card, or different driver version, suddenly your program may break.

01-24-2011, 12:13 PM
Neither should be measurably faster unless this is something you're doing hundreds or thousands of times per frame, in which case you're doing something wrong and should probably rethink your whole approach.