Jump to content
  • Advertisement
Sign in to follow this  
Daniel Miller

About to explode.

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

Where can I find some information on full-screen development using Managed DirectX? Unless I am missing something, the MSDN docs are of little (to no) help. I searched in the FAQ of this forum, and found one link for Managed DirectX, but it uses windowed mode. Should I be looking at the unmanaged docs instead? The lack of information for Managed DX is frustrating.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Daniel Miller
Where can I find some information on full-screen development using Managed DirectX?

What sort of information are you looking for? The actual graphical effects and features should be pretty much the same for windowed/fullscreen, it's just the initialisation stage that differs.

If it's a code issue, have you checked what the SDK samples do? they're usually a good reference.

Quote:
Original post by Daniel Miller
The lack of information for Managed DX is frustrating.

Let Microsoft know [smile] - They always seem to be fairly open to constructive critiscm. If you can explain to them what you're trying to find, the fact you tried X-Y-Z to find it, and how/where you'd like to find the information. You never know - they might well take your thoughts into consideration...[attention]

Sorry I can't be of more help
Jack

Share this post


Link to post
Share on other sites
Quote:
Original post by jollyjeffers
... just the initialisation stage that differs ...


Yep, that is it.

I keep getting D3DERR_INVALIDVALL when creating a device. I check the display formats beforehand, so I think it has to do with some presentation parameters that I am omitting. However, nowhere in the docs are those explained in any detail. Will a browse throught the unmanaged docs help, or is the information exclusive to each?

edit: Yes, I just may send them some feedback, though I'm sure the reason they don't have what I'm looking for is becuase of the amazing amount of work it would take, not because they think no one wants it.


edit2: I know there is a PresentParamters page on MSDN, but it really doesn't explain what you need and when/why you need it.

Share this post


Link to post
Share on other sites
Well if you can't find the necessary documentation, I'd hit the sample code.

Load up one (or more) of the basic samples and see how they do their windowed-mode code, given that it was written by the guys at Microsoft you'd hope they got it right [grin]

Jack

Share this post


Link to post
Share on other sites
I personally would first check out the unmanaged docs, since the information there is describing essentially the same thing. Constants and types will have slightly different names, but it's pretty easy to translate most things from the unmanaged to the managed.

If that doesn't help, then I'd try to see some sample code, whether written by Microsoft, or found elsewhere online. See what they did to successfully create a fullscreen window.

If that fails, post some of your code here. Plenty of us have made many of the same mistakes far too many times, and might spot something rather quickly.

Share this post


Link to post
Share on other sites
I have looked through them, but windowed code doesn't share that much in terms of initialization with fullscreen (or so it seems to me; I don't know anything though [grin]).

No matter what I try, I get an error on initialization. I checked to see if the formats I use are supported. They are. I have tried using settings so low that any computer should be able to run it (software everything, 640x480, etc.) and it still won't work. There are also things that I don't understand: when checking to see if a format is supported, you provide both front and back buffer formats, but I don't see where you set the front buffer format when creating the device.

If someone has some simple sample code, or a link to a good tutorial, that would be fantastic. I have searched MSDN, this site, and Google, and everything I have found skims over fullscreen initialization.

Share this post


