diff options
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index 34d4959..126daef 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -68,12 +68,15 @@ public: glGetUniformLocation(this->program, "mvp"); this->mv_normal_uniform = glGetUniformLocation(this->program, "mv_normal"); + this->k_uniform = + glGetUniformLocation(this->program, "k_uniform"); this->light_dir_cs_uniform = glGetUniformLocation(this->program, "light_dir_cs"); } GLint mvp_uniform; GLint mv_normal_uniform; + GLint k_uniform; GLint light_dir_cs_uniform; }; @@ -373,6 +376,17 @@ Redisplay(void) glUniformMatrix3fv(patch_program->mv_normal_uniform, 1, false, mv_normal); + float k_uniform[4][4][3]; + for (int i = 0; i < 4; i++) { + for (int j = 0; j < 4; j++) { + for (int k = 0; k < 3; k++) { + k_uniform[i][j][k] = control_points[4 * i + j].values[k]; + } + } + } + glUniformMatrix4x3fv(patch_program->k_uniform, 4, false, + (const float *)k_uniform); + glDrawElements(mesh_sink->mode, mesh_sink->elt_count, GL_UNSIGNED_SHORT, |