Maybe you should go back through the lesson’s 1 to 30…
You would see how to keep track of an object, via variables.
example:
GLfloat object[2][3]; create two objects with 3 variables.
object[0][0] = x data object 1
object[0][1] = y data
object[0][2] = z data
object[1][0] = x data object 2
object[1][1] = y data
object[1][2] = z data
// moving things around.
// First object, note when accessing a array, it starts at 0 not 1.
glPushMatrix();
glTranslatef( object[0][0], object[0][1], object[0][2]); // move our object
gluSphere( …); // add relivent data for sphere.
glPopMatrix();
// Draw second sphere
glPushMatrix();
glTranslatef( object[1][0], object[1][1], object[1][2]); // move our object
gluSphere( …); // add relivent data for sphere.
glPopMatrix();
Originally posted by torbjorn:
[b]I think I have gotten a bit further by reading lesson 30 at nehe.gamedev.net.
My application makes it possible to actually just use speres. For each frame I can check if the distance between e.g. two balls is smaller than radiusBall_1+radiusBall_2.
I guess I can use this function:
void gluSphere( GLUquadricObj *qobj,
GLdouble radius,
GLint slices,
GLint stacks )
for drawing the spheres, but how can I check the position of the spheres at each frame?
Is there some function like
“glGetPosition(GLUquadricObj *qobj)” existing?
So: How can I check the position of the sphere?
Thanks!
Torbjørn[/b]