Question

I'm trying to improve my FPS rate for an python OpenGL program. So far my approach is:

    self.bufferVertices = glGenBuffers(1)
    glBindBuffer(GL_ARRAY_BUFFER_ARB, self.bufferVertices)
    glBufferData(GL_ARRAY_BUFFER_ARB, ADT.arrayByteCount(vertices), ADT.voidDataPointer(vertices), GL_STATIC_DRAW_ARB)

    self.bufferNormals = glGenBuffers(1)
    glBindBuffer(GL_ARRAY_BUFFER_ARB, self.bufferNormals)
    glBufferData(GL_ARRAY_BUFFER_ARB, ADT.arrayByteCount(normals), ADT.voidDataPointer(normals), GL_STATIC_DRAW_ARB)

    self.size = len(triangles)
    self.bufferTriangles = glGenBuffers(1)
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB, self.bufferTriangles)
    glBufferData(GL_ELEMENT_ARRAY_BUFFER_ARB, len(triangles), ADT.voidDataPointer(triangles), GL_STATIC_DRAW_ARB)
-----------------------------------------------------------------
    glEnableClientState(GL_VERTEX_ARRAY) 
    glBindBuffer(GL_ARRAY_BUFFER_ARB, self.bufferVertices)
    glVertexPointer(3, GL_FLOAT, 0, None)
    glBindBuffer(GL_ARRAY_BUFFER_ARB, self.bufferNormals)
    glNormalPointer(GL_FLOAT, 0, None)
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB, self.bufferTriangles)
    glIndexPointer(GL_INT, 0, None)

    glDrawElements(displayType, self.size, GL_UNSIGNED_INT, 0)

    glDisableClientState(GL_VERTEX_ARRAY) 

Now displayType is changed between GL_POINTS and GL_TRIANGLES. I'm currently getting about 28FPS for points and only about 5-6FPS for triangles. I this difference normal ? What can I do to improve the FPS?

Was it helpful?

Solution

Since you're using vertex buffer objects you're not CPU limited. So either you have a lot of geometry, or you're not actually got HW acceleration. Either way a decrease in performance switching from points to filled triangles is to be expected, due to higher fillrate demands.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top