summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2012-12-11 17:33:49 -0800
committerMatt Turner <mattst88@gmail.com>2012-12-11 17:33:49 -0800
commit21396b4fa36856ce770297df59cd61725ff268da (patch)
tree81b36348aaad2283ec0c3f6a98455f87f63f85c1 /src
parent18b7caedb71a56381fafaa724ad3c9fa2dc8e465 (diff)
Implement cubic bezier surfaceHEADmaster
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp14
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,