Jump to content
  • Advertisement
Sign in to follow this  
NovaCaine

Getting DirectX to Go Fullscreen In Horizontal Span [FIXED]

This topic is 4818 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

Hey all, I have this idea for an app that requires me to get DirectX to go fullscreen in horizontal span but also have 2 separate screen buffers that i can write to( so each screen has separate displays). But i have no idea where to start. Was wondering if anyone knew of any good articles or books i could read on this subject. [Edited by - NovaCaine on September 7, 2005 5:19:59 PM]

Share this post


Link to post
Share on other sites
Advertisement
You could use SetViewport method of the device to clip rendering to each screen separately, while still using one physical backbuffer.

Share this post


Link to post
Share on other sites
cool, but just so i know what im doing id go something like


// First "Screen"
D3DVIEWPORT9 vp;
vp.X = 0;
vp.Y = 0;
vp.Width = ScreenRes1.Width;
vp.Height = ScreenRes1.Height;
vp.MinZ = NearPlane;
vp.MaxZ = FarPlane;

// Set Veiwport
SetViewport (vp)

// Render stuff on first "Screen"

// Second "Screen"
D3DVIEWPORT9 vp;
vp.X = ScreenRes1.Width;
vp.Y = 0;
vp.Width = ScreenRes2.Width;
vp.Height = ScreenRes2.Height;
vp.MinZ = NearPlane;
vp.MaxZ = FarPlane;

// Set Veiwport
SetViewport (vp)

// Render stuff on second "Screen"


Share this post


Link to post
Share on other sites
YAY :D:D:D

It worked, only thing i had to change was setting the veiwport back to the full backbuffer size to clear it, and add my D3D device pointer in front of the SetVeiwport call.

finished render call looks something like this


// Clear the screen to black (You can change what color it changes to in D3DCOLOR_XRGB).
// Set viewport to whole screen to clear it
D3DVIEWPORT9 vp;
vp.X = 0;
vp.Y = 0;
vp.Width = 1280;
vp.Height = 640;
vp.MinZ = 0.0f;
vp.MaxZ = 1.0f;

m_D3DDevice->SetViewport( &vp );

m_D3DDevice->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,
D3DCOLOR_XRGB(255,255,255), 1.0f, 0);

// Tell Direct 3D we are now going to start drawing.
m_D3DDevice->BeginScene();

SetupMatrices();

// Setup Viewport( "Screen" )
vp.X = 0;
vp.Y = 0;
vp.Width = m_iWidth;

m_D3DDevice->SetViewport( &vp );

m_Tiger.RenderModel( m_D3DDevice );

// Shift vp to "Second screen"
vp.X = 640;

m_D3DDevice->SetViewport( &vp );

m_Tiger.RenderModel( m_D3DDevice );


// We are done drawing for this scene.
m_D3DDevice->EndScene();

// Swap the old frame with the new one.
m_D3DDevice->Present(NULL, NULL, NULL, NULL);

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!