Skip to main content
gamedev.net
🔒 Locked

Opengl frames

Started by diddly-yo May 30, 2002 at 1:36 PM 11 replies 550+ views
Original Post
diddly-yo
diddly-yo
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
Null and Void
Null and Void
He probably uses scissor testing, from what I can tell from the screen shots.

Fruny
Fruny
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
diddly-yo
diddly-yo
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
Fruny
Fruny
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
henrym
henrym
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]
diddly-yo
diddly-yo
How are the coordinates numbered? Is (0, 0) the upper left or bottom left corner?

diddly
jenova
jenova
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.
hotrod5150_1984
hotrod5150_1984
I guess that''s how you would do split screen rendering, as well? Like, for a simultaneous two player game?
Sander
Sander
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]
hotrod5150_1984
hotrod5150_1984
yeah, i''ll have to try it out. I always thought it would be really cool. I was thinking left and right though, not top and bottom, but either way it''s basically the same. Or, i guess you could make it configurable which way the split goes. I guess it''s a totally different thing, rendering to two different monitors at the same time?? Like, if the video card has dual monitor support. I imagine that would be card specific code? Does anyone know?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.