Fullscreen app with DX 8.1

Started by
5 comments, last by Shooter 21 years, 6 months ago
Hi folks, I am currently working on a 3D game which uses DirectX 8.1. I wanted to use fullscreen mode, so I tried to set the "windowed" param of the present parameters structure to "FALSE". Unfortunately, it does not work: DirectX tells me that the mode is not supported and that "CreateDevice" failed. Any suggestions what could solve the problem? I don''''t need any signature ;-)
I don''t need any signature ;-)
Advertisement
If you could post your code, it would be more helpful.

It''s probably not your windowed parameter that is screwing up, but something else (ie, setting the display mode to 254515x215151).

¬_¬
Try to set the format to D3DFMT_R5G6B5. That will work on most cards. Otherwise you would have to enumerate modes and pick an appropriate one.
No, that format does not work, too. And everything works fine when using windowed mode.

WIDTH=GetSystemMetrics(SM_CXSCREEN);
HEIGHT=GetSystemMetrics(SM_CYSCREEN);

WNDCLASS WndClass;

WndClass.nostyle=CS_HREDRAW | CS_VREDRAW;
WndClass.cbClsExtra=0;
WndClass.cbWndExtra=sizeof(DWORD);
WndClass.lpfnWndProc=(WNDPROC)WndProc;
WndClass.hInstance=hInstance;
WndClass.hbrBackground=(HBRUSH)GetStockObject(BLACK_BRUSH);
WndClass.hCursor=LoadCursor(NULL,IDC_ARROW);
WndClass.hIcon=NULL;
WndClass.lpszMenuName=NULL;
WndClass.lpszClassName="Voxel3DWndClass";

//Register class
if(RegisterClass(&WndClass)==NULL) return 1;

//Create window
hWnd=CreateWindowEx(0,"Voxel3DWndClass",APP_TITLEVERSION, WS_POPUP,0,0,WIDTH,HEIGHT,NULL,NULL,hInstance,NULL);
if(hWnd == NULL) return 1;

//...
//message loop etc.
//...

//Create D3D Object
lpD3D=Direct3DCreate8(D3D_SDK_VERSION);

//Determine display mode
D3DDISPLAYMODE d3ddm;
lpD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &d3ddm);

//Init params
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory( &d3dpp, sizeof(d3dpp));
d3dpp.Windowed = FALSE;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferCount = 1;

//Create device ### ERROR OCCURS HERE WHEN CALLING CREATEDEVICE ###
d3dpp.BackBufferFormat=D3DFMT_A8R8G8B8;
CreateDevice(D3DDEVTYPE_HAL,&d3dpp);


I don''''t need any signature ;-)
I don''t need any signature ;-)
add this...

d3dpp.BackBufferWidth = 800;
d3dpp.BackBufferHeight = 600;

that should fix it, the problem probably is that you are setting the back buffer dimentions to an invalid setting.
--m_nPostCount++
Yes, it works now! Thanks! The problem was that I did not set the back buffer height and width. But why did it work in windowed mode then?

I don''''t need any signature ;-)
I don''t need any signature ;-)
quote:Original post by Shooter
Yes, it works now! Thanks! The problem was that I did not set the back buffer height and width. But why did it work in windowed mode then?

I don''t need any signature ;-)


Because you don''t need to set those parameters for windowed mode.



[Piebert Entertainment] [Ask The All-Knowing Oracle A Question]------------------------------------------------------------GDSFUBY GameDev Society For UnBanning YodaTheCodaIf you want to see yoda unbanned then put this in your sig ------------------------------------------------------------DAIAGA Dave Astle is a God Association. To join, put this in your sig!Founder and High Priest of DAIAGA[edited by - YodaTheCoda on December 10, 2003 1:57:54 PM]

This topic is closed to new replies.

Advertisement