Move drawing area


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++ :wink: )

Thanks! ?

Yeah, I just managed to solve it by using the glViewport and glOrtho commands, but what is faster, glScissor or my version?

Try both and you will know :slight_smile:

I’ll try it out later :wink:
Solved :smiley:

To be precise, glViewport does not clip, so the correct way should still involve glScissor :slight_smile:

Yeah, I know :stuck_out_tongue:
But it works, isn’t it? :stuck_out_tongue:
And it’s no incorrect use, or is it?

It is “incorrect” in that on a different card, or different driver version, suddenly your program may break.

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.