cancel
Showing results for 
Search instead for 
Did you mean: 

Submit 2 GL_RGBA OpenGL textures without calling the ovr_CreateTextureSwapChainGL method ?

FOKSlab
Explorer
Hi,
I would like to implement Oculus rendering in my OpenGL app which is already providing stereoscopic rendering. The stereo views are already stored in GL_RGBA textures. I was wondering if there is a way to submit these 2 OpenGL textures to Oculus without calling ovr_CreateTextureSwapChainGL to create them ? If not, is it possible to create the TextureSwapChains so they are based on the already created Textures ?
Thanks !

3 REPLIES 3

FOKSlab
Explorer
I misunderstood the swapChain ! So, to use the already rendered textures, my solution is to create 2 FBOs (one per eye) to blit my RGBA texture into the current swapchain SRGB texture ... I have to develop that to see if it is working (and converting RGBA to SRGB just blitting).
Maybe there is a more clever way to do that ? Any idea ?

FOKSlab
Explorer
if you are trying alternative methods outside of how our PC SDK functions, this coding and technique will need to be custom on your end.


Hi, thanks for your quick answer !

It is not really an alternative method since the rendering is "classic" OpenGL rendering into textures thanks to FBOs.
I am just trying to integrate the best way (for me obviously 😉 ) the Oculus SDK without breaking what has been done before.
So using my RGBA stereo textures to copy them into the correct swapchains textures sounded right for me, but I don't know if blitting RGBA texture to SRGB ones (calling glEnable(GL_FRAMEBUFFER_SRGB) before)  will do the job (conversion RGBA>SRGB without using a specific shader). I have written the code but not tested yet. As soon as I have tested this method I will give you feedbacks.

FOKSlab
Explorer
So ... Here is my feedbacks : blitting one texture to another seems to work well doing the conversion job (only without calling glEnable(GL_FRAMEBUFFER_SRGB) ).

I had issues using ovr_GetTextureSwapChainCurrentIndex and then ovr_GetTextureSwapChainBufferGL. Using  -1  as index in the ovr_GetTextureSwapChainBufferGL and not calling the ovr_GetTextureSwapChainCurrentIndex seems to work better!

But a rendering bug is still happenning: if I draw a thin horizontal rectangle in front of me and move my head up and down, the rectangle is displayed "wavy", I already saw this effect displaying an OpenGL OpenVR application in the Rift. I found where does this come from : tis is a side effect of the Asynchronous Spacewarp optimization. The only solution I found was to deactivate it manually in the Oculus Debug Tool.
Is there any way to deactivate ASW in the code (I have the same issue using either Oculus SDK or OpenVR SDK)?