简体   繁体   中英

Qt5.4 QOpenGLFramebufferObject toImage Returning Blank Image

I'm trying to create a QImage from the QOpenGLFramebufferObject using this example:

https://dangelog.wordpress.com/2013/02/10/using-fbos-instead-of-pbuffers-in-qt-5-2/

I'm just directly copying and pasting the first example and I'm just getting a blank image. I don't know if Qt changed something recently or if it's just me.

here's my project file:

QT       += core gui widgets

TARGET = OpenGLTest2
TEMPLATE = app

SOURCES += main.cpp

I've tried building with MSVC2012/MSVC2013 OpenGL 32bit/64bit and MingW and it's just blank. Is there something missing in my project file? Do I need to change something in the code? Any help would be great...

Ok after playing with it for a bit, I found out the format version lines were causing the problem.

format.setMajorVersion(3);
format.setMinorVersion(3);

After removing them it works fine!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM