[Interest] Problems with OpenGL in Windows and Qt5

Carlos aarkham2k3 at yahoo.com
Fri Mar 21 22:06:31 CET 2014


Hello Oliver

Thanks for your help. In Windows and Linux it does not flickers and you can see two small rectangles (one yellow and one green).

In the original code I did not asked for any OpenGL version, I changed it to 4.3 to see if there were any change and forget about it. The main target of the code is OpenGL ES 2 and I use the desktop version for development so as long as it worked I did not care about this. Maybe I'll have to take a closer look at it.


The code is as minimal as I could get in a couple of hours. I developed it for a couple of games I have published. If you have an iOS device let me know and I will send you a promo code.

There is not paintGL method, the render is done from the timer function and it calls App::Step that in turn calls AppDelegate::Render. Here is where the two rectangles are defined and drawn.

Which version of Qt did you use? In my experience the code works fine in Windows with Qt 4 but fails with Qt 5. In Linux it works fine in Qt 4 and Qt 5. Symbian and Meego use Qt4 and works fine. In other systems (Android, iOS and BB10) I do not use Qt and it runs fine.


Thanks

  Carlos






On Friday, March 21, 2014 8:28 PM, Till Oliver Knoll <till.oliver.knoll at gmail.com> wrote:
 
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
_______________________________________________
Interest mailing list
Interest at qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140321/8b43fbcf/attachment.html>


More information about the Interest mailing list