• Advertisement

Archived

This topic is now archived and is closed to further replies.

GLdrawScene object....

This topic is 5837 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

if I have a cube in space.... glTranslatef(-5.0,y,-100.0f); glBegin(GL_QUADS); //the cube glColor3f(1.0, 0.0, 0.0); glNormal3f( 0.0f, 0.0f, 1.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f( -15.0f, 2.0f, 1.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f( -17.0f, 2.0f, 1.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f( -17.0f, 0.0f, 1.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f( -15.0f, 0.0f, 1.0f); glEnd(); glTranslatef(5.0,-y,100.0f); ...and I want it to stop moving when it hits a certain y axis in space, how do I make it stop???

Share this post


Link to post
Share on other sites
Advertisement
you can put a if before the glTranslatef(...)

if(y > value_u_want_to_stop)
{
glTranslatef(5.0,-y,100.0f);
}

That code will ensure u wont translate the cube when you dont want it to be

tell me if thats not what u wanted to say

Share this post


Link to post
Share on other sites
right now I have...
if(x > 55)
{
glTranslatef(5.0,-y,100.0f);
cout<<"you win!!!"<}


...it seems to pass right by those coordinates. Maybe take a look at the cube again.

Share this post


Link to post
Share on other sites

  • Advertisement