I wanted to make a primitive(eg:rect,circle) drawn on a window and make it visible and invisible when required.
Please suggest something.+
First of all a primitive in OpenGL is a triangle fan, triangle strip, triangle list, etc. The spheres and what not are higher order contructs that were made using the OpenGL primitives.
You should check out http://nehe.gamedev.net & http://www.gametutorials.com
They should tell you everything you need to know to do what you want. If you have any questions while creating you project, we'd all be more than happy to help.