From 21396b4fa36856ce770297df59cd61725ff268da Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Tue, 11 Dec 2012 17:33:49 -0800 Subject: Implement cubic bezier surface --- src/main.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/main.cpp') 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, -- cgit v1.2.3