Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
Werbeanzeige
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
IDirect3DDevice9 * pd3ddevice = NULL; bool Init(HWND hWnd) { IDirect3D9 * pd3d = Direct3DCreate9(D3D_SDK_VERSION); pd3d->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &pMode); Parameters.hDeviceWindow = hWnd; Parameters.Windowed = true; Parameters.SwapEffect = D3DSWAPEFFECT_DISCARD; Parameters.BackBufferCount = 2; Parameters.BackBufferFormat = pMode.Format; Parameters.BackBufferHeight = pMode.Height; Parameters.BackBufferWidth = pMode.Width; Parameters.EnableAutoDepthStencil = TRUE; Parameters.AutoDepthStencilFormat = D3DFMT_D16; Parameters.Flags = D3DPRESENTFLAG_DISCARD_DEPTHSTENCIL; Parameters.MultiSampleType = D3DMULTISAMPLE_NONE; HRESULT hr = pd3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, NULL, D3DCREATE_HARDWARE_VERTEXPROCESSING, &Parameters, &pd3ddevice); if (hr != D3D_OK) { MessageBox(hWnd, "DirectX konnte nicht erfolgreich initialisiert werden!\nErstellung der Geräteschnittstelle ist fehlgeschlagen: CreateDevice()!", "Fehler!", MB_ICONERROR | MB_OK); SAFE_RELEASE(pd3d); return false; } return true; } |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
bool Init(HWND hWnd) { IDirect3D9 * pd3d = Direct3DCreate9(D3D_SDK_VERSION); Parameters = { 0 }; HRESULT hr = pd3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &Parameters, &pd3ddevice); if (hr != D3D_OK) { MessageBox(hWnd, "DirectX konnte nicht erfolgreich initialisiert werden!\nErstellung der Geräteschnittstelle ist fehlgeschlagen: CreateDevice()!", "Fehler!", MB_ICONERROR | MB_OK); SAFE_RELEASE(pd3d); return false; } return true; } |
Alter Hase
Beruf: Softwareentwickler (aktuell Web/Node); Freiberuflicher Google Proxy
Zitat
pPresentationParameters [in, out]
Type: D3DPRESENT_PARAMETERS*
Pointer to a D3DPRESENT_PARAMETERS structure, describing the presentation parameters for the device to be created. If BehaviorFlags specifies D3DCREATE_ADAPTERGROUP_DEVICE, pPresentationParameters is an array. Regardless of the number of heads that exist, only one depth/stencil surface is automatically created.
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
IDirect3DDevice9* pd3ddevice = NULL; bool Init(HWND hWnd) { IDirect3D9* pd3d = Direct3DCreate9(D3D_SDK_VERSION); pd3d->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &pMode); Parameters = { 0 }; Parameters.hDeviceWindow = hWnd; Parameters.Windowed = true; Parameters.SwapEffect = D3DSWAPEFFECT_DISCARD; Parameters.BackBufferCount = 2; Parameters.BackBufferFormat = pMode.Format; Parameters.BackBufferHeight = pMode.Height; Parameters.BackBufferWidth = pMode.Width; Parameters.EnableAutoDepthStencil = TRUE; Parameters.AutoDepthStencilFormat = D3DFMT_D16; Parameters.Flags = D3DPRESENTFLAG_DISCARD_DEPTHSTENCIL; Parameters.MultiSampleType = D3DMULTISAMPLE_NONE; HRESULT hr = pd3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, NULL, D3DCREATE_HARDWARE_VERTEXPROCESSING, &Parameters, &pd3ddevice); if (hr != D3D_OK) { MessageBox(hWnd, "DirectX konnte nicht erfolgreich initialisiert werden!\nErstellung der Geräteschnittstelle ist fehlgeschlagen: CreateDevice()!", "Fehler!", MB_ICONERROR | MB_OK); SAFE_RELEASE(pd3d); return false; } return true; } |
Also es würde mich schon stark wundern, wenn die Grafikkarte keine Vertizes unterstützen würde... Das wäre in etwa so sinnvoll wie ein Auto ohne Räder. D3DCREATE_HARDWARE_VERTEXPROCESSING ist schon korrekt.
Werbeanzeige