PDA

View Full Version : Drawing Lines in Viewport



ToddAtWSU
10-09-2005, 06:36 AM
I am trying to draw 3 lines in the bottom right corner of a screen. I have created 4 viewports and am currently drawing objects in the 2 top viewports and the bottom left viewport. The code I am using to draw the line in the bottom right viewport is as follows.

glViewport( (GLsizei) ( w / 2 ), (GLsizei) ( 0 ), (GLsizei) ( w / 2 ), (GLsizei) ( h / 2 ) );
glLoadIdentity( );
glColor3f( 0.0, 0.0, 1.0 );
glLineWidth( 10.0 );
glBegin( GL_LINES );
glVertex2i( ( w / 2 + 20 ), ( h / 8 ) );
glVertex2i( ( w - 20 ), ( h / 8 ) );
glEnd( );

w is the width of my screen and h is the height of it. I want a 20 pixel buffer on both the left and right side of the viewport and the line being drawn. Can anyone help me figure out why this line is not drawing. I want the line a 1/4 the viewport which would be 1/8 of the way up the screen. Thanks for any help you can give me!

-Todd

ToddAtWSU
10-10-2005, 06:39 AM
I figured out my problem. I was doing an glOrtho( -2, 2, -2, 2, -2, 2) and then trying to draw lines at points far beyond the bounds of x=2 and y=2. So I got this working just fine. Thanks anyways!