Jump to content

  • Log In with Google      Sign In   
  • Create Account

Calling all IT Pros from Canada and Australia.. we need your help! Support our site by taking a quick sponsored surveyand win a chance at a $50 Amazon gift card. Click here to get started!


Member Since 21 Feb 2010
Offline Last Active Oct 26 2012 11:45 AM

Topics I've Started

VAO, VBO speed

13 October 2012 - 12:48 PM


I'm currently having some speed problems when drawing with VAO and VBOs. This is my drawing method for every shape:

[source lang="cpp"]void Shape::draw() { double posX = drawingState_->getPositionX(); double posY = drawingState_->getPositionY(); double posZ = drawingState_->getPositionZ(); double rotX = drawingState_->getRotationX(); double rotY = drawingState_->getRotationY(); double rotZ = drawingState_->getRotationZ(); glm::mat4 model_matrix = glm::translate(glm::mat4(1.0), glm::vec3(posX, posY, posZ)); model_matrix = glm::rotate(model_matrix, (float)rotX, glm::vec3(1.0,0.0,0.0)); model_matrix = glm::rotate(model_matrix, (float)rotY, glm::vec3(0.0,1.0,0.0)); model_matrix = glm::rotate(model_matrix, (float)rotZ, glm::vec3(0.0,0.0,1.0)); glm::mat4 tempMVP = Camera::projectionViewMatrix() * model_matrix; shader_.bind(); glBindVertexArray(vaoID_); GLuint MVP_ID = glGetUniformLocation(shader_.getProgramHandle(), "MVP_matrix"); glUniformMatrix4fv(MVP_ID, 1, GL_FALSE, glm::value_ptr(tempMVP)); //glDrawArrays(GL_QUADS, 0, 24); //glBindBuffer(GL_ARRAY_BUFFER, vertices_vbo_); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ebo_); glDrawElements(GL_TRIANGLE_FAN, nIndices_, GL_UNSIGNED_SHORT, (void*)0); glBindVertexArray(0); // Unbind our Vertex Array Object shader_.unbind();}[/source]

Every shape is just a normal circle with 21 vertices. If I remove the above drawing method and only updating the behavior of the shapes the result is 4000 shapes with 60fps (max fps). But if I update and drawing with the method above... I get 20 fps. Is drawing with VAO supposed to be that slow?

I'm stuck. Any help appreciated.


Debug faster than release

21 February 2010 - 06:13 AM

Hey, I have usually found answers to my questions on google but this problem is so weird that I need some real professional help! I have been developing a concurrent simulation/game engine with C++ in Linux and compiling with gcc. The performance was quite good ~6000 Boids at 50 fps. A week ago I started a larger renovation and now the performance is 81 Boids at 30 fps.... + the debug build is actually Faster than release. My larger headache is that the debug is faster than release. Do anyone have any clue about this?