[Qt-interest] Qt and OpenGL 3.x
Michael Palomas
mpalomas at igeoss.com
Thu Dec 3 13:13:25 CET 2009
Hi,
I am the original poster of the thread you mentioned in the OpenGL
forum. As I said in that thread, as a paying customer I asked to Nokia
support about OpenGL 3.x context creation, and it is not possible
currently with the QGLWidget/QGLContext API.
They created a task tracker entry that you can follow :
http://bugreports.qt.nokia.com/browse/QTBUG-4438
You can see that the status is "some future release" and not before
version 4.7 .
Thanks to the advices and code found in response to my thread in the
OpenGL forum, I succeeded in implementing such a GL3Widget (GLX version
only). Actually this is not that hard, but you have to write platform
specific, and I did not have enough time to try to write the Windows
win32/WGL version (I know nothing in Windows API). I can provide you my
GLX version if you want to look at it.
Currently, as of Qt 4.6, when you create a QGLWidget the OpenGL context
should be a 2.x depending on your hardware and drivers. But, strangely,
I tested that, with any recent (and decent) Nvidia GPU and drivers, you
actually get a 3.x context, even without asking for it ! I did not push
further the testing but i think that this 3.x context can really be used
... Of course this is not a standard and expected behavior (because to
get a valid 3.x context you have to request it, specify profile ..., and
QGLWidget/QGLContext do not do that currently), but it could be useful
if you just want to use the 3.x API for testing, I mean for yourself,
without having to write subclass and all the platform specific stuffs
... I read somewhere that Nvidia does this intentionally, they give a
3.x context for free even if you did not request it. But if your GPU is
an ATI, I have no idea about whether or not you also got a 3.x context.
Regards,
Michael
Oliver.Knoll at comit.ch a écrit :
> Hi,
>
> any thoughts on when/if already Qt supports OpenGL 3.0 in that it would offer to specifically create a OpenGL 3.x context?
>
> In the current 4.6 docs I see that Qt somehow "detects" whether OpenGL 3.x is present ("QGLFormat::OpenGL_Version_3_0"), but I still don't see any way how to explicitly ask for a GL 3.x context, when looking e.g. at http://doc.trolltech.com/4.6/qglformat.html#QGLFormat-2 (http://doc.trolltech.com/4.6/qgl.html#FormatOption-enum)
>
> >From http://www.opengl.org/wiki/Getting_started#OpenGL_3.0_and_Above:
>
> "Part of this new API is a specification of exactly what version of OpenGL you want. So if you ask for a GL 3.1 context, you are telling the system that you expect that any entrypoints version 3.1 removed from earlier versions will not be available, and that any entrypoints 3.1 added to new versions will be available. The new API can fail if the implementation simply does not implement that version of OpenGL."
>
> Someone seems to have implemented a custom GL3Widget: http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=262519 for X11. But apart from that I did not find much when googling for "Qt OpenGL 3.0".
>
>
> Will there be any "official" Qt API way to generate an OpenGL 3.x context "soon"? Or is there already (in Qt 4.6) and I just did not see it?
>
> Cheers, Oliver
>
More information about the Qt-interest-old
mailing list