Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qt with OpenGL. Drawing buildings on a canvas



  • Hi,

    I have asked some round about questions here before, I think I'll ask the complete problem instead as I am getting stuck.

    So, we have a code base where the user could load some data from a file to draw buildings onto a canvas. The canvas in this case is made in a QOpenGLWidget. The canvas has its coods set using glOrtho (for this case lets take 1500x1500x1500).

    Now, I recently got a requirement for allowing the user to create / modify and remove these buildings on the fly. I made the changes by updating the data in the local object containing all coordinates for each vertex of each face of the building.

    The problem I came across having done the update was that all the buildings are deleted and re-created when any of the buildings is modified. This comes out as a performance issue.

    So, the task to fix it came up. We lack a resident openGL guy and I have near zero idea myself. I ended up asking / searching to find some methods for doing this. The one I picked was to draw all the buildings into separate buffers and blit / bind them onto the main canvas. This would effectively remove the requirement for re-drawing the buildings which have not been modified.

    From what I gathered, I originally started off taking FBOs as the method for completion. But, someone told me that I should use VBOs instead.
    Might I be suggested the best method?

    For using VBO, I'm following: http://www.trentreed.net/blog/qt5-opengl-part-2-3d-rendering/ for now

    Kindly note that the buildings in consideration must have very specific coods and each of 'em will have customized textures for each face.


Log in to reply