static void Draw(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); if (Blend) { glEnable(GL_BLEND); glDisable(GL_DEPTH_TEST); } else { glDisable(GL_BLEND); glEnable(GL_DEPTH_TEST); } glPushMatrix(); glRotatef(Xrot, 1, 0, 0); glRotatef(Yrot, 0, 1, 0); glRotatef(Zrot, 0, 0, 1); DrawTextures(); glPopMatrix(); glutSwapBuffers(); }
// Draws the mesh into the draw buffer void Mesh::Draw(const glm::mat4& projection_matrix, const glm::mat4& view_matrix, const LightingBuffer& lights) { shaders.UseThisShader(); // Matrices MVP = projection_matrix * view_matrix * model_matrix; DrawUniforms(projection_matrix, view_matrix, lights); DrawTextures(); EnableAttributes(); DrawAttributes(); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementBuffer); // |Mode |Count |Type |Array buff offset glDrawElements(GL_TRIANGLES, indices.size(), GL_UNSIGNED_SHORT, (void*)0); DisableAttributes(); // We can store now the actual MVP as the previous one oldMVP = MVP; }