Thanks for the quick reply. In an effort to find the problem as fast as possible I give you the code for how I create the D3D device. Perhaps you can see something that I cannot.
The problem with Win98 seems to be that the refresh rate isn''t initialized correctly. I always thought by specifying the refresh rate to 0, DX would choose a suitable one, but this seems to not be the case for Win98.
int scCGraphics::CreateFullscreenDevice(scHWND wnd, int w, int h, int bpp){ Log.Write(LOGTYPE_DEBUG, "gfx.CreateFullscreenDevice(%d, %d, %d)\n", w, h, bpp); if( d3d8 == 0 ) return -1; ReleaseDevice(); HRESULT hr; // Check the capabilities of this adapter if( CheckCapabilities(adapter) < 0 ) return -1; D3DFORMAT format; if( bpp == 16 ) { // Choose the best pixel format for the backbuffer D3DFORMAT formats[] = {D3DFMT_R5G6B5, D3DFMT_X1R5G5B5}; int numFormats = sizeof(formats)/sizeof(D3DFORMAT); for( int n = 0; n < numFormats; n++ ) if( SUCCEEDED(d3d8->CheckDeviceType(adapter, D3DDEVTYPE_HAL, formats[n], formats[n], FALSE)) ) { format = formats[n]; break; } if( n == numFormats ) { Log.Write(LOGTYPE_DEBUG, "gfx.Couldn''t find suitable pixel format for back buffer\n"); return -1; } } else if( bpp == 24 ) { // Choose the best pixel format for the backbuffer D3DFORMAT formats[] = {D3DFMT_R8G8B8, D3DFMT_X8R8G8B8}; int numFormats = sizeof(formats)/sizeof(D3DFORMAT); for( int n = 0; n < numFormats; n++ ) if( SUCCEEDED(d3d8->CheckDeviceType(adapter, D3DDEVTYPE_HAL, formats[n], formats[n], FALSE)) ) { format = formats[n]; break; } if( n == numFormats ) { Log.Write(LOGTYPE_ERROR, "gfx.Couldn''t find suitable pixel format for back buffer\n"); return -1; } } Log.Write(LOGTYPE_DEBUG, "gfx.Back buffer pixel format: %s\n", IdentifyFormat(format)); // Choose the best depth stencil format available D3DFORMAT depthFormat; D3DFORMAT depthFormats[] = {D3DFMT_D32, D3DFMT_D24X8, D3DFMT_D16}; int numFormats = sizeof(depthFormats)/sizeof(D3DFORMAT); for( int n = 0; n < numFormats; n++ ) if( SUCCEEDED(d3d8->CheckDepthStencilMatch(adapter, D3DDEVTYPE_HAL, format, format, depthFormats[n])) ) { depthFormat = depthFormats[n]; break; } if( n == numFormats ) { Log.Write(LOGTYPE_ERROR, "gfx.Couldn''t find suitable format for depth buffer\n"); return -1; } Log.Write(LOGTYPE_DEBUG, "gfx.Depth buffer pixel format: %s\n", IdentifyFormat(depthFormat)); // Setup the presentation parameters ZeroMemory( &pparam, sizeof(pparam) ); pparam.BackBufferWidth = w; pparam.BackBufferHeight = h; pparam.BackBufferFormat = format; pparam.BackBufferCount = 1; pparam.MultiSampleType = D3DMULTISAMPLE_NONE; pparam.SwapEffect = D3DSWAPEFFECT_DISCARD; pparam.hDeviceWindow = (HWND)wnd; pparam.Windowed = FALSE; pparam.EnableAutoDepthStencil = TRUE; pparam.AutoDepthStencilFormat = depthFormat; pparam.Flags = D3DPRESENTFLAG_LOCKABLE_BACKBUFFER; // TODO: Make optional as it may incurr a performance penalty on some cards pparam.FullScreen_RefreshRateInHz = 0; pparam.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT; // Try with hardware vertex processing first hr = d3d8->CreateDevice(adapter, D3DDEVTYPE_HAL, (HWND)wnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &pparam, &device); if( FAILED(hr) ) { Log.Write(LOGTYPE_DEBUG, "gfx.Failed to create device with hardware vertex processing, trying software (%X)\n", hr); // Try again with software vertex processing hr = d3d8->CreateDevice(adapter, D3DDEVTYPE_HAL, (HWND)wnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &pparam, &device); if( FAILED(hr) ) { Log.Write(LOGTYPE_ERROR, "gfx.Failed to create device with software vertex processing (%X)\n", hr); return -1; } } return InitializeDevice();}
int scCGraphics::CreateWindowedDevice(scHWND wnd, int w, int h){ Log.Write(LOGTYPE_DEBUG, "gfx.CreateWindowedDevice(%d, %d)\n", w, h); if( d3d8 == 0 ) return -1; ReleaseDevice(); HRESULT hr; // Check the capabilities of this adapter if( CheckCapabilities(adapter) < 0 ) return -1; // Can it render in windowed mode? D3DCAPS8 caps; hr = d3d8->GetDeviceCaps(adapter, D3DDEVTYPE_HAL, ∩︀); if( FAILED(hr) ) return -1; if( caps.Caps2 & D3DCAPS2_CANRENDERWINDOWED == 0 ) { Log.Write(LOGTYPE_ERROR, "gfx.Device can''t render in windowed mode\n"); return -1; } // Check if the desktop display format is acceptable if( !(displayMode.Format == D3DFMT_R8G8B8 || displayMode.Format == D3DFMT_X8R8G8B8 || displayMode.Format == D3DFMT_R5G6B5 || displayMode.Format == D3DFMT_X1R5G5B5) ) { Log.Write(LOGTYPE_DEBUG, "gfx.Desktop mode isn''t supported\n"); return -1; } // Choose the best pixel format for the backbuffer D3DFORMAT format ; D3DFORMAT formats[] = {D3DFMT_R8G8B8, D3DFMT_X8R8G8B8, D3DFMT_R5G6B5, D3DFMT_X1R5G5B5}; int numFormats = sizeof(formats)/sizeof(D3DFORMAT); for( int n = 0; n < numFormats; n++ ) if( SUCCEEDED(d3d8->CheckDeviceType(adapter, D3DDEVTYPE_HAL, displayMode.Format, formats[n], TRUE)) ) { format = formats[n]; break; } if( n == numFormats ) { Log.Write(LOGTYPE_DEBUG, "gfx.Couldn''t find suitable pixel format for backbuffer\n"); return -1; } Log.Write(LOGTYPE_DEBUG, "gfx.Back buffer pixel format: %s\n", IdentifyFormat(format)); // Choose the best depth stencil format available D3DFORMAT depthFormat; D3DFORMAT depthFormats[] = {D3DFMT_D32, D3DFMT_D24X8, D3DFMT_D16}; numFormats = sizeof(depthFormats)/sizeof(D3DFORMAT); for( n = 0; n < numFormats; n++ ) if( SUCCEEDED(d3d8->CheckDepthStencilMatch(adapter, D3DDEVTYPE_HAL, displayMode.Format, format, depthFormats[n])) ) { depthFormat = depthFormats[n]; break; } if( n == numFormats ) { Log.Write(LOGTYPE_DEBUG, "gfx.Couldn''t find suitable depth buffer format\n"); return -1; } Log.Write(LOGTYPE_DEBUG, "gfx.Depth buffer pixel format: %s\n", IdentifyFormat(depthFormat)); // Setup the presentation parameters ZeroMemory( &pparam, sizeof(pparam) ); pparam.BackBufferWidth = w; pparam.BackBufferHeight = h; pparam.BackBufferFormat = format; pparam.BackBufferCount = 1; pparam.MultiSampleType = D3DMULTISAMPLE_NONE; pparam.SwapEffect = D3DSWAPEFFECT_DISCARD; pparam.hDeviceWindow = (HWND)wnd; pparam.Windowed = TRUE; pparam.EnableAutoDepthStencil = TRUE; pparam.AutoDepthStencilFormat = depthFormat; pparam.Flags = D3DPRESENTFLAG_LOCKABLE_BACKBUFFER; // TODO: Make optional as it may incurr a performance penalty on some cards pparam.FullScreen_RefreshRateInHz = 0; pparam.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT; // Try with hardware vertex processing first hr = d3d8->CreateDevice(adapter, D3DDEVTYPE_HAL, (HWND)wnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &pparam, &device); if( FAILED(hr) ) { Log.Write(LOGTYPE_DEBUG, "gfx.Failed to create device with hardware vertex processing, trying software (%X)\n", hr); // Try again with software vertex processing hr = d3d8->CreateDevice(adapter, D3DDEVTYPE_HAL, (HWND)wnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &pparam, &device); if( FAILED(hr) ) { Log.Write(LOGTYPE_ERROR, "gfx.Failed to create device with software vertex processing (%X)\n", hr); return -1; } } return InitializeDevice();}
__________________________________________________________
www.AngelCode.com - game development and more...
AngelScript - free scripting library