cube will not rotate, have no idea why?

Started by
13 comments, last by saisoft 21 years, 2 months ago
Remember that if it''s a wire frame cube, there are two ways of looking at it. The wrong way makes it look distorted and warping when it''s rotating. I didn''t read your code, sorry.
This post will self-destruct in 5 seconds...Actually, it's just Benjamin Bunny doing his thing.
Advertisement
Its because it was being displayed 2d due to the projection matrix used, When a proper 3d projection matrix is used its fine
ok i changed it to perspective view, but now I don''t see the cube, I used the code posted above

/source void ChangeSize(GLsizei w, GLsizei h)
{
if (h==0) // Prevent A Divide By Zero By
{
h=1; // Making Height Equal One
}

glViewport(0, 0, w, h); // Reset The Current Viewport

glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
glLoadIdentity(); // Reset The Projection Matrix

// Calculate The Aspect Ratio Of The Window
// (Field of view, aspect ratio, near, far)
gluPerspective(45.0f,(GLfloat)w/(GLfloat)h,0.1f,100.0f);

glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
glLoadIdentity(); // Reset The Modelview Matrix
} /source
Dosn''t the Red Book say to Rotate before Translation?
Well, im translating to near the middle of the screen and rotating on that central axis, but i tried it anyway, the cube does not show

This topic is closed to new replies.

Advertisement