public GameForm()
{
this.FormBorderstyle = FormBorderstyle.None;
this.WindowState = FormWindowState.Maximized;
}
public bool InitDirect3d()
{
PresentParameters presentParams = new PresentParameters();
presentParams.Windowed = true;
presentParams.SwapEffect = SwapEffect.Discard;
d3dDevice = new Device( 0, DeviceType.Hardware, this,
CreateFlags.SoftwareVertexProcessing, presentParams );
return true;
}
Fullscreen MDX
At the moment I'm only able to achieve fullscreen DirectX using C# via this method:
This probably isn't the best way to go about it...Seeing as I have presentParams.Windowed set to true. I've searched the MSDN and the SDK docs but haven't found anything on this. Am I doing it right, or is there a better way?
Hi there AdamWebb, How are you doing?
The Problem
Running MDX in fullscreen (creating a fullscreen window)
The Solution
You must remember that when you go fullscreen you will have to change a view present parameters.
These include
Windowed value to false.
Back buffer width, height.
and optionally your presentation interval.
Demo code
This is a simple example of how you would setup your fullscreen renderer. So you would pass the form/control to your renderer and if the device should be created in fullscreen or not.
I hope this helps.
Take care.
The Problem
Running MDX in fullscreen (creating a fullscreen window)
The Solution
You must remember that when you go fullscreen you will have to change a view present parameters.
These include
Windowed value to false.
Back buffer width, height.
and optionally your presentation interval.
Demo code
public void SetupPresentParams(bool fullscreen, Control control){ adapterInfo = Manager.Adapters[0]; //Helper class to gain access to information about the display adapter presentParams = new PresentParameters(); presentParams.BackBufferCount = 1; //Number of backbuffers to create presentParams.BackBufferFormat = adapterInfo.CurrentDisplayMode.Format; //The current format of the display device presentParams.BackBufferWidth = control.Width; presentParams.BackBufferHeight = control.Height; presentParams.SwapEffect = SwapEffect.Discard; //How the backbuffer and the current display will be swapped presentParams.AutoDepthStencilFormat = DepthFormat.D24S8; //24 bits for the depth and 8 bits for the stencil presentParams.EnableAutoDepthStencil = true; //Let direct3d handle the depth buffers for the application presentParams.Windowed = true; if(fullscreen) { presentParams.Windowed = false; //is the application windowed or fullscreen presentParams.BackBufferWidth = control.Width; presentParams.BackBufferHeight = control.Height; presentParams.PresentationInterval = PresentInterval.Immediate; }}
This is a simple example of how you would setup your fullscreen renderer. So you would pass the form/control to your renderer and if the device should be created in fullscreen or not.
I hope this helps.
Take care.
Change that:
presentParams.Windowed = true;
to
presentParams.Windowed = false;
That should put you into real full-screen mode, as opposed to rendering on a maximized window. Its not quite the same thing, as when you are in actual full-screen mode, you have more or less full unrestricted access to the video card that you don't have to share with other running programs.
You'll also want to fill in the rest of the presentParams with appropriate values for your application. What those all are, is in the sdk, just do a search for presentation parameters.
presentParams.Windowed = true;
to
presentParams.Windowed = false;
That should put you into real full-screen mode, as opposed to rendering on a maximized window. Its not quite the same thing, as when you are in actual full-screen mode, you have more or less full unrestricted access to the video card that you don't have to share with other running programs.
You'll also want to fill in the rest of the presentParams with appropriate values for your application. What those all are, is in the sdk, just do a search for presentation parameters.
The code given works for me in full screen only if i set the windowed=true if i set it false i get an error. hmm...why?
What Zmax says is true.
Whenever I use the source provided in the SDK, and modify the Windowed property to = false, the program encounters an error and exits?
Whenever I use the source provided in the SDK, and modify the Windowed property to = false, the program encounters an error and exits?
Quote:Original post by andor
Change that:
presentParams.Windowed = true;
to
presentParams.Windowed = false;
That should put you into real full-screen mode, as opposed to rendering on a maximized window. Its not quite the same thing, as when you are in actual full-screen mode, you have more or less full unrestricted access to the video card that you don't have to share with other running programs.
You'll also want to fill in the rest of the presentParams with appropriate values for your application. What those all are, is in the sdk, just do a search for presentation parameters.
This is absolutely correct doing this will set it to full screen on load .. also if you are using the sample framework you can create a shortcut of your .exe and add -fullscreen to the shortcut and it will render it in fullscreen as well :[]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement