PDA

View Full Version : drawing border around viewports



godhand
05-09-2004, 02:21 AM
Hi, I am trying to display 4 different viewports in a window and I want to use a dark line to separate them. Can anyone help? thanks

Bob
05-09-2004, 02:50 AM
You can draw lines by passing GL_LINES, GL_LINE_STRIP or GL_LINE_LOOP to glBegin. With a clever modelview and projection matrix, you can draw the lines in screen space coordinates, like this.

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-0.5, window_width-0.5, -0.5, window_height-0.5, -1, 1);
glBegin(GL_LINE_LOOP);
...Now you can draw the lines in screen space coordinates, and then you just set the viewports and render them as you like.