Hi!
I have 2 questions I hope someone can answer me!
This is my code for the drawing/rendering:
//Draw the axes
glBegin(GL_LINES);
glColor3f(1.0f,0.0f,0.0f); //Red
glVertex3i(0,0,0);
glVertex3i(300,0,0);
glColor3f(0.0f,0.0f,1.0f); //Blue
glVertex3i(0,0,0);
glVertex3i(0,300,0);
glColor3f(0.0f,1.0f,0.0f); //Green
glVertex3i(0,0,0);
glVertex3i(0,0,300);
//Draw sphere number 1
glColor3f(1.0f,1.0f,1.0f); //White
GLUquadric *myQuad;
GLdouble radius = 3.0;
GLint slices, stacks;
myQuad=gluNewQuadric();
slices = stacks = 10;
gluSphere( myQuad , radius , slices , stacks );
//Draw sphere number 2
glColor3f(1.0f,0.0f,0.0f); //Red
myQuad=gluNewQuadric();
gluSphere( myQuad , radius , slices , stacks );
//Draw sphere number 3
glColor3f(0.0f,0.0f,1.0f); //Blue
myQuad=gluNewQuadric();
gluSphere( myQuad , radius , slices , stacks );
glEnd();
Question #1: This code places all the spheres at the origin, no surprise since this is stated in the definition of the gluSphere function. But how can I set the position to whatever I want?
Question #2: How can I be notified when the user clicks on one of the spheres? I also need to know which of the spheres that were clicked?
Very greatful for any help here!
Cheers!