Hi,
I am have a map for my program that pops up when ever I press ‘m’, but I would create a new subwindow for it and it ate too much memory so I thought glViewport would be a better way to go. My problem is that I can’t figure out how to get it to work. Here is my code.
void map()
{
glViewport(900,0,1000,100);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-10, 10, -10, 10, -10,10);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
<draw map>
}
void update()
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(60, 1000/700, 0.1, 50);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(view.x,view.y, view.z, view.lx, view.ly, view.lz, 0, 0, 1);
}
}
void display()
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glViewport(0,0,width,hight);
glLoadIdentity();
update();
<draw scene>
if(button[M])
map();
glutPostRedisplay();
glutSwapBuffers();
glFlush();
}
What am I doing wrong? All replies are greatly appretiated