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
Zitat
Nicht abgefangene Ausnahme in Dreieck.exe: 0xC0000005: Access Violation.
Nicht abgefangene Ausnahme in Dreieck.exe: 0xC0000005: Access Violation.
C-/C++-Quelltext |
|
1 2 3 4 5 |
Dreieck.cpp : 79: // Nun die Dreiecke zeichnen if(FAILED(hResult = g_pD3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, // Dreiecksliste 6, // 16 Dreiecke g_aBoxVertexa[ii], // Vertexdaten sizeof(SVertex)))) // Vertexgröße |
C-/C++-Quelltext |
|
1 2 3 4 |
SVertex g_aBoxVertexa[10][8]; // Die acht Vertizes der maximal 10 Quader SVertex g_aBoxVertexb[10][8]; SVertex g_aPunkte[10]; // Die maximal 10 Punkte mit ihren jeweils 3 koordinaten int iZeile = 0; |
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 |
for(int ii = 0; ii <= iZeile; ii++) { // Nun die Dreiecke zeichnen if(FAILED(hResult = g_pD3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, // Dreiecksliste 6, // 6 Dreiecke g_aBoxVertexa[ii], // Vertexdaten sizeof(SVertex)))) // Vertexgröße { // Fehler beim Zeichnen! MessageBox(g_hWindow, "Fehler beim Zeichnen des Dreiecks!", "Fehler", MB_OK | MB_ICONEXCLAMATION); TB_ERROR_DIRECTX("g_pD3DDevice->DrawPrimitiveUP", hResult, TB_STOP); } // Nun die Dreiecke zeichnen if(FAILED(hResult = g_pD3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, // Dreiecksliste 6, // 6 Dreiecke g_aBoxVertexb[ii], // Vertexdaten sizeof(SVertex)))) // Vertexgröße { // Fehler beim Zeichnen! MessageBox(g_hWindow, "Fehler beim Zeichnen des Dreiecks!", "Fehler", MB_OK | MB_ICONEXCLAMATION); TB_ERROR_DIRECTX("g_pD3DDevice->DrawPrimitiveUP", hResult, TB_STOP); } } |
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 |
// Initialisieren der Quader for(int i = 0; i <= iZeile; i++) { g_aBoxVertexa[i][0].vPosition = tbVector3( 0.0f, 0.0f, 0.0f ); g_aBoxVertexa[i][1].vPosition = tbVector3( g_aPunkte[i].vPosition.x, 0.0f, 0.0f ); g_aBoxVertexa[i][2].vPosition = tbVector3( 0.0f, g_aPunkte[i].vPosition.y, 0.0f ); g_aBoxVertexa[i][3].vPosition = tbVector3( g_aPunkte[i].vPosition.x, g_aPunkte[i].vPosition.y, 0.0f ); g_aBoxVertexa[i][4].vPosition = tbVector3( 0.0f, g_aPunkte[i].vPosition.y, g_aPunkte[i].vPosition.z); g_aBoxVertexa[i][5].vPosition = tbVector3( g_aPunkte[i].vPosition.x, g_aPunkte[i].vPosition.y, g_aPunkte[i].vPosition.z); g_aBoxVertexa[i][6].vPosition = tbVector3( 0.0f, 0.0f, g_aPunkte[i].vPosition.z); g_aBoxVertexa[i][7].vPosition = tbVector3( g_aPunkte[i].vPosition.x, 0.0f, g_aPunkte[i].vPosition.z); g_aBoxVertexb[i][0].vPosition = g_aBoxVertexa[i][2].vPosition; g_aBoxVertexb[i][1].vPosition = g_aBoxVertexa[i][4].vPosition; g_aBoxVertexb[i][2].vPosition = g_aBoxVertexa[i][0].vPosition; g_aBoxVertexb[i][3].vPosition = g_aBoxVertexa[i][6].vPosition; g_aBoxVertexb[i][4].vPosition = g_aBoxVertexa[i][1].vPosition; g_aBoxVertexb[i][5].vPosition = g_aBoxVertexa[i][7].vPosition; g_aBoxVertexb[i][6].vPosition = g_aBoxVertexa[i][3].vPosition; g_aBoxVertexb[i][7].vPosition = g_aBoxVertexa[i][5].vPosition; for(int j = 0; j < 8; j++) { g_aBoxVertexa[i][j].dwColor = tbColor( 1.0f, 1.0f, 1.0f); g_aBoxVertexb[i][j].dwColor = tbColor( 1.0f, 1.0f, 1.0f); } } |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
//Punkte aus Datei holen ifstream Input; Input.open("punkte.txt", ios::in | ios::binary); //Datei zum lesen öffnen char k[100]; while(!Input.eof()) { Input.getline(k, 100); //Datei zeilenweise lesen und im Zeilenpuffer speichern if(k[0] == ' ') break; g_aPunkte[iZeile].vPosition = tbVector3( k[0], k[1], k[2]); for(int l = 0; l < sizeof(k); l++) k[l] = ' '; // Den Zeilenpuffer (k) annullieren iZeile++; } |
Werbeanzeige