cube will not rotate, have no idea why?
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.
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
/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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement