# OpenGL ortho vs persp. GL_PROJECTION problem?

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

## Recommended Posts

##### Share on other sites
Quote:
 but the rectangle is not cut off by the viewport

Don't have time to take a proper look, but I did notice this. Be careful here as glViewport does *not* ensure that no drawing will occur outside of the viewport.

##### Share on other sites
Thx for the replies, but it's not precisely what I'm looking for.As of now, I'm only looking for a reason why the following code results in no visible text.
display(){//...   glViewport((windowwidth * 3) / 4, 0,     windowwidth / 4, windowheight);   glMatrixMode(GL_PROJECTION);   glLoadIdentity();   gluOrtho2D((windowwidth * 3) / 4,windowwidth,0, windowheight);   glMatrixMode(GL_MODELVIEW);   glLoadIdentity();   glClear(GL_DEPTH_BUFFER_BIT);   glColor3f(1.0,1.0,1.0);   sprintf(str, "Sample text.");   glRasterPos2f(0.0,(GLfloat)windowheight/2);   render_string(GLUT_BITMAP_HELVETICA_12, str);}

WHY does gluOrtho2D (and normal glOrtho for that matter) work within the confines of the viewport? Setting the ortho to cover the entire window, not just the same area as the viewport, results in the text appearing in the viewport.
I want to be able to define a viewport, define an ortho over the SAME area, and be able to send the text i send there!
Any clues?

1. 1
2. 2
frob
16
3. 3
4. 4
5. 5

• 17
• 13
• 14
• 76
• 22
• ### Forum Statistics

• Total Topics
632148
• Total Posts
3004359

×