qt - QOpenGLFramebufferObjectFormat::toImage() Android black image -
i'm trying code https://dangelog.wordpress.com/2013/02/10/using-fbos-instead-of-pbuffers-in-qt-5-2/ on android device.
after changes code running without errors, can't correct image yet. on android image black. doing wrong? thanks!
here changes in first lines:
qsurfaceformat format; format.setmajorversion(2); format.setminorversion(2); qoffscreensurface window; //window.setsurfacetype(qwindow::openglsurface); window.setformat(format); window.create(); qopenglcontext* context=(qopenglcontext::currentcontext()); // context.setformat(format); /* if (!context.create()) qfatal("cannot create requested opengl context!"); */ context->makecurrent(&window); const qrect drawrect(0, 0, 400, 400); const qsize drawrectsize = drawrect.size(); qopenglframebufferobjectformat fboformat; //fboformat.setsamples(16); //fboformat.setattachment(qopenglframebufferobject::combineddepthstencil); qopenglframebufferobject fbo(drawrectsize, fboformat); fbo.bind();
update 1 changed code into
qsurfaceformat format; format.setmajorversion(3); format.setminorversion(0); char* extensionlist = (char*) glgetstring(gl_version); qdebug()<<extensionlist; qoffscreensurface window; //qoffscreen openglsurface //window.setsurfacetype(qwindow::openglsurface); window.setformat(format); window.create(); //qopenglcontext* context=(qopenglcontext::currentcontext()); qopenglcontext context; context.setformat(format); if (!context.create()) qfatal("cannot create requested opengl context!"); if(!context.makecurrent(&window)) qfatal("cannot makecurrent(windows)!");
but doesn't change result...i still black png image. check format of qimage , seems correct (arg32, corresponds format of fbo gl_rgba).
Comments
Post a Comment