Fullscreen app with DX 8.1
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 ;-)
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).
¬_¬
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 ;-)
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 ;-)
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.
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement