Only redrawing whats changed?

Started by
2 comments, last by rhumba 19 years, 5 months ago
Hi, I'm new to openGL, so please be easy on me. I want to draw 32 objects each containing a slider (for input) and a dial (for output display). So I'm going to draw everything in glOrtho or glOrtho2D. Presuming I drag on the slider in the first object, is there any way to avoid having to redraw all the sliders and dials when the only thing that has changed is that particular slider?? Also, if the slider is a box that I translate, how do I avoid translating the other widgets in that object?? I've read a variety of posts regarding similar problems, and I've heard mention of clipping, depth buffers, accumulation buffers and display lists... which of these do I need to look into?! Huge thanks in anticipation, Matt (PS. I think I'll use GLOW, which may already take care of this issue for me, though I have no idea).
Advertisement
You can choose not to clear the color buffer with glClear, and only draw the objects that have changed.
If you don't clear the colour-buffer, you'll get ugliness when things are moving and there isn't full overdraw.

Read up on dirty rectangles.
Basically you define a region that needs to be fully redrawn and check all objects to see if they're in that area, then draw. A clipping/scissor-area can be used to mark it out when drawing the background so clean objects won't be overdrawn.

..but; the whole redraw-only-the-things-that-have-changed is quite obsolete and people expect things to refresh in a proper manner nowadays. I'd just forget about it unless dealing with DOS on a <486. (Special cases ofcourse exist, but this does not seem like one)

glPushMatrix();
translate
draw
glPopMatrix();
will keep the other objects from moving when translating.
> ..but; the whole redraw-only-the-things-that-have-changed is quite obsolete and people expect things to refresh in a proper manner nowadays

WOW... that's quite a surprise! I would have thought this would speed things up massively, but I guess its just blatting all of the pixels to the screen anyway (even if redrawing is not done). So I should redraw/refresh everything each frame anyway....ok.

Thanks for your help!
Matt

This topic is closed to new replies.

Advertisement