Jump to content
  • Advertisement
Sign in to follow this  
mbanghart

glViewPort

This topic is 3805 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
}     

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!