here is the reshape funcion I have, I know it works but I just dont understand how??
void reshape(int w, int h)
glViewport(0, 0, (GLsizei)w, (GLsizei)h) ;
gluPerspective(45, (GLfloat)w/(GLfloat)h, 0.1, 100.0) ;
in the entire program, this is the only place where gluPerspective appears and sets the matrix in perspective mode, but below that line there is glLoadIdentity, which resets the matrix, then theres glPopMatrix, which pops the matrix stored at the beginning of reshape function, so howcome when I enter the display function and draw something:
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glRotatef(g_lookupdown,1.0f,0,0); //look up and down
glRotatef(sceneroty,0,1.0f,0); //look side to side
glTranslatef(xtrans, ytrans, ztrans); //moving all directions
glColor4f(1.0, 1.0, 0.0, 1.0);
they are in perspective mode and not reset??
I also need better explaination of
those tutorials and documents do not explain enough and I think understanding these will explain my question above. I know these store the matrix configuation made by the lines of code above it, but when and how are they “popped” back into effect?
How does GL_PROJECTION and GL_MODELVIEW differ and can I just use one in the reshape function and not the other? how does that change the way my objects look?
Any help would be greatly appreciated.