OpenGL 3.2 core profile, QT 4.8 RC1 not working on Windows and Mac
-
Sorry to necropost. I am now able to reproduce the buffer overflow as mentioned by the OP. I have made a non-Qt windows OpenGL app that acquires an OpenGL 4.2 core profile context which works fine. So it appears that something is going wrong in the Qt context creation code.
Is anybody able to reproduce this on an ATI card on windows? Although I suspect it is not a driver issue but just something else to rule out.
I have stepped through the Qt OpenGL context creation code and from what I can see so far all appears to be fine. It creates a temporary context, resolves some function entry points, then creates a core profile context using the same options as my non-Qt app. Yes when it comes to call glGetStringi( GL_EXTENSIONS, i ); it seems that some sort of stack corruption is occurring as the debugger shows the value of "this" changing each time this function is called.
I'll keep digging but if I can't resolve it soon I'll file a bug report.
-
I think I've also run into the buffer overflow (or at least stack corruption of some kind) in the call to glGetStringi. I suspect "this":http://developer.qt.nokia.com/forums/viewthread/4495/P15 is the same issue as well. Actually exactly the same problem was discussed in comments on the bug report which originally introduced this code, "QTBUG-11052":https://bugreports.qt-project.org/browse/QTBUG-11052. The fix was to add the missing APIENTRY macro to the qt_glGetStringi function pointer typedef (it makes sense that leaving this off would lead to stack corruption). However the APIENTRY wasn't included in the version of the code that was eventually commited in commit 2f59eaee. I've verified that adding the APIENTRY does fix the problem for me, but perhaps it causes problems on some platforms? (I'm on Win 7 64-bit with a GT545).
-
Well spotted! Thanks for the tip. I am on the road at the moment but will try this fix when I return home at the weekend. I'll post back here with the results. Thanks again!
-
The "fix for this":http://codereview.qt-project.org/#change,16794 has been merged into Qt5 now. Next up I will cherry pick it for Qt 4.8 later today.
-
Was Mac giving you troubles? ;-)
-
Yeah. The way that APIENTRY macro is brought into play is slightly different in Qt5 and I never tried building it on Mac myself before my first attempt. My bad as I do actually have a MacBook now.
/me must try harder ;-)
-
Hi ZapB,
I am experiencing similar problems when trying to use the 3.2 core profile and GLSL 1.5 on Mac OSX Lion. How can I obtain the fix that you posted above(http://codereview.qt-project.org/#change,16794)? Is this Windows specific?Will I have to wait for the release of Qt 5 or a patch for 4.8?
Thanks in advance,
Jason -
Hi Jason,
that particular fix was to fix a stack corruption on Windows. My next task is to fix the OpenGL context creation code for Mac and Windows to actually allow use of a Core profile context - it works fine on Linux. I'll post back here when I have something usable but it may take me a few days as I am away on a course most of this week.
-
Hi ZapB,
Are we getting any closed to this fix (use of a Core profile context in Mac) or has it been postponed further?
Thanks in advance,
Shucre -
It is fixed in Qt5 already (see https://codereview.qt-project.org/#change,22653). I've not had time to backport to 4.8.x yet. Still lots of work that could be done to improve using Core profile GL with Qt though.