Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Need advice regarding OpenGL (and Qt5)
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
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!
Thanks for your answer.
From what I have seen I have a few different strategies:
drawing triangles manually (slow)
GL_VERTEX_ARRAY but passing indexes
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.
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?
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.
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 :)
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 :(
Not entirely surprising, that is very old!
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)
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.
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?
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.
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.
However I don't know how to fix that.