View Full Version : viewport problem

12-18-2001, 04:51 PM

I have a opengl window with different views of the same scene. To achieve this I use glViewport. Everything works fine except for 2 things:

1. When I use bitmap characters with glutBitmapCharacter, the characters cross the border set with glViewport and are also displayed outside of it. How can I avoid this?

2. Picking and reading the depth buffer don't seem to be influenced by the viewport and are always relative to the whole window. Also I found a workaround, this seems strange to me.

Can someone explain me these points??

Thanks http://www.opengl.org/discussion_boards/ubb/smile.gif

12-18-2001, 05:33 PM
Sorry, me again...

I have another similar question:
the command glClear(...) is also always relative to the whole window and not the viewport. How can I change this?

Concret example: I have a first viewport which has the same size as my window. I render the scene to that viewport. After that I want to display the same scene with a different view angle in a smaller viewport above the first one (kind of window in window). To achieve this I have to clear the color and depth buffer of the zone specified by my second viewport. But the command glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) clears my whole window... http://www.opengl.org/discussion_boards/ubb/frown.gif

12-18-2001, 05:43 PM
Look at glScissor - I think this is what you are after http://www.opengl.org/discussion_boards/ubb/smile.gif

While the scissor test is enabled, only pixels that lie within the scissor box can be modified by drawing commands.

12-18-2001, 07:14 PM
Thanks Shag!

glScissor works fine with glutBitmapCharacter... but it seems that it doesn't affect glClear at all?? Do I have to clear pixel after pixel?

12-18-2001, 07:31 PM
Sorry sorry,

I did a stupid mistake, but now it is working! So glScissor affects glClear...

Thanks http://www.opengl.org/discussion_boards/ubb/smile.gif