Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Myownbitch

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

Hi,

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.

/F

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?

PARTNERS