Archived

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

DX9 Fullscreen

This topic is 5244 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 can''t seem to get fullscreen up and running for Direct3D in C#. Here is my code for initializing for windowed mode:
public Direct3DHandler(ref Device dev, Control RenderTarget, 
                   bool bWindowed, int nWidth, int nHeight,
                   int nColorDepth)
	{
        try
        {//try to initalize D3D

		PresentParameters pres = new PresentParameters();
		pres.Windowed = bWindowed;
		if(bWindowed)
			pres.SwapEffect = SwapEffect.Discard;
		else
		{
		       //do fullscreen stuff

		}

		pres.EnableAutoDepthStencil = true;
		pres.AutoDepthStencilFormat  = DepthFormat.D16;

		dev = new Device(0, DeviceType.Hardware, RenderTarget, CreateFlags.SoftwareVertexProcessing, pres);
	}
	catch(Exception e)
        {
                MessageBox.Show("Error initializing Direct3D: " + e.Message);
        }
}
What do I replace the "//do fullscreen stuff" with to make it full screen rather than windowed? Sorry if this has been answered before, but I can''t seem to find anything specific to C#.

Share this post


Link to post
Share on other sites
Thanks! That worked (after messing with the color depth a few times [not all of them work]).This is my modified code:


PresentParameters pres = new PresentParameters();
pres.Windowed = bWindowed;
if(bWindowed)
pres.SwapEffect = SwapEffect.Discard;
else
{
pres.SwapEffect = SwapEffect.Flip;
pres.BackBufferCount = 1;
pres.BackBufferWidth = nWidth;
pres.BackBufferHeight = nHeight;
pres.BackBufferFormat = Format.X8B8G8R8;
}

Share this post


Link to post
Share on other sites