Jump to content

  • Log In with Google      Sign In   
  • Create Account

Why did this happen?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 SonShadowCat   Members   -  Reputation: 122

Like
Likes
Like

Posted 05 January 2002 - 06:52 AM

now i made this little scene a while ago involving 2 textured cubes rotating the thing is, in addition to rotating the cubes were going all over the place here is the code
        
  glRotatef( xrotone, 1.0f, 0.0f, 0.0f);  // Rotate on the x axis by xrot

  glRotatef( yrotone, 0.0f, 1.0f, 0.0f);  // Rotate on the y axis by yrot

  glRotatef( zrotone, 0.0f, 0.0f, 1.0f);  // Rotate on the z axis by zrot


  glBindTexture(GL_TEXTURE_2D, texture[0]);  // Select a texture to use


  glBegin(GL_QUADS);  // Start drawing quads

    glNormal3f( 0.0f, 0.0f, 1.0f);  // Light facing viewer

    glTexCoord2f( 0.0f, 1.0f);  // Top left part of texture

    glVertex3f( -1.0f, 1.0f, 0.0f);  // Top left point (front face)

    glTexCoord2f( 0.0f, 0.0f);  // Bottom left part of texture

    glVertex3f( -1.0f, -1.0f, 0.0f);  // Bottom left point (front face)

    glTexCoord2f( 1.0f, 0.0f);  // Bottom right part of point

    glVertex3f( 1.0f, -1.0f, 0.0f);  // Bottom right point (front face)

    glTexCoord2f( 1.0f, 1.0f);  // Top right of texture

    glVertex3f( 1.0f, 1.0f, 0.0f);  // Top right point (front face)


    glNormal3f( 1.0f, 0.0f, 0.0f);  // Light facing right of viewer

    glTexCoord2f( 0.0f, 1.0f);  // Top left part of texture

    glVertex3f( 1.0f, 1.0f, 0.0f);  // Top Left point(right face)

    glTexCoord2f( 0.0f, 0.0f);  // Bottom left part of texture

    glVertex3f( 1.0f, -1.0f, 0.0f);  // Bottom left point (right face)

    glTexCoord2f( 1.0f, 0.0f);  // Bottom right part of point

    glVertex3f( 1.0f, -1.0f, 2.0f);  // Bottom right point (right face)

    glTexCoord2f( 1.0f, 1.0f);  // Top right of texture

    glVertex3f( 1.0f, 1.0f, 2.0f);  // Top right point (right face)


    glNormal3f( 0.0f, 0.0f, -1.0f);  // Light facing away from viewer

    glTexCoord2f( 0.0f, 1.0f);  // Top left part of texture

    glVertex3f( -1.0f, 1.0f, 2.0f);  // Top left point (back face)

    glTexCoord2f( 0.0f, 0.0f);  // Bottom left part of texture

    glVertex3f( -1.0f, -1.0f, 2.0f);  // Bottom left point (back face)

    glTexCoord2f( 1.0f, 0.0f);  // Bottom right part of point

    glVertex3f( 1.0f, -1.0f, 2.0f);  // Bottom right point (back face)

    glTexCoord2f( 1.0f, 1.0f);  // Top right of texture

    glVertex3f( 1.0f, 1.0f, 2.0f);  // Top right point (back face)


    glNormal3f( -1.0f, 0.0f, 0.0f);  // Light facing left of viewer

    glTexCoord2f( 0.0f, 1.0f);  // Top left part of texture

    glVertex3f( -1.0f, 1.0f, 0.0f);  // Top Left point(left face)

    glTexCoord2f( 0.0f, 0.0f);  // Bottom left part of texture

    glVertex3f( -1.0f, -1.0f, 0.0f);  // Bottom left point (left face)

    glTexCoord2f( 1.0f, 0.0f);  // Bottom right part of point

    glVertex3f( -1.0f, -1.0f, 2.0f);  // Bottom right point (left face)

    glTexCoord2f( 1.0f, 1.0f);  // Top right of texture

    glVertex3f( -1.0f, 1.0f, 2.0f);  // Top right point (left face)


    glNormal3f( 0.0f, 1.0f, 0.0f);  // Light facing top of viewer

    glTexCoord2f( 0.0f, 1.0f);  // Top left part of texture

    glVertex3f( 1.0f, 1.0f, 0.0f);  // Top left point (top face)

    glTexCoord2f( 0.0f, 0.0f);  // Bottom left part of texture

    glVertex3f(  1.0f, 1.0f, 2.0f);  // Bottom left point (top face)

    glTexCoord2f( 1.0f, 0.0f);  // Bottom right part of point

    glVertex3f( -1.0f, 1.0f, 2.0f);  // Bottom left point (top face)

    glTexCoord2f( 1.0f, 1.0f);  // Top right of texture

    glVertex3f( -1.0f, 1.0f, 0.0f);  // Top right point (top face)


    glNormal3f( 0.0f, -1.0f, 0.0f);  // Light facing bottom of viewer

    glTexCoord2f( 0.0f, 1.0f);  // Top left part of texture

    glVertex3f( 1.0f, -1.0f, 0.0f);  // Top left point (top face)

    glTexCoord2f( 0.0f, 0.0f);  // Bottom left part of texture

    glVertex3f(  1.0f, -1.0f, 2.0f);  // Bottom left point (top face)

    glTexCoord2f( 1.0f, 0.0f);  // Bottom right part of point

    glVertex3f( -1.0f, -1.0f, 2.0f);  // Bottom left point (top face)

    glTexCoord2f( 1.0f, 1.0f);  // Top right of texture

    glVertex3f( -1.0f, -1.0f, 0.0f);  // Top right point (top face)

  glEnd();
    
this is the code for one of the cubes plz hlp thx "Those who serve no purpose, have no purpose" Edited by - SonShadowCat on January 5, 2002 1:53:33 PM Edited by - SonShadowCat on January 5, 2002 1:53:54 PM Edited by - SonShadowCat on January 5, 2002 1:55:42 PM

Sponsor:

#2 SonShadowCat   Members   -  Reputation: 122

Like
Likes
Like

Posted 05 January 2002 - 06:54 AM

sry, the code didnt show up right( there is alot of space between the code for mine)

"Those who serve no purpose, have no purpose"

#3 masonium   Members   -  Reputation: 118

Like
Likes
Like

Posted 05 January 2002 - 10:52 AM

1. Are you translating back so that you can see the cubes correctly?

2. Are you pushing/popping the matrix?

No, HTML is not an OO language.

#4 Dragonskin   Members   -  Reputation: 122

Like
Likes
Like

Posted 06 January 2002 - 02:58 PM

Try loading the identity matrix each time you draw the scene.

If you''re incrementing the rotation values without reseting the matrix, everything will be rotating from the position the matrix was in last (your second cube).




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS