about drawing spheres

hi everyone.

i am starter for opengl. i have a project… its name is balls pyramid. http://www.3dpuzzles.nl/puzzles/ballspyramid/bollenpiramide.gif here is the pieces of my puzzle. how can i draw this 5 pieces? i dont have any idea. pieces must be movable with direction keys…

thanks…

“how can i draw this 5 pieces?”
build one instance of the sphere (vertex -index buffers) and render them with different transformation matrix (MODELVIEW). rotation is not important only the translation counts here (glTranslate). with this you displace the spheres where you want them. same with direction keys which is not an OpenGL issue. grab pressed keys in your application and adjust the values in glTranslate. you can use GLUT to draw spheres.

:slight_smile: thank you but i have no idea for codes. do you have an example?

none. but google has plenty.

any link? i couldnt find any document about it

Come on …
http://www.opengl.org/sdk/docs/man/xhtml/gluSphere.xml