PDA

View Full Version : Altering viewport on OpenGL



tobindax
08-16-2010, 11:54 AM
I miss something basic since this doesn't work.

It's on SDL and GLEW; the app does bring a context and does draw a primitive with Draw_Scene().


glViewport(0, 0, wwidth / 2, wheight / 2);
glTranslatef(0, 0, -10);
glRotatef(rotate_y, 1, 0, 0);
glRotatef(rotate_x, 0, 1, 0);
Draw_Scene();
SDL_GL_SwapBuffers();
wwidth and wheight refer to window res, rotate_y and rotate_x adjust with mouse movement (also any constant value is same; it leaves the viewport on default position).

The basic function that does draw the primitive properly in main event loop only does:


Draw_Scene();
SDL_GL_SwapBuffers();

mhagain
08-16-2010, 05:48 PM
Have you set your modelview and projection matrixes?