A question of OpenGL

I have created a merry go round model,how can i let it spin?
Did i need to use For loop?
It is better if someone can show me example script.

1 more question,how to create half sphere?
Last edited on
You can make it spin with a static variable
eg:
1
2
3
4
static double angle = 0; // initialized only once, it will maintain its old value when the code is executed egain
angle += spin_speed; // you should take care of FPS
glRotated ( angle, 0, 1, 0 ); // rotate
// draw your stuff 


how to create half sphere?
Can you create a sphere yourself (ie not using glutSolidSphere) ?
Can you create a sphere yourself (ie not using glutSolidSphere) ?

I cannot create a perfect half sphere so i ask about it.
Beside that the Merry go round spin now,thank you.:)

Emm...add 1more question.
How to make thing half transparent?
I use glColor4f(1.0,1.0,1.0,0.5); seem nothing happen...?
Last edited on
You need to set up the blending:
1
2
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // set the blendig operation, see http://www.opengl.org/sdk/docs/man/xhtml/glBlendFunc.xml 


For the sphere you can find many examples on the net: http://www.google.com/search?q=opengl+sphere+-glutsolidsphere
Topic archived. No new replies allowed.