Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Need advice regarding OpenGL (and Qt5)
Forum Updated to NodeBB v4.3 + New Features

Need advice regarding OpenGL (and Qt5)

Scheduled Pinned Locked Moved General and Desktop
13 Posts 2 Posters 4.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JulienMaille
    wrote on last edited by
    #1

    Dear Qt users, I need to write a little 3D viewer that would simply display an heightmap (from a ~512² floating point image) with a mapped texture.
    I already have some code for this (using vbo), but not written by me and with not-so-good performances.
    This is why I plan to rewrite it from scratch. I have a limited knowledge of OpenGL.

    The application is compiled with Qt4 but I'll soon port it to Qt5
    Is there anything I should be aware of before starting my heightmap viewer?

    Thanks a lot

    1 Reply Last reply
    0
    • Z Offline
      Z Offline
      ZapB
      wrote on last edited by
      #2

      No special considerations. The heightmap rendering part will likely be all OpenGL so no dependencies on Qt4 or 5 specifics. Just try it and see if it works. If not come back to the forum :) Good luck!

      Nokia Certified Qt Specialist
      Interested in hearing about Qt related work

      1 Reply Last reply
      0
      • J Offline
        J Offline
        JulienMaille
        wrote on last edited by
        #3

        Thanks for your answer.
        From what I have seen I have a few different strategies:

        drawing triangles manually (slow)

        using GL_VERTEX_ARRAY

        GL_VERTEX_ARRAY but passing indexes

        VBO

        I think I will select option number 3.
        I'm still wondering how I can easily handle invalid values in my heightmap so that these point are not drawn.

        1 Reply Last reply
        0
        • Z Offline
          Z Offline
          ZapB
          wrote on last edited by
          #4

          Personally if you are looking to refactor anyway I would go for VBOs in new code. Is your heightmap in a texture or are you passing the heights through as part of the VBO/array?

          Which OpenGL version are you targetting?

          Nokia Certified Qt Specialist
          Interested in hearing about Qt related work

          1 Reply Last reply
          0
          • J Offline
            J Offline
            JulienMaille
            wrote on last edited by
            #5

            I need the code to run on old computer (let's say 5 year) with integrated chipset even slowly, but it has to display something. Obviously I also need that code to be super fast on a recent computer.

            I want to be able to pick a point and draw x/y lines crossing at that point.
            With the previous vbo code, everything was smooth until I clicked a point.
            After updating the texture, the framerate was crappy. I found thread mentionning this kind of issue with vbo but without a clear answer and too openGL-savy for me.

            1 Reply Last reply
            0
            • Z Offline
              Z Offline
              ZapB
              wrote on last edited by
              #6

              OK OpenGL 3 or so sounds a reasonable ball park so VBOs should be fine. I would keep you static and dynamic data in separate VBOs (i.e. heightmap in static or infrequently updated VBO) and the the data for user-selected points to draw in a dynamic VBO.

              Difficult to recommend too much more specifics without knowing more really. Good luck though :)

              Nokia Certified Qt Specialist
              Interested in hearing about Qt related work

              1 Reply Last reply
              0
              • J Offline
                J Offline
                JulienMaille
                wrote on last edited by
                #7

                I have something that works nicely but I just found a computer with an old intel chipset and openGL 1.4
                The rendering is choppy on that one :(

                1 Reply Last reply
                0
                • Z Offline
                  Z Offline
                  ZapB
                  wrote on last edited by
                  #8

                  Not entirely surprising, that is very old!

                  Nokia Certified Qt Specialist
                  Interested in hearing about Qt related work

                  1 Reply Last reply
                  0
                  • J Offline
                    J Offline
                    JulienMaille
                    wrote on last edited by
                    #9

                    I probably need to display a low-res mesh when panning/rotating to fix that.
                    I guess I need to handle two version for all my arrays (vertices, texture array, indices)

                    1 Reply Last reply
                    0
                    • Z Offline
                      Z Offline
                      ZapB
                      wrote on last edited by
                      #10

                      I would suggest using VBOs where available and if you really need to support OpenGL 1.x then a fallback to rendering with arrays. That way you get the best performance where the hw supports it.

                      Nokia Certified Qt Specialist
                      Interested in hearing about Qt related work

                      1 Reply Last reply
                      0
                      • J Offline
                        J Offline
                        JulienMaille
                        wrote on last edited by
                        #11

                        Fallback + low-res -> 50fps when dragging the heightmap
                        Now I need a way to decide if the current graphic card need the low-res trick or not. Should I guess from the openGL version only?

                        1 Reply Last reply
                        0
                        • Z Offline
                          Z Offline
                          ZapB
                          wrote on last edited by
                          #12

                          Well the technique can be determined form the version number alone I think. The resolution should be determined at runtime by timing your frames. Depends if performance or quality is more important to you.

                          Nokia Certified Qt Specialist
                          Interested in hearing about Qt related work

                          1 Reply Last reply
                          0
                          • J Offline
                            J Offline
                            JulienMaille
                            wrote on last edited by
                            #13

                            I think I'm now satisfied with my code. One last question regarding renderPixmap.
                            It looks like I've a very common issue (lot's of similar question according to google): the texture is not displayed.
                            http://www.qtcentre.org/threads/976-renderPixmap-and-texture

                            However I don't know how to fix that.

                            1 Reply Last reply
                            0

                            • Login

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • Users
                            • Groups
                            • Search
                            • Get Qt Extensions
                            • Unsolved