- GLint success;
- glGetProgramiv(progId, GL_VALIDATE_STATUS, &success);
- if (!success) {
- GLchar log[1024];
- glGetProgramInfoLog(progId, sizeof(log), NULL, log);
- fprintf(stderr, "error: %s\n", log);
- exit(1);
+ glGenVertexArrays(1, &lightVao);
+ GLuint vbo;
+ glBindVertexArray(lightVao);
+ glGenBuffers(1, &vbo);
+ glBindBuffer(GL_ARRAY_BUFFER, vbo);
+ glBufferData(GL_ARRAY_BUFFER, verticesSize, NULL, GL_STATIC_DRAW);
+ glBufferSubData(GL_ARRAY_BUFFER, 0, verticesSize, glm::value_ptr(vertices[0]));
+ GLuint posLoc = glGetAttribLocation(progId, "vPosition");
+ glEnableVertexAttribArray(posLoc);
+ glVertexAttribPointer(posLoc, 3, GL_FLOAT, GL_FALSE, 0, 0);
+}
+
+void weightsChanged(int blendshape, float weight) {
+ blendshapeWeights[blendshape] = weight;
+ std::vector<float> weights;
+ weights.assign(blendshapeWeights, blendshapeWeights + blendshapes.deltas.size());
+ interpolateBlendshapes(&blendshapes, weights);
+}
+
+void loadBlendshapes() {
+
+ // get all the obj files
+ std::vector<std::string> blends;
+ const std::string modelDir = "models/high-res-blendshapes/";
+ DIR *blendDir = opendir(modelDir.c_str());
+ while (dirent *e = readdir(blendDir)) {
+ if (e->d_type & DT_DIR) continue;
+ const std::string name(e->d_name);
+ if (name == "neutral.obj") continue;
+ blends.push_back(name);