Код (Text): ; Name: dx9_initialization.cpp ; Author: Kevin Harris (kevin@codesampler.com) ; Last Modified: 03/03/04 ; Description: This sample demonstrates how to initialize Direct3D format PE GUI 4.0 entry WinMain include '%fasminc%\win32a.inc' include '%fasminc%\equates\kernel32.inc' include '%fasminc%\equates\gdi32.inc' include '%fasminc%\equates\user32.inc' include '%fasminc%\equates\winmm.inc' include '%fasminc%\equates\directx\d3d9.inc' include '%fasminc%\equates\directx\d3dx9.inc' IDI_DIRECTX_ICON = 107 section '.data' data readable writeable WindowClass db "Direct3D9",0 WindowTitle db "Direct3D9 Initialization",0 align 4 hWnd dd 0 hinstance dd 0 dwBehaviorFlags dd 0 D3D IDirect3D9 D3DDevice IDirect3DDevice9 d3ddm D3DDISPLAYMODE d3dCaps D3DCAPS9 d3dpp D3DPRESENTPARAMETERS section '.code' code readable executable ;Name: WinMain() -> The application's entry point proc WinMain hInstance, hPrevInstance, lpCmdLine, nCmdShow local msg:MSG, winClass:WNDCLASSEXA cinvoke memset, addr winClass, 0, sizeof.WNDCLASSEXA invoke GetModuleHandle, 0 mov [hinstance], eax mov [winClass.hInstance], eax mov [winClass.lpszClassName], WindowClass mov [winClass.cbSize], sizeof.WNDCLASSEXA mov [winClass.style], CS_HREDRAW or CS_VREDRAW mov [winClass.lpfnWndProc], WindowProc invoke LoadIcon, [hinstance], IDI_DIRECTX_ICON mov [winClass.hIcon], eax mov [winClass.hIconSm], eax invoke LoadCursor, NULL, IDC_ARROW mov [winClass.hCursor], eax mov [winClass.hbrBackground], NULL mov [winClass.lpszMenuName], NULL mov [winClass.cbClsExtra], 0 mov [winClass.cbWndExtra], 0 ;Register our window class. invoke RegisterClassEx, addr winClass .if eax = NULL invoke MessageBox, HWND_DESKTOP, "RegisterClassEx() failed. Exiting Program",\ WindowClass, 0 invoke ExitProcess, 0 return .endif ;Create window for Direct3D FullScreen mode. invoke CreateWindowEx, NULL, WindowClass, WindowTitle, WS_OVERLAPPEDWINDOW or WS_VISIBLE,\ 0, 0, 640, 480, NULL, NULL, [hinstance], NULL .if eax = NULL invoke MessageBox, HWND_DESKTOP, "CreateWindowEx() failed. Exiting Program",\ WindowClass, 0 invoke ExitProcess, 0 return .endif mov [hWnd], eax call D3DInit mov [msg.message], TRUE .while [msg.message] <> WM_QUIT call D3DRender invoke PeekMessage, addr msg, NULL, 0, 0, PM_REMOVE .if eax <> NULL invoke TranslateMessage, addr msg invoke DispatchMessage, addr msg .endif .endw call D3DShutDown invoke ExitProcess, 0 return endp proc WindowProc hWnd, msg, wParam, lParam .if [msg] = WM_KEYDOWN .if [wParam] = VK_ESCAPE invoke PostQuitMessage, 0 .endif return 0 .elseif [msg] = WM_DESTROY invoke PostQuitMessage, 0 return 0 .endif ;DefWindowProc process all other messages that we don't want invoke DefWindowProc, [hWnd], [msg], [wParam], [lParam] return endp proc D3DInit invoke Direct3DCreate9, D3D_SDK_VERSION .if eax = NULL invoke MessageBox, HWND_DESKTOP, <"Direct3DCreate9() failed.",10,13,\ "Exiting Program">, WindowClass, MB_OK invoke PostQuitMessage, 0 return .endif mov [D3D], eax D3DCALL D3D, GetAdapterDisplayMode, D3DADAPTER_DEFAULT, d3ddm .if eax <> D3D_OK invoke MessageBox, HWND_DESKTOP, <"D3D -> GetAdapterDisplayMode() failed.",10,13,\ "Exiting Program">, WindowClass, MB_OK invoke PostQuitMessage, 0 return .endif D3DCALL D3D, CheckDeviceFormat, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, [d3ddm.Format],\ D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, D3DFMT_D16 .if eax <> D3D_OK invoke MessageBox, HWND_DESKTOP, <"D3D -> CheckDeviceFormat() failed.",10,13,\ "Requires at least a 16-bit Depth Stencel",10,13,\ "Exiting Program">, WindowClass, MB_OK invoke PostQuitMessage, 0 return .endif D3DCALL D3D, GetDeviceCaps, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, d3dCaps .if eax <> D3D_OK invoke MessageBox, HWND_DESKTOP, <"D3D -> GetDeviceCaps() failed.",10,13,\ "Exiting Program">, WindowClass, MB_OK invoke PostQuitMessage, 0 return .endif .if [d3dCaps.VertexProcessingCaps] <> 0 mov [dwBehaviorFlags], D3DCREATE_HARDWARE_VERTEXPROCESSING .else mov [dwBehaviorFlags], D3DCREATE_SOFTWARE_VERTEXPROCESSING .endif cinvoke memset, d3dpp, 0, sizeof.D3DPRESENTPARAMETERS mov eax, [d3ddm.Format] mov [d3dpp.BackBufferFormat], eax mov [d3dpp.SwapEffect], D3DSWAPEFFECT_DISCARD mov [d3dpp.Windowed], TRUE mov [d3dpp.EnableAutoDepthStencil], TRUE mov [d3dpp.AutoDepthStencilFormat], D3DFMT_D16 mov [d3dpp.Presentation_Interval], D3DPRESENT_INTERVAL_IMMEDIATE D3DCALL D3D, CreateDevice, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, [hWnd], [dwBehaviorFlags],\ d3dpp, D3DDevice .if eax <> D3D_OK invoke MessageBox, HWND_DESKTOP, <"D3D -> CreateDevice() failed.",10,13,\ "Exiting Program">, WindowClass, MB_OK invoke PostQuitMessage, 0 return .endif return endp proc D3DRender D3DCALL D3DDevice, Clear, 0, NULL, D3DCLEAR_TARGET or D3DCLEAR_ZBUFFER, $ff00ff00, 1.0, 0 D3DCALL D3DDevice, BeginScene ;Render geometry here... D3DCALL D3DDevice, EndScene D3DCALL D3DDevice, Present, NULL, NULL, NULL, NULL return endp proc D3DShutDown .if [D3DDevice] <> NULL D3DCALL D3DDevice, Release .endif .if [D3D] <> NULL D3DCALL D3D, Release .endif return endp section '.rsrc' resource data readable directory RT_MANIFEST, manifest, RT_ICON, icons, RT_GROUP_ICON, group_icons resource manifest, 1, LANG_NEUTRAL, winxp resource icons, 1, LANG_NEUTRAL, icon_data resource group_icons, IDI_DIRECTX_ICON, LANG_NEUTRAL, main_icon icon main_icon, icon_data, 'codesampler.ico' resdata winxp file '%fasminc%\winxpstyle.xml' endres section '.idata' import data readable writeable library kernel32,'KERNEL32.DLL',\ user32,'USER32.DLL',\ gdi32,'GDI32.DLL',\ winmm,'WINMM.DLL',\ crtdll, 'CRTDLL.DLL',\ d3d9,'D3D9.DLL',\ d3dx9_24,'D3DX9_24.DLL' include '%fasminc%/apia/kernel32.inc' include '%fasminc%/apia/user32.inc' include '%fasminc%/apia/gdi32.inc' include '%fasminc%/apia/winmm.inc' include '%fasminc%/apia/crtdll.inc' include '%fasminc%/apia/directx/d3d9.inc' include '%fasminc%/apia/directx/d3dx9_24.inc' Хотел поразбираться с примерчиками, мне вообще косвенно необходима данная инфа, но всетаки. ПРоблемма в том что все примеры из этой серии ложаться на (всмысле выводить данный бокс )) Код (Text): invoke MessageBox, HWND_DESKTOP, <"D3D -> CheckDeviceFormat() failed.",10,13,\ "Requires at least a 16-bit Depth Stencel",10,13,\ "Exiting Program">, WindowClass, MB_OK хотелось бы перед началам разбора, понять в чем проблемма и как ее решить