Jump to content
  • Advertisement
Sign in to follow this  
AxL1

OpenGL hiding/unhiding objects during animation

This topic is 4118 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

Hello everyone, I'm new at learning opengl, but right now I'd like to know how I can hide and unhide an object during an animation.

Share this post


Link to post
Share on other sites
Advertisement
Hi, and welcome! (I'm new to the forum in general, so I sympathize =) )

If it helps, you can incorporate it into the objects itself.

If you define a drawn object and give it a member variable that's a boolean... perhaps something like "bHide", you can skip over its drawing routine entirely by wrapping it in a check. For example (in pseudocode, but requires use of an object oriented programming language to make much sense)...




// Assume this is code for a class called "DrawnObject")
private Boolean mbHide

Sub Draw()
// Draw is called by whatever part of your program is drawing objects to the screen.
if (mbHide = False) then
// Perform your drawing.
end if
End Sub



So the program doing the drawing will call any DrawnObject's "Draw" method at the appropriate time, and if it's hidden it'll just skip the code entirely (and thus it'll be as if that object's Draw routine was never called in terms of what you see on the screen).

Hopefully that helps!

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!