Display terrain

This commit is contained in:
hodasemi 2019-06-01 13:14:17 +02:00
parent 7e9c8f80b6
commit 71c1b73ec3
2 changed files with 8 additions and 8 deletions

2
.vscode/tasks.json vendored
View file

@ -39,7 +39,7 @@
{
"label": "Run Exercise 3",
"type": "shell",
"command": "exercise3/build/cmake/./exercise3",
"command": "cd exercise3/build/cmake/ && ./exercise3",
"dependsOn": "Build Exercise 3",
"problemMatcher": []
},

View file

@ -194,7 +194,7 @@ void terrain::render_terrain()
Task 2.2.3. Make sure to call "set_normal" for every vertex and continue this
task in "set_normal".
Aufgabe 2.2.3. Stellen Sie sicher, dass Sie "set_normal" für jeden Vertex aufrufen
Aufgabe 2.2.3. Stellen Sie sicher, dass Sie "set_normal" f<EFBFBD>r jeden Vertex aufrufen
und fahren Sie in "set_normal" mit der Aufgabe fort.
@ -208,17 +208,17 @@ void terrain::render_terrain()
// Go through all rows (-1)
for (int y = 0; y<map_height-1; y++) {
for (int y = 0; y < map_height-1; y++) {
// ... to be completed
glBegin(GL_TRIANGLE_STRIP);
// Draw one strip
for (int x = 0; x<map_width; x++) {
// ... to be completed
for (int x = 0; x < map_width; x++) {
glVertex3f(static_cast<float>(x), get_heightmap_value(x, y), static_cast<float>(y));
glVertex3f(static_cast<float>(x), get_heightmap_value(x, y + 1), static_cast<float>(y) + 1.0f);
}
glEnd();
}
glPopMatrix();