# OpenGL hiding/unhiding objects during animation

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

## 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 on other sites
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 mbHideSub Draw()// Draw is called by whatever part of your program is drawing objects to the screen.   if (mbHide = False) then     // Perform your drawing.   end ifEnd 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!

1. 1
2. 2
3. 3
Rutin
15
4. 4
khawk
13
5. 5
frob
12

• 9
• 11
• 11
• 23
• 12
• ### Forum Statistics

• Total Topics
633663
• Total Posts
3013232
×