Jump to content
  • Advertisement
Sign in to follow this  
rhumba

OpenGL Only redrawing whats changed?

This topic is 4957 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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).

Share this post


Link to post
Share on other sites
Advertisement
You can choose not to clear the color buffer with glClear, and only draw the objects that have changed.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
> ..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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!