aboutsummaryrefslogtreecommitdiffstats
path: root/LibOVR/Src/CAPI/GL/CAPI_GL_DistortionRenderer.h
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-03-21 23:01:12 +0100
committerSven Gothel <[email protected]>2015-03-21 23:01:12 +0100
commit0c5c4be020c2d55540058a49b2a879f46d5a1e13 (patch)
tree00f84c2ca18cc233b826014094b9cad0769a3ea5 /LibOVR/Src/CAPI/GL/CAPI_GL_DistortionRenderer.h
parentcbbd775b6c754927632c333ff01424a0d2048c7c (diff)
parente490c3c7f7bb5461cfa78a214827aa534fb43a3e (diff)
Merge branch 'vanilla_0.4.4' and resolve conflicts
TODO: Validate for removed patches due to relocation Resolved Conflicts: LibOVR/Src/Kernel/OVR_ThreadsWinAPI.cpp LibOVR/Src/OVR_Linux_HMDDevice.cpp LibOVR/Src/OVR_OSX_HMDDevice.cpp LibOVR/Src/OVR_Profile.cpp LibOVR/Src/OVR_Sensor2Impl.cpp LibOVR/Src/OVR_SensorFusion.cpp LibOVR/Src/OVR_SensorImpl.cpp LibOVR/Src/OVR_Win32_DeviceStatus.cpp LibOVR/Src/OVR_Win32_HIDDevice.cpp LibOVR/Src/OVR_Win32_HIDDevice.h LibOVR/Src/OVR_Win32_HMDDevice.cpp
Diffstat (limited to 'LibOVR/Src/CAPI/GL/CAPI_GL_DistortionRenderer.h')
-rw-r--r--LibOVR/Src/CAPI/GL/CAPI_GL_DistortionRenderer.h92
1 files changed, 32 insertions, 60 deletions
diff --git a/LibOVR/Src/CAPI/GL/CAPI_GL_DistortionRenderer.h b/LibOVR/Src/CAPI/GL/CAPI_GL_DistortionRenderer.h
index 60f1a9f..f48e42d 100644
--- a/LibOVR/Src/CAPI/GL/CAPI_GL_DistortionRenderer.h
+++ b/LibOVR/Src/CAPI/GL/CAPI_GL_DistortionRenderer.h
@@ -5,12 +5,23 @@ Content : Distortion renderer header for GL
Created : November 11, 2013
Authors : David Borel, Lee Cooper
-Copyright : Copyright 2013 Oculus VR, Inc. All Rights reserved.
+Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved.
-Use of this software is subject to the terms of the Oculus Inc license
-agreement provided at the time of installation or download, or which
+Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License");
+you may not use the Oculus VR Rift SDK except in compliance with the License,
+which is provided at the time of installation or download, or which
otherwise accompanies this software in either electronic or hard copy form.
+You may obtain a copy of the License at
+
+http://www.oculusvr.com/licenses/LICENSE-3.2
+
+Unless required by applicable law or agreed to in writing, the Oculus VR SDK
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
************************************************************************************/
#ifndef OVR_CAPI_GL_DistortionRenderer_h
@@ -33,7 +44,7 @@ public:
DistortionRenderer(ovrHmd hmd,
FrameTimeManager& timeManager,
const HMDRenderState& renderState);
- ~DistortionRenderer();
+ virtual ~DistortionRenderer();
// Creation function for the device.
@@ -44,12 +55,11 @@ public:
// ***** Public DistortionRenderer interface
- virtual bool Initialize(const ovrRenderAPIConfig* apiConfig,
- unsigned distortionCaps);
+ virtual bool Initialize(const ovrRenderAPIConfig* apiConfig) OVR_OVERRIDE;
- virtual void SubmitEye(int eyeId, ovrTexture* eyeTexture);
+ virtual void SubmitEye(int eyeId, const ovrTexture* eyeTexture);
- virtual void EndFrame(bool swapBuffers, unsigned char* latencyTesterDrawColor, unsigned char* latencyTester2DrawColor);
+ virtual void EndFrame(bool swapBuffers);
void WaitUntilGpuIdle();
@@ -58,57 +68,11 @@ public:
double FlushGpuAndWaitTillTime(double absTime);
protected:
-
-
- class GraphicsState : public CAPI::DistortionRenderer::GraphicsState
- {
- public:
- GraphicsState();
- virtual void Save();
- virtual void Restore();
-
- protected:
- void ApplyBool(GLenum Name, GLint Value);
-
- public:
- GLint GlMajorVersion;
- GLint GlMinorVersion;
- bool SupportsVao;
-
- GLint Viewport[4];
- GLfloat ClearColor[4];
- GLint DepthTest;
- GLint CullFace;
- GLint Program;
- GLint ActiveTexture;
- GLint TextureBinding;
- GLint VertexArray;
- GLint FrameBufferBinding;
-
- GLint Blend;
- GLint ColorWritemask[4];
- GLint Dither;
- GLint Fog;
- GLint Lighting;
- GLint RasterizerDiscard;
- GLint RenderMode;
- GLint SampleMask;
- GLint ScissorTest;
- GLfloat ZoomX;
- GLfloat ZoomY;
- };
-
- // TBD: Should we be using oe from RState instead?
- unsigned DistortionCaps;
struct FOR_EACH_EYE
{
- FOR_EACH_EYE() : TextureSize(0), RenderViewport(Sizei(0)) { }
+ FOR_EACH_EYE() : numVerts(0), numIndices(0), texture(0), /*UVScaleOffset[],*/ TextureSize(0, 0), RenderViewport(0, 0, 0, 0) { }
-#if 0
- IDirect3DVertexBuffer9 * dxVerts;
- IDirect3DIndexBuffer9 * dxIndices;
-#endif
int numVerts;
int numIndices;
@@ -119,10 +83,15 @@ protected:
Recti RenderViewport;
} eachEye[2];
+ Ptr<Texture> pOverdriveTextures[NumOverdriveTextures];
+ Ptr<Texture> OverdriveBackBufferTexture;
+
// GL context and utility variables.
- RenderParams RParams;
+ RenderParams RParams;
+ Context distortionContext; // We are currently using this private OpenGL context instead of using the CAPI SaveGraphicsState/RestoreGraphicsState mechanism. To consider: Move this Context into SaveGraphicsState/RestoreGraphicState so there's consistency between DirectX and OpenGL.
// Helpers
+ void initOverdrive();
void initBuffersAndShaders();
void initShaders();
void initFullscreenQuad();
@@ -140,6 +109,8 @@ protected:
void renderLatencyQuad(unsigned char* latencyTesterDrawColor);
void renderLatencyPixel(unsigned char* latencyTesterPixelColor);
+ void renderEndFrame();
+
Ptr<Texture> pEyeTextures[2];
Ptr<Buffer> DistortionMeshVBs[2]; // one per-eye
@@ -148,6 +119,8 @@ protected:
Ptr<ShaderSet> DistortionShader;
+ bool RotateCCW90;
+
struct StandardUniformData
{
Matrix4f Proj;
@@ -157,10 +130,9 @@ protected:
GLuint LatencyVAO;
Ptr<Buffer> LatencyTesterQuadVB;
Ptr<ShaderSet> SimpleQuadShader;
+ Ptr<ShaderSet> SimpleQuadGammaShader;
- Ptr<Texture> CurRenderTarget;
- Array<Ptr<Texture> > DepthBuffers;
- GLuint CurrentFbo;
+ GLuint OverdriveFbo;
GLint SavedViewport[4];
GLfloat SavedClearColor[4];
@@ -175,4 +147,4 @@ protected:
}}} // OVR::CAPI::GL
-#endif // OVR_CAPI_GL_DistortionRenderer_h \ No newline at end of file
+#endif // OVR_CAPI_GL_DistortionRenderer_h