From 8162ca201e319cd6c98829f255b530a79e078015 Mon Sep 17 00:00:00 2001 From: karl Date: Sun, 30 May 2021 20:02:12 +0200 Subject: [PATCH] Tessellation on the quad mesh works! --- Shader/terrain.tcs | 8 ++++---- include/Gedeng/QuadMesh.h | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Shader/terrain.tcs b/Shader/terrain.tcs index 55adbf2..ecd980d 100644 --- a/Shader/terrain.tcs +++ b/Shader/terrain.tcs @@ -16,8 +16,8 @@ void main() { tc_out[gl_InvocationID].texture_coordinate = tc_in[gl_InvocationID].texture_coordinate; tc_out[gl_InvocationID].position = tc_in[gl_InvocationID].position; - gl_TessLevelInner[0] = 1; - gl_TessLevelOuter[0] = 1; - gl_TessLevelOuter[1] = 1; - gl_TessLevelOuter[2] = 1; + gl_TessLevelInner[0] = 12; + gl_TessLevelOuter[0] = 12; + gl_TessLevelOuter[1] = 12; + gl_TessLevelOuter[2] = 12; } \ No newline at end of file diff --git a/include/Gedeng/QuadMesh.h b/include/Gedeng/QuadMesh.h index 0a6d120..a8d3bbd 100644 --- a/include/Gedeng/QuadMesh.h +++ b/include/Gedeng/QuadMesh.h @@ -113,6 +113,8 @@ class QuadMesh : public Mesh { void render_patches(Shader &shader) const { shader.setMat4("model", get_matrix()); + glPatchParameteri(GL_PATCH_VERTICES, 3); + glBindVertexArray(quadVAO); glDrawArrays(GL_PATCHES, 0, 6); glBindVertexArray(0);