Sign in to follow this  
Kimmen

Untitled

Recommended Posts

Hi. I've been searching a bit for how to clear och redraw portions of a screen and I haven't found anything that directly tells you how to do it. I'm implementing an isometric game and I probably need to implement dirty rectangles. Is there a way just to clear (and redraw) portions of the color buffer? Does the viewport change the area of the pixels being cleared when I call glClear(..)? In the same time I just want to redraw the portions that has been cleared, is it a good way using scissor tests? thanks in advance. /Kimmen

Share this post


Link to post
Share on other sites
Is there any particular reason for dirty rectangles? I think that the speed you can achieve with OpenGL is way enough to worry about redrawing only parts of the screen. If it isn't (how much FPS?) you might be doing something wrong, after all it's only an isometric game, not some full 3D with lots of effects.

Share this post


Link to post
Share on other sites
Scissor testing is the way, for both questions. The viewport is just for converting from normalized device coordinates into window coordinates. Scissor testing allows you to alter (including clear) only the pixels inside the scissor area.

Share this post


Link to post
Share on other sites
Well you could also use a stencil test, but i'm pretty sure it wouldnt affect the glClear() (but really assuming your scene is full, you shouldnt be clearing every frame anyways) a few googles about "opengl stencil test" should turn up all you need, the advantage of the stencil test over the scissor rect would be that you can draw to more abstract shapes than just a rectangle, the disadvantage is that my guess would be that the stencil test's overhead would far outweigh any advantage you might gain, scissor rect + stencil test might offer some advantage, but this all really would need to be tested to really know.

hope i helped, i kinda rambled
-Dan

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this