Hi,

It is always possible to render into an offscreen render target. You do not 
even need any window for that.

The typical pattern is:

QOpenGLContext ctx;
QSurfaceFormat fmt;
fmt.setDepthBufferSize(24);
…
ctx.setFormat(fmt);
if (!ctx.create()) panic();

QOffscreenSurface s;
s.setFormat(ctx.format());
s.create();

if (!ctx.makeCurrent(&s)) panic();

ctx.functions()->glBindFrameBuffer(…)
… // render

In the OVR case you presumably need to render into the texture retrieved from 
ovr_GetTextureSwapChainBufferGL. So you still need to create your own FBO with 
the depth attachment and whatnot, but the color attachment will be the provided 
texture.

If you already have a QOpenGLWindow, then the QOffscreenSurface is not 
necessary since you already have something that can be used with makeCurrent().

Best regards,
Laszlo

From: Interest [mailto:interest-bounces+laszlo.agocs=qt...@qt-project.org] On 
Behalf Of Fan Kevin
Sent: onsdag 2. august 2017 02.41
To: interest@qt-project.org
Subject: [Interest] QOpenGLWindow or QOpenGLWidget if need to render to 
framebuffer?


Hi,
I was wondering between the difference between QOpenGLWindow and QOpenGLWidget.
I read that
"OpenGLWindow renders directly to the given window, while QOpenGLWidget renders 
to offscreen buffer that is then rendered to the widget"

I have to do some rendering to the framebuffer, as that is necessary for 
displaying in Oculus Rift.
However, it seems unable to do so in our software which is built upon 
QOpenGLWindow.
Is it possible to render to a framebuffer using QOpenGLWindow? or should I use 
QOpenGLWidget?
Thank you.
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to