Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Collin

2D Split Screen?

This topic is 5574 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m working on a 2D sprite-based game using OpenGL, and wonder if anyone has any information on making a split-screen like display. I''d prefer to use one view port, so I can fairly easily make a sprite struct, and have a screen value. If its position is in is corrosponding screen, draw it. If not, don''t. But then arises the problem if part of it is viewable on one of the screens, how do I clip it? Any ideas? There''s probably a simple solution I''m not thinking of... Thanks!

Share this post


Link to post
Share on other sites
Advertisement
You might be able to use a scissor buffer (I think that''s what it''s called). I''ll brb if I can find anything.

______________________________________________________________
The Phoenix shall arise from the ashes... ThunderHawk -- ¦þ
MySite
______________________________________________________________

Share this post


Link to post
Share on other sites
Here we are... Scissor testing should do what you want. NeHe's lesson #24 covers its usage. You might want to use find to get to the right spot.

[edited by - Thunder_Hawk on June 18, 2003 6:43:31 PM]

Share this post


Link to post
Share on other sites
There are several ways to do a split screen

1. NeHe Lesson 42
2. Render both screens to different textures, then draw the textures on the screen.
3. Render one screen with one sissors on 1/2 of the screen, then render the other screen with the other 1/2 of the screen using glSissors
4. Give up


---
"you are the poet laureat (sp?) of programming. ALL HAIL!!!" -capn_midnight
A Link for programming drunks

Share this post


Link to post
Share on other sites
Hey, thanks a bunch. The scissor function was just what I needed, and it couldn''t be easier.

Share this post


Link to post
Share on other sites
quote:
Original post by dede
3. Render one screen with one sissors on 1/2 of the screen, then render the other screen with the other 1/2 of the screen using glSissors



Actually you could probably get away with only one because you''ll probably need to draw a background for each side.

Food for thought: The texture idea would probably be the slowest, but you could do some neat things with it (like cookie cutter shapes or rotating screens).



______________________________________________________________
The Phoenix shall arise from the ashes... ThunderHawk -- ¦þ
MySite
______________________________________________________________

Share this post


Link to post
Share on other sites
..and if you want non-rectangular areas, then you can use the stencil buffer to make irregularly shaped mask regions instead of the scissor test.

Scissor test works on pretty much everything and is fast though, so if that is good enough stick with that.

Share this post


Link to post
Share on other sites
or you MAY be able to specify a viewport for each side of the screnen you want to render to:

void glViewport (GLint x, GLint y, GLsizei width, GLsizei height);

the folowing persumes a resolution of 640 * 480


glViewport (0, 0, 320, 480);

//draw or left hand sided stuff

glViewport (320, 0, 320, 480);

//draw right hand sided stuff



you may need to set up your projection marix for each change of the viewport. if you want to split horizontally use the heght value to draw to the top half of the screen then shit to draw the bottom half.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!