Display terrain
This commit is contained in:
parent
7e9c8f80b6
commit
71c1b73ec3
2 changed files with 8 additions and 8 deletions
2
.vscode/tasks.json
vendored
2
.vscode/tasks.json
vendored
|
@ -39,7 +39,7 @@
|
||||||
{
|
{
|
||||||
"label": "Run Exercise 3",
|
"label": "Run Exercise 3",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "exercise3/build/cmake/./exercise3",
|
"command": "cd exercise3/build/cmake/ && ./exercise3",
|
||||||
"dependsOn": "Build Exercise 3",
|
"dependsOn": "Build Exercise 3",
|
||||||
"problemMatcher": []
|
"problemMatcher": []
|
||||||
},
|
},
|
||||||
|
|
|
@ -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 2.2.3. Make sure to call "set_normal" for every vertex and continue this
|
||||||
task in "set_normal".
|
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.
|
und fahren Sie in "set_normal" mit der Aufgabe fort.
|
||||||
|
|
||||||
|
|
||||||
|
@ -208,17 +208,17 @@ void terrain::render_terrain()
|
||||||
|
|
||||||
|
|
||||||
// Go through all rows (-1)
|
// 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
|
// Draw one strip
|
||||||
for (int x = 0; x<map_width; x++) {
|
for (int x = 0; x < map_width; x++) {
|
||||||
|
glVertex3f(static_cast<float>(x), get_heightmap_value(x, y), static_cast<float>(y));
|
||||||
// ... to be completed
|
glVertex3f(static_cast<float>(x), get_heightmap_value(x, y + 1), static_cast<float>(y) + 1.0f);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
Loading…
Reference in a new issue