Forum Discussion
TeraBit
12 years agoHonored Guest
Strange effect using Sdk 0.3.1
Hi All,
I've been writing some code interfacing a .NET application with the new Rift 0.3.1 code. But it's producing some strange effects.
I'm using the SDK rendering (a texture per eye) and although I get something showing up when I render, the are pushed out to the side. The cube is rendered dead centre of the texture but comes out like the picture below.
edit
Just to say that this is using OpenGL with OpenTK driving the GL on the .NET side.
The Setup follows the examples as far as I can see.
NOTE:
Also using the SDK rendering seems to screw up OpenGL state something awful. My VBOs are stomped on and I need to re-upload the data each frame. :(
Any ideas?

I've been writing some code interfacing a .NET application with the new Rift 0.3.1 code. But it's producing some strange effects.
I'm using the SDK rendering (a texture per eye) and although I get something showing up when I render, the are pushed out to the side. The cube is rendered dead centre of the texture but comes out like the picture below.
edit
Just to say that this is using OpenGL with OpenTK driving the GL on the .NET side.
The Setup follows the examples as far as I can see.
eyes[0].Eye = ovrEye_Left;
eyes[1].Eye = ovrEye_Right;
eyes[0].Fov = hmdDesc.DefaultEyeFov[0];
eyes[1].Fov = hmdDesc.DefaultEyeFov[1];
eyes[0].TextureSize = renderTargetSize;
eyes[1].TextureSize = renderTargetSize;
eyes[0].RenderViewport.Pos = Vector2i(0,0);
eyes[0].RenderViewport.Size = Sizei(renderTargetSize.w, renderTargetSize.h);
eyes[1].RenderViewport.Pos = Vector2i(0,0);
eyes[1].RenderViewport.Size = Sizei(renderTargetSize.w , renderTargetSize.h);
eyeRenderDesc[0] = ovrHmd_GetRenderDesc(hmd, eyes[0]);
eyeRenderDesc[1] = ovrHmd_GetRenderDesc(hmd, eyes[1]);
Cfg.OGL.Header.API = ovrRenderAPI_OpenGL;
Cfg.OGL.Header.Multisample = 0;
Cfg.OGL.Header.RTSize.w = hmdDesc.Resolution.w;
Cfg.OGL.Header.RTSize.h = hmdDesc.Resolution.h;
Cfg.OGL.WglContext = wglGetCurrentContext();
Cfg.OGL.Window = HWND(hwnd);
Cfg.OGL.GdiDc = wglGetCurrentDC();
int l_RenderCaps = 0;
int l_DistortionCaps = ovrDistortion_Chromatic | ovrDistortion_TimeWarp;
ovrHmd_ConfigureRendering(hmd, &Cfg.Config, l_RenderCaps, l_DistortionCaps, eyes, eyeRenderDesc);
EyeTexture[0].OGL.Header.API = ovrRenderAPI_OpenGL;
EyeTexture[0].OGL.Header.TextureSize.w = renderTargetSize.w;
EyeTexture[0].OGL.Header.TextureSize.h = renderTargetSize.h;
EyeTexture[0].OGL.Header.RenderViewport = eyes[0].RenderViewport;
EyeTexture[0].OGL.TexId = tid1;
EyeTexture[1].OGL.Header.API = ovrRenderAPI_OpenGL;
EyeTexture[1].OGL.Header.TextureSize.w = renderTargetSize.w;
EyeTexture[1].OGL.Header.TextureSize.h = renderTargetSize.h;
EyeTexture[1].OGL.Header.RenderViewport = eyes[1].RenderViewport;
EyeTexture[1].OGL.TexId = tid2;
NOTE:
Also using the SDK rendering seems to screw up OpenGL state something awful. My VBOs are stomped on and I need to re-upload the data each frame. :(
Any ideas?

24 Replies
- TeraBitHonored GuestWell I eventually got it to look about right by changing the viewport position configuration from (0,0) to (-268,0) & (268,0)
eyes[0].RenderViewport.Pos = Vector2i(-268,0);
eyes[0].RenderViewport.Size = Sizei(renderTargetSize.w, renderTargetSize.h);
eyes[1].RenderViewport.Pos = Vector2i(268,0);
eyes[1].RenderViewport.Size = Sizei(renderTargetSize.w, renderTargetSize.h);
I don't know why it works or what's going on, but has anyone else done this with two separate textures as opposed to one big one with two viewports on it? - TeraBitHonored Guest
"DoZo1971" wrote:
I haven't tried two textures.
Buy maybe you could use this example, modify it for two textures and see if there are any surprises.
Thanks,
Daniel
Thanks. I followed that example mostly in the setup of my own initial scene. I think I try converting my own one to a single texture and see what happens. :) - TeraBitHonored GuestAlso,
Timewarp is eating all my CPU... If I add
int l_DistortionCaps = ovrDistortion_Chromatic | ovrDistortion_TimeWarp;
rather than:
int l_DistortionCaps = ovrDistortion_Chromatic;
I use 100% of a CPU at 120 FPS instead of 1% without it. :?
But curiously only cuts about 100 fps without Vsync (860 -> 760). - cyberealityGrand ChampionI think there is a waiting period to sync up with the refresh rate or something. So it may be hitting 100% CPU but most of that is probably idle time used for synchronization.
- TeraBitHonored Guest
"cybereality" wrote:
I think there is a waiting period to sync up with the refresh rate or something. So it may be hitting 100% CPU but most of that is probably idle time used for synchronization.
If it's just spinning, I don't think it would be using 100% CPU. VSync does something similar (and sometimes I have emulated it on systems that don't have Vsync), it just releases time to be used elsewhere.
Either something is wrong with it, or it is doing something useful until the last second.
Here's the results at different FPS:
TimeWarp vs Non-TimeWarp
30 FPS = 6% vs 0.4%
60 FPS = 12% vs 0.6%
120 FPS = 13.37% vs 0.94%
BTW: This happens if I just have the BeginFrame and EndFrame without rendering the eyes. - guygodinProtegeI experience the same effect with my application taking a full core with Timewarp and VSync On. With Timewarp off, it takes only 10-12% of a core. With VSync off there's practically no difference in FPS. And that's without an actual Rift plugged in.
In a normal game I guess this isn't really an issue as it will hog your CPU anyway but for some cases (like Virtual Desktop) I want to be minimizing the CPU usage as much as possible.
Good find terabit! - cyberealityGrand ChampionI might be mistaken, I haven't really dug too deep into the code.
Let me see what I can find out. - guygodinProtegeSince I tested this without a Rift, this means I used ovrHmd_CreateDebug() to create my HMD. How about you TeraBit, was this with an actual rift or a debug hmd?
- TeraBitHonored Guest
"guygodin" wrote:
Since I tested this without a Rift, this means I used ovrHmd_CreateDebug() to create my HMD. How about you TeraBit, was this with an actual rift or a debug hmd?
This is with a DK1.
The Oculus World Demo that comes with 0.3.1 also eats almost all CPU at 60 FPS, but drops from 12% to 7% if you turn off timewarp (O Key).
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
- 3 years ago
- 5 months ago