Sign in to follow this  

Position of Object

Recommended Posts

In the case of glutSolidSphere, there is no object. The function uses lower level OpenGL calls to "send" the shape of a sphere to the graphics card. It does not record anywhere that you sent a sphere.

You could do something like this:

class sphere
float radius;
float xpos,ypos,zpos;
sphere(float R,X,Y,Z)
xpos = X; ypos = Y; zpos = Z;
radius = R;


Then just create an array of spheres, and call the draw() method when you want to draw it, and add some member functions to get the position. On each update of the game you move your spheres and / or read their positions, and when you render you simply call the draw function.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this