rotation - OpenGL glMatrixMode(GL_PROJECTION) vs glMatrixMode(GL_MODELVIEW) -
what difference between placing glrotatef() after glmatrixmode(gl_projection);
glmatrixmode(gl_projection); glloadidentity(); glrotatef(red, green, blue); and placing glrotatef() after glmatrixmode(gl_modelview);
glmatrixmode(gl_modelview); glloadidentity(); glrotatef(red, green, blue);
from documentation:
glmatrixmode() specifies matrix current matrix.
gl_modelview - applies subsequent matrix operations modelview matrix stack. gl_projection - applies subsequent matrix operations projection matrix stack. what means?
if set current matrix mode projection (e.g glmatrixmode(gl_projection)), expected change projection matrix. naturally, 1 of them expected next line :
for orthographic projection:
glortho(gldouble left, gldouble right, gldouble bottom, gldouble top, gldouble near, gldouble far);gluortho2d(gldouble left, gldouble right, gldouble bottom, gldouble top);
for perspective projection:
void glfrustum(gldouble left, gldouble right, gldouble bottom, gldouble top, gldouble near, gldouble far);void gluperspective(gldouble fov, gldouble aspect, gldouble near, gldouble far);
if set current matrix mode modelview(e.g glmatrixmode(gl_modelview)), saying in modelview matrix , can apply basic operations transform objects :
glrotatef();gltranslatef();glscalef();
in question if use rotatef after gl_projection instead of gl_modelview, rotate projection matrix corrupt projection matrix.
`
Comments
Post a Comment