Link to post
Share on other sites
I haven't done much in C# yet, but here's a wee bit of code I pulled out of a test program of mine. Maybe something in here will help.
if (Windowed)
{
PresentParameters PParams = new PresentParameters();
PParams.EnableAutoDepthStencil = true;
PParams.AutoDepthStencilFormat = DepthFormat.D16;
PParams.DeviceWindow = this;
PParams.MultiSample = MultiSampleType.None;
PParams.MultiSampleQuality = 0;
PParams.PresentFlag = PresentFlag.None;
PParams.BackBufferCount = 1;
PParams.BackBufferWidth = BackbufferWidth;
PParams.BackBufferHeight = BackbufferHeight;
PParams.Windowed = true;
PParams.BackBufferFormat = Format.Unknown;
PParams.FullScreenRefreshRateInHz = 0;
PParams.PresentationInterval = PresentInterval.Immediate;
PParams.SwapEffect = SwapEffect.Copy;

mDevice = new Device(0, DeviceType.Hardware, this, CreateFlags.HardwareVertexProcessing, PParams);
}
else
{
if (Heads == 1)
{
PresentParameters PParams = new PresentParameters();
PParams.EnableAutoDepthStencil = true;
PParams.AutoDepthStencilFormat = DepthFormat.D16;
PParams.DeviceWindow = this;
PParams.MultiSample = MultiSampleType.None;
PParams.MultiSampleQuality = 0;
PParams.PresentFlag = PresentFlag.None;
PParams.BackBufferCount = 1;
PParams.BackBufferWidth = BackbufferWidth;
PParams.BackBufferHeight = BackbufferHeight;
PParams.Windowed = false;
PParams.BackBufferFormat = BackbufferFormat;
PParams.FullScreenRefreshRateInHz = RefreshRate;
PParams.PresentationInterval = PresentInterval.One;
PParams.SwapEffect = SwapEffect.Discard;

mDevice = new Device(0, DeviceType.Hardware, this, CreateFlags.HardwareVertexProcessing, PParams);
}
else
{
PresentParameters[] PParamArray = new PresentParameters[Heads];
mForms = new Form[Heads];

for (int i = 0; i < Heads; ++i)
{
PParamArray = new PresentParameters();
mForms = new Form();
mForms.Visible = true;
PParamArray.EnableAutoDepthStencil = true;
PParamArray.AutoDepthStencilFormat = DepthFormat.D16;
PParamArray.DeviceWindow = mForms;
PParamArray.MultiSample = MultiSampleType.None;
PParamArray.MultiSampleQuality = 0;
PParamArray.PresentFlag = PresentFlag.None;
PParamArray.BackBufferCount = 1;
PParamArray.BackBufferWidth = BackbufferWidth;
PParamArray.BackBufferHeight = BackbufferHeight;
PParamArray.Windowed = false;
PParamArray.BackBufferFormat = BackbufferFormat;
PParamArray.FullScreenRefreshRateInHz = RefreshRate;
PParamArray.PresentationInterval = PresentInterval.One;
PParamArray.SwapEffect = SwapEffect.Discard;
}

mDevice = new Device(0, DeviceType.Hardware, this, CreateFlags.HardwareVertexProcessing | CreateFlags.AdapterGroupDevice, PParamArray);
}
}

Share this post


Link to post
Share on other sites
EDIT: Agony's too quick! [smile]

This is native DX, so not quite what you want - but for reference purposes this is what my engine uses to toggle between fullscreen and windowed. It's all done before the CreateDevice() call:

Common initialisation code used whatever mode:
ZeroMemory( &pp, sizeof( pp ) );		
pp.Windowed = bWindowed;
pp.AutoDepthStencilFormat = D3DFMT_D16;
pp.EnableAutoDepthStencil = true;
pp.SwapEffect = D3DSWAPEFFECT_DISCARD;
pp.BackBufferCount = bTripleBuffer ? 2 : 1;
pp.PresentationInterval = bVSync ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE;



Branch executed if using windowed mode:
pD3D9->GetAdapterDisplayMode( D3DADAPTER_DEFAULT, &CurrMode );
pp.BackBufferFormat = CurrMode.Format;
pp.BackBufferWidth = iScreenWidth;
pp.BackBufferHeight = iScreenHeight;



Branch executed if using fullscreen mode:
pp.BackBufferWidth = iScreenWidth;
pp.BackBufferHeight = iScreenHeight;
switch ( iScreenDepth ) {
case 32:
pp.BackBufferFormat = D3DFMT_X8R8G8B8;
break;

case 24:
pp.BackBufferFormat = D3DFMT_R8G8B8;
break;

case 16:
pp.BackBufferFormat = D3DFMT_R5G6B5;
break;

default:
pp.BackBufferFormat = CurrMode.Format;
break;
}



hth
Jack

Share this post


Link to post
Share on other sites
Thanks very much to both of you!

I''l look over them both and with all of this I'll surely get my program to stop throwing up. That was exactly what I was looking for. [smile]

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!