Sign in to follow this  
species8472

Multiple Views in a game

Recommended Posts

Hello , I am trying to create a game with multiple views (eg 2 player , 4 player). As such , I need to have seperate instances of a module (game plugin) render to a quadrant of the entire screen. So far I figured that my options are 1. Use swap chains which would mean creating and managing X number of windows 2. Tell each module to render to a surface , then blit that surface onto the primary surface at a certain location. I was wondering if there are any other ways of doing this ? My 1st thought was viewports , but it seems that a device will only accept 1 viewport. Or am I wrong ?? Any thoughts or suggestions would be greatly appreciated. Regards . Species8472

Share this post


Link to post
Share on other sites
Quote:
Original post by species8472
I was wondering if there are any other ways of doing this ? My 1st thought was viewports , but it seems that a device will only accept 1 viewport. Or am I wrong ??

You are right. The device will only handle one viewport at a time. Nevertheless there's nothing stopping you from changing the viewport you render to:

for each player
setup viewport
set viewport to device
render scene
device.present

No need for multiple windows/swapchains in the scenario given above. Works perfectly.

Share this post


Link to post
Share on other sites
Hmmmm ... thats interesting ...

So ,
1. Set a viewport.
2. Module 1 render.

3. Set a viewport.
4. Module 2 render ?

And so on and so forth ?

Great !
Thanks alot brother ;)

Share this post


Link to post
Share on other sites
Exactly. The only thing is as soon as you start changing the viewport tyou have to make sure it's always correct. When you clear the screen for instance you have to set it to full-screen. Other than that I found it pleasantly easy.

Share this post


Link to post
Share on other sites
Hi

Why not trying this :
rendering every "viewport" in a texture
make 4 (if you have 4 views) quads that recover the full screen
Texture each quad with the rendered textures ?

Share this post


Link to post
Share on other sites
Wel . I have no problem with the above solution. Nor do I have a problem with ANY of the solutions , swap chains included.

It all depends on wot is the least time and resource consuming.
I suspect that a viewport per module would be least resource consuming ...

Share this post


Link to post
Share on other sites
Well,

It works ok, but if you try to overlap the windows, you'll find a problem. I use the swapchain and it worked fine for me, now I have an action cam in my game... although it runs really slow drawing everything twice... gotta find a way to optimize that.

Jeff

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this