Forum Discussion
MrKaktus
11 years agoExplorer
OpenGL Direct Rendering CLIENT Mode
Hi,
I've previously successfuly implemented OpenGL Extended Desktop Client Rendering and now I've decided to add Direct Rendering mode support to that setup. I've googled a little bit the forum and I found this references and samples:
https://github.com/jherico/OculusRiftInAction
http://nuclear.mutantstargoat.com/hg/oculus2/file/tip
https://github.com/jimbo00000/RiftSkeleton
viewtopic.php?f=30&t=8948
viewtopic.php?t=17842
http://www.glfw.org/docs/latest/rift.html
The problem is that they all use SDK Rendering.
So I've analyzed RoomTinyDemo source code in OpenGL SDK Rendering mode to understand how it works and I'm hitting a point where I don't know what I'm doing wrong.
I'm working with latest SDK 0.5.0.1 and on NVidia drivers 344.75 on Windows 7 64bit.
From RoomTinyDemo we can see that in OpenGL SDK Rendering mode order of calls is as follows:
I've debugged and replaced with my own all the calls in Platform.InitWindowAndDevice: and I'm seeing that the RoomTinyDemo is still correctly running in SDK Direct mode when creating window and OpenGL xontext using my code. But in my project, after window is created and tracking is enabled Oculus display stays black and the led is stil orange.
Tracking is working but swapchain is not transferring data to HMD even though calling ovrHmd_AttachToWindow() returns true.
My current calls order after creating Window with OpenGL rendering context is:
So the order of the calls is identical, i've also checked that all of them are performed and that parameters are the same.
Can anyone from Oculus confirm that OpenGL CLIENT Direct Mode rendering is working?
I don't want to waste time on trying to find proper setup/config and debug code if it is just not working in SDK now.
I've previously successfuly implemented OpenGL Extended Desktop Client Rendering and now I've decided to add Direct Rendering mode support to that setup. I've googled a little bit the forum and I found this references and samples:
https://github.com/jherico/OculusRiftInAction
http://nuclear.mutantstargoat.com/hg/oculus2/file/tip
https://github.com/jimbo00000/RiftSkeleton
viewtopic.php?f=30&t=8948
viewtopic.php?t=17842
http://www.glfw.org/docs/latest/rift.html
The problem is that they all use SDK Rendering.
So I've analyzed RoomTinyDemo source code in OpenGL SDK Rendering mode to understand how it works and I'm hitting a point where I don't know what I'm doing wrong.
I'm working with latest SDK 0.5.0.1 and on NVidia drivers 344.75 on Windows 7 64bit.
From RoomTinyDemo we can see that in OpenGL SDK Rendering mode order of calls is as follows:
ovr_Initialize();
ovrHmd_Create();
Platform.InitWindowAndDevice:
- RegisterClass()
- CreateWindow()
- GetDC()
- wglChoosePixelFormatARB()
- SetPixelFormat()
- wglCreateContextAttribsARB()
- Get OpenGL funtion pointers, check extensions support
- ShowWindow()
- Few OpenGL API calls to init FBO etc.
ovrHmd_GetFovTextureSize()
SDK Rendering setup here:
ovrGLConfig config;
config.OGL.Header.API = ovrRenderAPI_OpenGL;
config.OGL.Header.BackBufferSize = HMD->Resolution;
config.OGL.Header.Multisample = 0;
config.OGL.Window = Platform.Window;
config.OGL.DC = Platform.hDC;
ovrHmd_ConfigureRendering(); // <- SDK Rendering only call
ovrHmd_SetEnabledCaps();
ovrHmd_AttachToWindow();
ovrHmd_ConfigureTracking();
ovrHmd_DismissHSWDisplay(); // <- SDK Rendering only call
I've debugged and replaced with my own all the calls in Platform.InitWindowAndDevice: and I'm seeing that the RoomTinyDemo is still correctly running in SDK Direct mode when creating window and OpenGL xontext using my code. But in my project, after window is created and tracking is enabled Oculus display stays black and the led is stil orange.
Tracking is working but swapchain is not transferring data to HMD even though calling ovrHmd_AttachToWindow() returns true.
My current calls order after creating Window with OpenGL rendering context is:
// Calculate resolution of shared Render Target
ovrSizei recommenedTex0Size = ovrHmd_GetFovTextureSize(hmd, ovrEye_Left, hmd->DefaultEyeFov[0], 1.0f);
ovrSizei recommenedTex1Size = ovrHmd_GetFovTextureSize(hmd, ovrEye_Right, hmd->DefaultEyeFov[1], 1.0f);
resolutionRT.x = static_cast<uint32>(recommenedTex0Size.w + recommenedTex1Size.w);
resolutionRT.y = static_cast<uint32>(max( recommenedTex0Size.h, recommenedTex1Size.h ));
// Configure SDK rendering THIS PART IS DISABLED OF COURSE
#if OCULUS_SDK_RENDERING
assert( GpuContext.screen.created );
configuration.OGL.Header.API = ovrRenderAPI_OpenGL;
configuration.OGL.Header.BackBufferSize = OVR::Sizei(hmd->Resolution.w, hmd->Resolution.h);
configuration.OGL.Header.Multisample = 1;
// configuration.OGL.DC = HDC; // TODO: Connect with window
// configuration.OGL.Window = HWND;
if (!ovrHmd_ConfigureRendering(hmd,
&configuration.Config,
ovrDistortionCap_Chromatic |
ovrDistortionCap_Vignette |
ovrDistortionCap_TimeWarp |
ovrDistortionCap_Overdrive,
hmd->DefaultEyeFov, eye))
return false;
// ovrHmd_SetBool(dev.hmd, "HSW", false); // Disable Health Safety Warning
#endif
ovrHmd_SetEnabledCaps(hmd, ovrHmdCap_LowPersistence | ovrHmdCap_DynamicPrediction );
// Attach to window in direct rendering mode
if (displayMode == Direct)
{
assert( GpuContext.screen.created );
#ifdef EN_PLATFORM_WINDOWS
if (!ovrHmd_AttachToWindow(hmd, GpuContext.device.hWnd, NULL, NULL))
Log << "ERROR: Cannot attach Oculus to window for Direct Rendering!\n";
#endif
}
// Turn on the Oculus
if (!ovrHmd_ConfigureTracking(hmd, ovrTrackingCap_Orientation | ovrTrackingCap_MagYawCorrection | ovrTrackingCap_Position, ovrTrackingCap_Orientation))
return false;
#if !OCULUS_SDK_RENDERING
EyeRenderDesc[0] = ovrHmd_GetRenderDesc(hmd, ovrEye_Left, hmd->DefaultEyeFov[0]);
EyeRenderDesc[1] = ovrHmd_GetRenderDesc(hmd, ovrEye_Right, hmd->DefaultEyeFov[1]);
#endif
ovrHmd_RecenterPose(hmd);
So the order of the calls is identical, i've also checked that all of them are performed and that parameters are the same.
Can anyone from Oculus confirm that OpenGL CLIENT Direct Mode rendering is working?
I don't want to waste time on trying to find proper setup/config and debug code if it is just not working in SDK now.
13 Replies
- MrKaktusExplorerI've run RoomTinyDemo in OpenGL SDK Rendering - Direct Mode and it works. But that's SDK Rendering not, client one.
The question is, what is the exact difference between the two, or better, what is the exact difference between Client Rendering in Extended Desktop mode VS Direct Mode? I need to find some simple sample that is complete and works in Direct Mode, Client Rendering. - jhericoAdventurer
"mrkaktus" wrote:
The question is, what is the exact difference between the two, or better, what is the exact difference between Client Rendering in Extended Desktop mode VS Direct Mode?
I hate the term 'client rendering' because all clients have to do some kind of rendering every frame. I prefer the term 'client distortion'.
But to answer your question, the exact difference between direct mode and extended mode with regards to client distortion is that there isn't one. Extended/Direct and Client/SDK based distortion are completely orthogonal. If you look at the SDK, it follows the same code path for distortion and timewarp regardless of what mode the Rift is in.
So all client distortion is, is saying that for whatever reason, you can't relinquish responsibility to the SDK to do the distortion, timing and buffer swap. The most common reason for using client distortion is that your rendering engine doesn't allow you to not do the buffer swap and as such you have to take responsibility for all the other stuff that the SDK normally does before the swap in the EndFrame call, namely distortion and timewarp."mrkaktus" wrote:
I need to find some simple sample that is complete and works in Direct Mode, Client Rendering.
You really don't, because SDK 0.6 removes all support for client distortion anyway. - MrKaktusExplorer
You really don't, because SDK 0.6 removes all support for client distortion anyway.
Yeah, I know I read the news today. So that looks like it closes this thread without real root cause of the issue.
I'm in the process of integrating new SDK, I'm wondering if it will solve all my problems :)
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 1 year ago
- 2 years ago