Since there are two ways to use OpenGL with Qt 5 (QOpenGL/QtOpenGL wrapper and regular OpenGL API), I wonder what are the limitations of each one. Could someone tell if there are limitations with QOpenGL wrapper that I should be aware of?
The reason I am asking this is because I don't want to start using QOpenGL wrapper and find out that I can't use the full capability of OpenGL API. Does anyone have experience with both and could provide some hints in terms of capability, performance and ease of use?
I don't want to start using QOpenGL wrapper and find out that I can't use the full capability of OpenGL API
Well, Qt 5.0's OpenGL wrappers are built on top of the OpenGL ES (Embedded Systems) 2.0 specification which is essentially a watered down version of the desktop OpenGL 3.0 specification. Qt chose this specification to facilitate portability as it is widely supported by mobile platforms in addition being supported on nearly all modern PCs. If you choose to use the Qt wrappers you have to work around the shortcomings of the OpenGL ES 2.0 specification which, for the most part, fall into the following categories:
glBegin
,glEnd
,glLightf
,etc..)highp
, lowp
declarations, etc..)glBlitFramebuffer
,glMultiDrawArrays
, glDrawRangeElements
, etc..)For a full description of the OpenGL ES 2.0 specification look here.
However, This lack of features does not mean that the Qt wrappers can not accomplish what you need. Although OpenGL ES 2.0 is missing a lot of helpful functionality, you can still accomplish 99% of what the full desktop OpenGL specification would allow. If you decide to utilize a desktop OpenGL specification via custom wrappers, Qt can still manage the creation & windowing of desktop OpenGL contexts through the use of the QGLFormat
class.
Keep in mind that if you decide to use desktop OpenGL wrappers, and utilize these within a Qt application, some classes provided by Qt may interfere with the operation of your custom wrappers. For example, QPainter operations on a QGLWidget may utilize functionality of the OpenGL ES specification and might interfere with the operation of your wrapper objects.
Personally, I prefer to use custom OpenGL wrappers as I greatly prefer the desktop OpenGL specifications as the feature sets are better defined and they provide more options to tackle a problem with. On the other hand, Qt 5 provides some absolutely fantastic architectures for making quick, powerful dynamic user interfaces using OpenGL ES. (Through by QtQuick 2 and QML)
Which API suits your needs best essentially comes down to whether or not you are targeting embedded or mobile platforms (in which case your forced to use OpenGL ES), and whether you are willing to sacrifice additional development time writing and maintaining custom OpenGL 3+ wrappers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With