In OpenGL how can I hide part of a shape?

And slowly reveal it?
                                           
Use the stencil buffer.
Is it useful for making shapes look like they animated into view?
Look up glfog
FWIW, glFog is deprecated in later versions of OpenGL.

Also can you be more specific about what you want? Do you just want an object to scroll in from the side of the screen? Or start far away from the camera and move closer? Or "appear out of thin air" like it was being teleported with a star trek teleporter? Or fade in from a solid color? Or what?
Last edited on
Well basically, I want rectangles in my 2D gui to slide into view when I click a certain rectangle..

So I click this -> []

And then it becomes -> [ ]

But I don't want it to happen instantly I want it to animate/slide into view from the side..
So just translate the box.
The idea behind basic animation is you move an object slowly over a period of time.

Give your object a velocity. Every update.. add its velocity to its position. Then set its velocity to 0 when it's at the final position you want it to be.
Thanks
Topic archived. No new replies allowed.