Jump to content
  • Advertisement
Sign in to follow this  
deadimp

ID3DDevice9 - Error when trying to create in Full Screen (SOLVED)

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

This is a particular topic I have been hassling with since I first switched over to Direct3D. I am not sure about the exact reason why I am getting an invalid call error because I have looked on the MSDN about the function, yet I can't find an explanation as to why my code won't work... I am trying to create a device in fullscreen mode, but I keep on getting D3DERR_INVALIDCALL. It all works find when it is windowed (bool isWindowed=true), but never when I try to make it fullscreen. Please note that this in the initializing part of my program. Here's the basic layout:
//Objects:
LPDIRECT3D9 lpD3D;
LPDIRECT
//Code:
 //Get the current desktop display mode
 D3DDISPLAYMODE d3ddm;
 HRESULT hRes;
 hRes=lpD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT,&d3ddm);
 //Note that the Direct3D9 object has already been created
 D3DPRESENT_PARAMETERS d3dpp; 
 ZeroMemory( &d3dpp, sizeof(d3dpp) );
 d3dpp.Windowed = isWindowed;
 d3dpp.hDeviceWindow=hwnd;
 d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
 d3dpp.BackBufferFormat = d3ddm.Format;
 d3dpp.BackBufferCount=1;
 if (!isWindowed) {
  //Fullscreen: (aren't these the proper changes?)
  d3dpp.FullScreen_RefreshRateInHz=D3DPRESENT_RATE_DEFAULT; //d3ddm.RefreshRate;
  d3dpp.PresentationInterval=D3DPRESENT_INTERVAL_ONE;
  d3dpp.BackBufferWidth=DGI_WIDTH;
  d3dpp.BackBufferHeight=DGI_HEIGHT;
  d3dpp.BackBufferFormat=D3DFMT_R8G8B8;
  d3dpp.BackBufferCount=2;
  d3dpp.SwapEffect=D3DSWAPEFFECT_FLIP;
 }
 hRes=lpD3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hwnd,D3DCREATE_SOFTWARE_VERTEXPROCESSING,&d3dpp,&lpD3DDevice);



I have looked at other source code, but I can't find any differences that really 'pop out' at me. SIDE NOTE: It doesn't work when the width and height is 400x300 or 640x480 either. [Edited by - deadimp on July 21, 2005 2:15:43 PM]

Share this post


Link to post
Share on other sites
Advertisement
I'm no Direct3D guru by any means, but are you setting the depth buffer to any specific value? Try...


d3dParameters->EnableAutoDepthStencil = TRUE;
d3dParameters->AutoDepthStencilFormat=D3DFMT_D24X8;



Also, try setting your BackBuffer depth to D3DFMT_X8R8G8B8, as I know when I tried to go fullscreen my card/drivers didn't support 24 bit, only 32 bit.

Share this post


Link to post
Share on other sites
Are you tring to do triple buffering? Try setting the BackBufferCount to 0 or 1 (do the same thing - make a single back buffer) and see if that works. Your card might not be able to do triple buffering.

Share this post


Link to post
Share on other sites
I started out only using 1 back buffer, but then I saw antoher tutorial online that had two (which worked), so I tried that one. I'll try these changes out.
On a side note, I think skyfire360 was right about the depth format, becuase I remembered trying to go 24 bit in DirectDraw and it wouldn't let me (D'oh). I can't compile it right now because I have some erroneus code that I need to debug.
I'll post if it works or not.

Share this post


Link to post
Share on other sites
It works! It actually works!
Thanks y'all. The only problem I'm having now is there is a little tearing at the bottom of the screen.

EDIT: Fixed the tearing. Simply eliminted the D3DSWAPEFFECT_FLIP in the full screen conditional. Thanks again.

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!