Archived

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

Xzibit

Whats wrong with this???

Recommended Posts

Xzibit    122
I build this and it makes it appear slowly from top to bottem then dissapears lol.... wtf im trying to make it spin by user input whats wrong?? glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient); glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuse); glLightfv(GL_LIGHT1, GL_POSITION,LightPosition); // Position The Light glClearColor( 0.0f, 0.0f, 0.0f, 0.0f ); glClear( GL_COLOR_BUFFER_BIT ); glClearColor(0.5f,0.5f,0.5f,1.0f); // We''ll Clear To The Color Of The Fog ( Modified ) glEnable(GL_LIGHT1); glLoadIdentity(); glPushMatrix(); blah=0.0; glBegin(GL_QUADS); // Start Drawing A Quad glColor3f(1.0f,0.0f,0.0f); glVertex3f(-1.0f, 1.0f, -1.0f); // Top Left Of The Quad glColor3f(0.0f, 1.0f, 0.0f); glVertex3f( 1.0f, 1.0f, -1.0f); // Top Right Of The Quad glColor3f(0.0f, 0.0f, 1.0f); glVertex3f( 1.0f,-1.0f, -1.0f); // Bottom Right Of The Quad glColor3f(1.0f, 1.0f, 0.0f); glVertex3f(-1.0f,-1.0f, -1.0f); // Bottom Left Of The Quad glEnd(); // Done Drawing The Quad glPopMatrix(); glTranslatef(0.0f,0.0f,z); glRotatef(xrot,1.0f,0.0f,0.0f); // Rotate The Pyramid On It''s Y Axis glRotatef(yrot,0.0f,1.0f,0.0f); glPushMatrix(); theta+=0.1; glBegin( GL_TRIANGLES ); glColor3f(0.5f,0.0f,0.0f); // Red glVertex3f( 0.0f, 0.5f, 0.0f); // Top Of Triangle (Front) glColor3f(0.0f,0.5f,0.0f); // Green glVertex3f(-0.5f,-0.5f, 0.5f); // Left Of Triangle (Front) glColor3f(0.0f,0.0f,0.5f); // Blue glVertex3f( 0.5f,-0.5f, 0.5f); // Right Of Triangle (Front) glColor3f(0.5f,0.0f,0.0f); // Red glVertex3f( 0.0f, 0.5f, 0.0f); // Top Of Triangle (Right) glColor3f(0.0f,0.0f,0.5f); // Blue glVertex3f( 0.5f,-0.5f, 0.5f); // Left Of Triangle (Right) glColor3f(0.0f,0.5f,0.0f); // Green glVertex3f( 0.5f,-0.5f, -0.5f); // Right Of Triangle (Right) glColor3f(0.5f,0.0f,0.0f); // Red glVertex3f( 0.0f, 0.5f, 0.0f); // Top Of Triangle (Back) glColor3f(0.0f,0.5f,0.0f); // Green glVertex3f( 0.5f,-0.5f, -0.5f); // Left Of Triangle (Back) glColor3f(0.0f,0.0f,0.5f); // Blue glVertex3f(-0.5f,-0.5f, -0.5f); // Right Of Triangle (Back) glColor3f(0.5f,0.0f,0.0f); // Red glVertex3f( 0.0f, 0.5f, 0.0f); // Top Of Triangle (Left) glColor3f(0.0f,0.0f,0.5f); // Blue glVertex3f(-0.5f,-0.5f,-0.5f); // Left Of Triangle (Left) glColor3f(0.0f,0.5f,0.0f); // Green glVertex3f(-0.5f,-0.5f, 0.5f); // Right Of Triangle (Left) glEnd(); SwapBuffers(hDC); // Swap Buffers (Double Buffering) if (keys[''L''] && !lp) // L Key Being Pressed Not Held? { if (!light) // If Not Light { glDisable(GL_LIGHTING); // Disable Lighting } else // Otherwise { glEnable(GL_LIGHTING); // Enable Lighting } } if (!keys[''L'']) // Has L Key Been Released? { lp=FALSE; // If So, lp Becomes FALSE } if (keys[VK_PRIOR]) // Is Page Up Being Pressed? { z-=0.02f; // If So, Move Into The Screen } if (keys[VK_NEXT]) // Is Page Down Being Pressed? { z+=0.02f; // If So, Move Towards The Viewer } if (keys[VK_UP]) // Is Up Arrow Being Pressed? { xspeed-=0.01f; // If So, Decrease xspeed } if (keys[VK_DOWN]) // Is Down Arrow Being Pressed? { xspeed+=0.01f; // If So, Increase xspeed } if (keys[VK_RIGHT]) // Is Right Arrow Being Pressed? { yspeed+=0.01f; // If So, Increase yspeed } if (keys[VK_LEFT]) // Is Left Arrow Being Pressed? { yspeed-=0.01f; // If So, Decrease yspeed } glPopMatrix(); xrot+=xspeed; // Add xspeed To xrot yrot+=yspeed; // Add yspeed To yrot if (theta == 0.200) { theta-=0.199f; --------------------------- X to da Z!

Share this post


Link to post
Share on other sites