Hello folks,
I have my Opengl Application which captures vertices from .obj file and to draw on the viewport.
I want to draw surfaces/lines/vertices separately but not at once based on the rendring mode from user with reasonable performance
What can I do to achieve my goal?
below are my drawing codes
void Draw() {
vao.bind();
glm::vec3 pos = camera.getPosition();
glm::mat4 vp = camera.getProjection() * camera.getView();
shader->bind();
for (int i = 0; i < objects.size(); i++) {
objectData = Objects[i];
mesh = objectData.shape->getMesh();
vbo = mesh.getVBO();
ibo = mesh.getIBO();
vao.bind(vbo, 0);
vao.bind(ibo);
shader->setUniform("u_albedoMap", material->getTexture("Albedo").getHandle());
shader->setUniform("u_normalMap", material->getTexture("Normal").getHandle());
shader->setUniform("u_roughnessMap", material->getTexture("Roughness").getHandle());
shader->setUniform("u_metalnessMap", material->getTexture("Metalness").getHandle());
shader->setUniform("u_displacementMap", material->getTexture("Displacement").getHandle());
shader->setUniform("u_emissiveMap", material->getTexture("Emissive").getHandle());
shader->setUniform("u_normalMatrix", glm::inverseTranspose(glm::mat3(objectData.matrix)));
shader->setUniform("u_model", objectData.matrix);
shader->setUniform("u_mvp", vp * objectData.matrix);
shader->setUniform("u_viewPos", pos);
shader->setUniform("u_objectIndex", i);
glDrawElements(GL_TRIANGLES, ibo.Count(), GL_UNSIGNED_INT, nullptr);
}
}