Obtain image from XrSwapchainImageOpenGLESKHR

Every frame, I can access an object of type XrSwapchainImageOpenGLESKHR from the vector of swapchain images. However the image parameter in the object is of type uint32, and I wanted to access the image bit map, to read the values as if they were an RGB image matrix. Is this possible?

The swapchain image is typically for writing only.

In the case of XR_META_environment_depth, however, this is reversed. But, the only usage I know to be allowed is as an input to a shader, for depth testing. I’m not sure that you are able to directly map it to the CPU memory or if you would have to sample it from a shader and render it to another texture first. It is meant for depth testing in your shader, not for environment mapping, etc.

1 Like

I’m experimenting with Meta’s OpenXRMobileSDK samples, specifically with XrPassthroughOcclusion. After xrAcquireEnvironmentDepthImageMETA, it calls RenderScene() passing the frame as a parameter, which contains the depth data. In that function it calls GL(glBindTexture(GL_TEXTURE_2D_ARRAY, frameIn.DepthTexture));, doesn’t that mean that I could do something like void *data = (unsigned int *) calloc(32, sizeof(unsigned int)); GL(glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, 2000, 2000, 256, GL_DEPTH_COMPONENT, GL_FLOAT, (const void *)data)); to map the depth texture to memory? Specially since according to documentation glTexSubImage3D last parameter is ‘pixels’ passed as a pointer which gets written with the image data.