[Interest] Problems with OpenGL in Windows and Qt5

Till Oliver Knoll till.oliver.knoll at gmail.com
Fri Mar 21 20:24:53 CET 2014


Am 21.03.2014 um 14:06 schrieb Carlos <aarkham2k3 at yahoo.com>:

> Hello Sean
> 
> I'm attaching a Qt project that has this problem. If you run it with Qt 4 it shows a black screen with two small rectangles but if you run it with Qt 5 the screen is displaced and only one of the rectangles can be seen.

I just tried your example code on a MacBook Pro 2010 (max. OpenGL context: 3.3 - GLSL 3.30), and it fails there as well: I get a window which is almost as heigh as the desktop, but very small (like 200 pixels). Most of the screen is indeed black, but the lowest 20% or so of the window content contain pixel garbage which is flickering like crazy (probably due to your timer that you are using). The garbage and flickering changes when I resize the window, but definitively garbage ;)

With some goodwill there is also some orange coloured (?) squeeded rectangle recognisable in between which might be painted by your code.

Not quite unexpected I also "just" got an OpenGL 2.1 context, since I already wrote that there is no "compatibility" context on OS X (and you are requesting a 4.3 "compatibility" context, which IMHO totally does not make sense, since as you say your code must also run on OpenGL ES 2.0!).

Anyway, when changing your code and requesting a "Core" 3.3 context (as I said, my MBP 2010 does not go beyond) I finally got what I asked for.

Off course then your shaders totally won't compile (I guess - haven't checked), as you're using an older GLSL 1.20 dialect ("attribute" vs "in/out" etc.).

But even when explicitly asking for a 2.1 context I get garbage.

Unfortunatelly your example code is NOT a minimal example! I somehow got as far as figuring out where you derive from QGLWidget, but failed to see (in the time my interest level was above 30%, that is ;)) where you actually do your drawing (e.g. I did not see the paintGL method implemented, as expected - or I must have missed it between all that platform-dependent #ifdef hack-party ;)).

I suggest you start from scratch with a minimal "Hello GL" triangle example (from a book or tutorial), try to stick to OpenGL ES 2.0 syntax (if that is your goal), and then add piece by piece code from your actual application again, until you fail - there will be your mistake ;)

Cheers,
  Oliver
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140321/43ded504/attachment.html>


More information about the Interest mailing list