PDA

View Full Version : Move drawing area



Rubdos
01-22-2011, 08:49 AM
Hey!

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++ ;) )

Thanks!

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

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

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

Rubdos
01-23-2011, 12:29 AM
Thanks!
I'll try it out later ;)
Solved :D

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

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

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

mhagain
01-24-2011, 01: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.