Original Post
Hi I am trying to create a viewport in a window (which will be slighly smaller in x and y than the window. When my project starts it seems to create the viewport but then switches to the default viewport (entire window) shortly after. Also, all my callbacks are in the init() function. Any ideas?
//Create 2D Map Window
glutInitWindowSize(300, 300);
glutInitWindowPosition(610,1);
windowMap = glutCreateWindow("2D Map Window");
init();
glViewport(50, 50, 249, 249);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(worldxBegin,worldxEnd,worldyBegin,worldyEnd,10,-10);
glMatrixMode(GL_MODELVIEW);
glutDisplayFunc(displayA);
Here is my display function:
//Function that creates 2D Map
void displayMap()
{
glutSetWindow(windowMap);
glClearColor(wc1, wc2, wc3, 0.0); //Set ground color
glClear(GL_COLOR_BUFFER_BIT);
drawObjects(); //Draw objects
//Draw white arrow
glPushAttrib(GL_ALL_ATTRIB_BITS);
glPushMatrix();
glColor3f(1,1,1);
glTranslatef(-Aposx,-Aposy,0);
glRotatef((-1)*arrowAngle,0,0,1);
glTranslatef(Aposx,Aposy,0);
Aposx = (Aposx + ox);
Aposy = (Aposy + oy);
glTranslatef(-Aposx,-Aposy,0);
draw_arrow();
glPopAttrib();
glPopMatrix();
glutSwapBuffers();
glutSetWindow(window3D); //Set active window back to 3D
}