简体   繁体   中英

Qt 5.3. Painting on QOpenGLFrameBuffer

Painting on a QOpenGLFrameBuffer in the Qt 5.3 (beta) seems a bit elusive to me I can get only a black image. (I Haven't tried previous versions of Qt5 but haven't find any notice of some problem in this area)

Searching around I've copied the exact sample at http://dangelog.wordpress.com/2013/02/10/using-fbos-instead-of-pbuffers-in-qt-5-2 .

Adding just before the end of createImageWIthFBO()

  QImage img=fbo.toImage();
  img.save("d:/tmp.jpg");

to inspect the fresh result with no further operations but the resulting image is black.

Am I missing something? perhaps some platform problem? (Win 8.0 here)

The problem was in the instruction format.setMajorVersion(3) , that 3 should be a 2 and all works as expected. (I guess some implementations of opengl are more picky in this detail)

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