Can somebody please tell me what is wrong with
Const COLORFORMAT=D3DFMT_R8G8B8
[edit]using marks code as example
It is the 24bit ColorFormat Mode but gives me a Unhandled Error. Any tips will be helpfull
Const COLORFORMAT=D3DFMT_R8G8B8
[edit]using marks code as example
Strict Const WIDTH=640 Const HEIGHT=480 Const COLORFORMAT=D3DFMT_R8G8B8 Const DEPTHFORMAT=D3DFMT_D24S8 Const HERTZ=60 Const WINDOWED=True Global d3d9:IDirect3D9 Global d3dDev9:IDirect3DDevice9 Global d3dPresentParams9:D3DPRESENT_PARAMETERS Function WndProc( hwnd,msg,wp,lp ) "win32" Select msg Case WM_PAINT If d3dDev9 Local render=False Select d3dDev9.TestCooperativeLevel() Case D3D_OK Print "Device OK" render=True Case D3DERR_DEVICELOST Print "Device Lost" Case D3DERR_DEVICENOTRESET Print "Device Not Reset" If d3dDev9.Reset( d3dPresentParams9 )<>D3D_OK Throw "Reset Device Failed" render=True End Select If render d3dDev9.BeginScene d3dDev9.Clear 0,Null,D3DCLEAR_TARGET,$ffffff00,0,0 d3dDev9.EndScene d3dDev9.Present Null,Null,Null,Null EndIf EndIf Case WM_DESTROY PostQuitMessage 0 End Select Return DefWindowProcA( hwnd,msg,wp,lp ) End Function d3d9=Direct3DCreate9( DIRECT3D_VERSION ) If Not d3d9 Throw "Failed to open Direct3D9" Local hinst=GetModuleHandleA(0) Local wc:WNDCLASS=New WNDCLASS wc.hInstance=hinst wc.lpfnWndProc=WndProc wc.hCursor=LoadCursorA( Null,Byte Ptr IDC_ARROW ) wc.lpszClassName="D3D9Max3DWndClass".ToCString() If Not RegisterClassA( wc ) Throw "Failed to register window class" Local hwnd=CreateWindowExA( 0,"D3D9Max3DWndClass".ToCString(),"My Window".ToCString(),WS_POPUP|WS_VISIBLE,0,0,width,height,0,0,hinst,Null ) If Not hwnd Throw "Failed to create window" d3dPresentParams9=New D3DPRESENT_PARAMETERS d3dPresentParams9.BackBufferWidth=WIDTH d3dPresentParams9.BackBufferHeight=HEIGHTd3dPresentParams9.BackBufferFormat=COLORFORMAT d3dPresentParams9.BackBufferCount=1 d3dPresentParams9.MultiSampleType=D3DMULTISAMPLE_NONE d3dPresentParams9.SwapEffect=D3DSWAPEFFECT_DISCARD d3dPresentParams9.hDeviceWindow=hwnd d3dPresentParams9.EnableAutoDepthStencil=True d3dPresentParams9.AutoDepthStencilFormat=DEPTHFORMAT d3dPresentParams9.PresentationInterval=1 If WINDOWED d3dPresentParams9.Windowed=True Else d3dPresentParams9.FullScreen_RefreshRateInHz=HERTZ EndIf If d3d9.CreateDevice( 0,D3DDEVTYPE_HAL,hwnd,D3DCREATE_PUREDEVICE|D3DCREATE_HARDWARE_VERTEXPROCESSING,d3dPresentParams9,d3dDev9 )<>D3D_OK Throw "Unable to create device" While WaitKey()<>KEY_ESCAPE Wend
It is the 24bit ColorFormat Mode but gives me a Unhandled Error. Any tips will be helpfull