Archived

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

2D Split Screen?

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

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 on other sites
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 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 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

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

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 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 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 stuffglViewport (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.

1. 1
2. 2
3. 3
Rutin
15
4. 4
khawk
14
5. 5
frob
12

• 9
• 11
• 11
• 23
• 12
• Forum Statistics

• Total Topics
633661
• Total Posts
3013227
×