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
Quellcode |
|
1 |
Der Aufruf von g_pD3DDevice->DrawIndexedPrimitive verursachte den DirectX-Fehler D3DERR_INVALIDCALL! |
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
//RENDER-------------------------------------------------------------------------------------------------------------- tbResult Render (float fNumSecsPassed) { HRESULT hResult; float fAspect= (float)(Direct3DParameters.VideoMode.Width)/ (float)(Direct3DParameters.VideoMode.Height); float f=0.01f; // Fogdensity //Z-Buffer Clearen hResult = g_pD3DDevice->Clear(0,0, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, dwFogColor, 1.0f,0); g_pD3DDevice->BeginScene(); Lights(); g_pD3DDevice->SetRenderState(D3DRS_FOGENABLE, TRUE); g_pD3DDevice->SetRenderState(D3DRS_FOGCOLOR, dwFogColor); g_pD3DDevice->SetRenderState(D3DRS_FOGTABLEMODE, D3DFOG_EXP2); g_pD3DDevice->SetRenderState(D3DRS_FOGVERTEXMODE, D3DFOG_NONE); g_pD3DDevice->SetRenderState(D3DRS_RANGEFOGENABLE, FALSE); g_pD3DDevice->SetRenderState(D3DRS_FOGDENSITY, *( DWORD* )( &f )); g_pD3DDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_ANISOTROPIC); g_pD3DDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR); g_pD3DDevice->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR); //-Kamera-Matrixen: tbMatrix mCamera = tbMatrixCamera(g_vCameraPosition, g_vCameraPosition+tbVector3(sinf(g_fCameraAngle), 0.0f, cosf(g_fCameraAngle)),tbVector3(0.0f,1.0f,0.0f)); g_pD3DDevice->SetTransform(D3DTS_VIEW, (D3DMATRIX*)(&mCamera)); g_pD3DDevice->SetTexture(0, g_apTexture[1]); //2048 Würfel------------------------------------------------------------- tbMatrix mWorld3 = tbMatrixTranslation(tbVector3(1.0f, 1.0f, 1.0f)); g_pD3DDevice->SetTransform(D3DTS_WORLD, (D3DMATRIX*)(&mWorld3)); //-malen g_pD3DDevice->SetStreamSource(0, g_pVertexBuffer, 0, sizeof(SVERTEX)); g_pD3DDevice->SetIndices(g_pIndexBuffer); if(FAILED(hResult= g_pD3DDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, //<-DA IST DAS PROBLEM 0, 0, g_iNumCubes*8, 0, g_iNumCubes*12))) { TB_ERROR_DIRECTX("g_pD3DDevice->DrawIndexedPrimitive", hResult, TB_STOP); }; //Kugeln: for(int iSphere=0; iSphere<10; iSphere++) { tbMatrix mWorld4 = tbMatrixScaling(tbVector3(1.0f))*tbMatrixTranslation(tbVector3(10.0f, 0.0f, 0.0f)) * tbMatrixRotationY(TB_DEG_TO_RAD((float)(iSphere) * 36.0f + g_fTime * 10.0f)) * tbMatrixTranslation(tbVector3(0.0f, sinf((float)(iSphere) + g_fTime * 2.0f), 30.0f)); g_pD3DDevice->SetTransform(D3DTS_WORLD, (D3DMATRIX*)(&mWorld4)); // Material: Material.Diffuse = tbColor(0.00f, 0.00f, 0.00f); // Streufarbe Material.Ambient = tbColor(0.25f, 0.25f, 0.25f); // Hintergrundfarbe Material.Emissive = tbColor(0.0f, 0.0f, 0.0f); // Eigenfarbe Material.Specular = tbColor(0.25f, 0.25f, 0.25f); // Glanzfarbe Material.Power = (float)(iSphere) * 5.0f; // Glanzfaktor g_pD3DDevice->SetMaterial(&Material); g_pD3DDevice->SetTexture(0, g_apTexture[3]); g_pSphereModel1->DrawSubset(0); //<-UND DA }; //Rendern Beenden g_pD3DDevice->EndScene(); g_pD3DDevice->Present(0,0,0,0); return TB_OK; }; |
Werbeanzeige