Cant you just use gluLookAt to look AT your robot from where you ARE. It seems you already have the values to plug right into the method.
Pete
Simulation HELP
Ahh well I think i've figured it out to an exstent I think this will work. But when I run it i just get a black screen.
A man walks into a bar.....ouch!?! Ya get it, do ya huh huh well....awww I give up.
Edited by - ARID on January 31, 2001 8:58:16 PM
Edited by - ARID on January 31, 2001 9:00:14 PM
int DrawGLScene(GLvoid) // Here's Where We Do All The Drawing{ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer glLoadIdentity(); // Reset The Current Modelview Matrix glTranslatef(-1.25f,-1.0f,-0.5f); glRotatef(180,0.0f,1.0f,0.0f); glBegin(GL_QUADS); glColor3f(1.0f, 0.0f, 0.0f); glVertex3f(2.5f, 0.0f, 0.0f); //Front bottom right glVertex3f(2.5f, 0.5f, 0.0f); //Front top right glVertex3f(-2.5f, 0.5f, 0.0f); //Front top left glVertex3f(-2.5f, 0.0f, 0.0f); //Front bottom left //glColor3f(1.0f,1.0f,1.0f); //glVertex3f(2.5f, 0.5f, 0.0f); //Glass bottom right //glVertex3f(2.5f, 1.5f, 0.0f); //Glass top right //glVertex3f(-2.5f, 1.5f, 0.0f); //Glass top left //glVertex3f(-2.5f, 0.5f, 0.0f); //Glass bottom left glColor3f(0.25f, 0.25f, 0.25f); glVertex3f(2.5f, 0.5f, 0.0f); //Sill forward right glVertex3f(2.5f, 0.5f, 0.25f); //Sill Rear right glVertex3f(-2.5f, 0.5f, 0.25f); //Sill rear left glVertex3f(-2.5f, 0.5f, 0.0f); //Sill forward left glEnd(); glTranslatef(-1.25f, -1.0f, -11.0f); glBegin(GL_QUADS); glColor3f(1.0f, 0.0f, 0.0f); glVertex3f(2.5f, 0.0f, 0.0f); //Front bottom right glVertex3f(2.5f, 0.5f, 0.0f); //Front top right glVertex3f(-2.5f, 0.5f, 0.0f); //Front top left glVertex3f(-2.5f, 0.0f, 0.0f); //Front bottom left glColor3f(1.0f,1.0f,1.0f); glVertex3f(2.5f, 0.5f, 0.0f); //Glass bottom right glVertex3f(2.5f, 1.5f, 0.0f); //Glass top right glVertex3f(-2.5f, 1.5f, 0.0f); //Glass top left glVertex3f(-2.5f, 0.5f, 0.0f); //Glass bottom left glColor3f(0.25f, 0.25f, 0.25f); glVertex3f(2.5f, 0.5f, 0.0f); //Sill forward right glVertex3f(2.5f, 0.5f, 0.25f); //Sill Rear right glVertex3f(-2.5f, 0.5f, 0.25f); //Sill rear left glVertex3f(-2.5f, 0.5f, 0.0f); //Sill forward left glEnd(); glTranslatef(-1.25f,-1.0f,-5.5f); glRotatef(0,0.0f,0.0f,0.0f); glBegin(GL_QUADS); glColor3f(0.5f, 0.5f, 1.0f); // Purpleish floor glVertex3f(-5.0f, 0.0f, 2.5f); //Floor top left glVertex3f(-5.0f, 0.0f, -2.5f); //Floor bottom left glVertex3f(5.0f, 0.0f, -2.5f); //Floor bottom right glVertex3f(5.0f, 0.0f, 2.5f); //Floor top right glColor3f(0.2f, 0.2f, 0.2f); //Grey side glVertex3f(-5.0f, 0.5f, -2.5f); //Forward top left glVertex3f(-5.0f, 0.0f, -2.5f); //Forward bottom left glVertex3f(5.0f, 0.0f, -2.5f); //Forward bottom right glVertex3f(5.0f, 0.5f, -2.5f); //Forward top right glColor3f(0.2f, 0.2f, 0.2f); //Grey side glVertex3f(-5.0f, 0.5f, 2.5f); //Back top left glVertex3f(-5.0f, 0.0f, 2.5f); //Back bottom left glVertex3f(5.0f, 0.0f, 2.5f); //Back bottom right glVertex3f(5.0f, 0.5f, 2.5f); //Back top right glEnd(); glPushMatrix; glLoadIdentity; glColor3f(1.0f,1.0f,0.0f); glTranslatef(xpos, -1.0f, zpos); glRotatef(heading,0.0,1.0,0.0); glBegin(GL_QUADS); glVertex3f(-0.75f, 0.0f, 0.5f); //Base rear left glVertex3f(-0.75f, 0.0f, -0.5f); //Base forward left glVertex3f(0.75f, 0.0f, -0.5f); //Base forward right glVertex3f(0.75f, 0.0f, 0.5f); //Base rear right glVertex3f(0.75f, 0.0f, 0.5f); //Top rear right glVertex3f(0.75f, 0.0f, -0.5f); //Top forward right glVertex3f(-0.75f, 0.5f, -0.5f); //Top forward left glVertex3f(-0.75f, 0.5f, 0.5f); //Top rear left glVertex3f(-0.75f, 0.5f, 0.5f); //Back rear top glVertex3f(-0.75f, 0.0f, 0.5f); //Back rear bottom glVertex3f(-0.75f, 0.0f, -0.5f); //Back forward bottom glVertex3f(-0.75f, 0.5f, -0.5f); //Back forward top glEnd(); glPopMatrix; return TRUE;}
A man walks into a bar.....ouch!?! Ya get it, do ya huh huh well....awww I give up.
Edited by - ARID on January 31, 2001 8:58:16 PM
Edited by - ARID on January 31, 2001 9:00:14 PM
A man walks into a bar.....ouch!?! Ya get it, do ya huh huh well....awww I give up.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement