DX9 Fullscreen

Started by
1 comment, last by langguy 20 years, 8 months ago
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#.
Advertisement
You must set the backbuffer size to the resolution you want.
____________________________________________________________AAAAA: American Association Against Adobe AcrobatYou know you hate PDFs...
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;}

This topic is closed to new replies.

Advertisement