Advertisement

Opengl frames

Started by May 30, 2002 01:36 PM
11 comments, last by diddly-yo 22 years, 8 months ago
Can someone please explain (or give a hint or suggestion, anything) how to create "sub windows" like those used in Nate Robins'' GL Tutors (http://www.xmission.com/%7Enate/tutors.html) without using glut? I feel like I''ve run into a brick wall with my project. Thanks, diddly
He probably uses scissor testing, from what I can tell from the screen shots.

Advertisement
Play with the glViewport command : set a viewport, render, repeat.

Documents [ GDNet | MSDN | STL | OpenGL | Formats | RTFM | Asking Smart Questions ]
C++ Stuff [ MinGW | Loki | SDL | Boost. | STLport | FLTK | ACCU Recommended Books ]


[edited by - Fruny on May 30, 2002 3:27:57 PM]
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Ok, that brings up another question I have been meaning to ask. What exactly (ok, not exactly, just generally) does the glViewport() command do? I have tried playing around with it, but I can''t seem to understand what it does. I read the documentation on msdn, but I am unclear on a few (read: many) things. When it refers to "affine coordinates" and "normalized device coordinates," what is it talking about?

Thanks for the help,
diddly
glViewport controls the window coordinates, where in the window will the GL scene be drawn.

Imagine you have a window origin (0,0) dimensions (w,h).
glViewport(0,0,w,h) makes you render to the whole window
glViewport(0,0,w/2,h/2) makes you render to the upper-left quarter.


Documents [ GDNet | MSDN | STL | OpenGL | Formats | RTFM | Asking Smart Questions ]
C++ Stuff [ MinGW | Loki | SDL | Boost. | STLport | FLTK | ACCU Recommended Books ]
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Oh right, so is that how the picture-in-picture in Counter-strike is done?

Henrym

[edited by - henrym on June 2, 2002 5:06:54 PM]
Advertisement
How are the coordinates numbered? Is (0, 0) the upper left or bottom left corner?

diddly
quote:
Original post by diddly-yo
How are the coordinates numbered? Is (0, 0) the upper left or bottom left corner?

diddly



glViewport


bottom left, but checkout the MSDN for further information on the function, as well as all OpenGL functions....

To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
I guess that''s how you would do split screen rendering, as well? Like, for a simultaneous two player game?
Yep. Just set the viewport to the top half of the screen, render for player 1, set vieport to bottom half, render for player 2.

Be sure you set the perspective correctly. Instead of the windowheight, use windowheight/2.

Sander Maréchal

[Lone Wolves Production][Articles][E-mail]

<hr />
Sander Marechal<small>[Lone Wolves][Hearts for GNOME][E-mail][Forum FAQ]</small>

This topic is closed to new replies.

Advertisement