[Interest] Using PixelBufferObject to async copy from GPU to CPU

Nuno Santos nuno.santos at imaginando.pt
Thu Nov 21 19:10:39 CET 2024


Hi,

I’ve been tinkering a lot around this and not matter what I try I don’t seem to get glMapBufferRange to work. In the mean time I’ve found this in the documentation:

void *QOpenGLExtraFunctions::glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)

Convenience function that calls glMapBufferRange(target, offset, length, access).

This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the function either in core or as an extension.


So I tried to set 

format.setVersion(3,2);
format.setProfile(QSurfaceFormat::CoreProfile);

After doing this, the surface was actually set to 4.1 

And even so, the glMapBufferRange returns OpenGL Error: 1282 (INVALID OPERATION)


Is anyone here using PBO to read from a FBO asynchronously with Qt 6.8.0?

Thanks!

Nuno

> On 20 Nov 2024, at 14:20, Nuno Santos <nuno.santos at imaginando.pt> wrote:
> 
> Hi,
> 
> I’m trying to optimize an offscreen rendering in my application. I currently rely on glReadPixels to get the rendered image but in its more direct form is a blocking call. 
> 
> I want to take advantage of PBO to make this copy asynchronous and take less time to render the scene.
> 
> However, when trying to glMapBufferRange I always get a null ptr and if I check the GL error code I have “Invalid operation”:
> 
> You can have a look at the code here -> https://pastebin.com/KNKZgeQ0
> 
> I’m on Qt 6.8.0 and I’m still using OpenGL because I’m really stick to it on this application.
> 
> Is anyone using PBO’s to async copy from GPU to CPU from a framebuffer with Qt?
> 
> Thanks in advance!
> 
> Nuno

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20241121/2e49f570/attachment.htm>


More information about the Interest mailing list