aboutsummaryrefslogtreecommitdiffstats
path: root/Samples
diff options
context:
space:
mode:
authorBrad Davis <[email protected]>2014-08-11 21:18:59 -0700
committerBrad Davis <[email protected]>2014-08-11 21:18:59 -0700
commit04a03e83f135fbfccbc960b13e05729490ccd375 (patch)
tree7878b192a3fd24eb69f54744dc17f44f53b0ac1a /Samples
parent0f49ce8fc6aa54224e4c0d6fda8c4527ad39cce1 (diff)
Adding 0.4.1 windows files
Diffstat (limited to 'Samples')
-rw-r--r--Samples/OculusWorldDemo/OculusWorldDemo.cpp20
-rw-r--r--Samples/OculusWorldDemo/OculusWorldDemo.h3
-rw-r--r--Samples/OculusWorldDemo/OculusWorldDemo_Scene.cpp5
3 files changed, 21 insertions, 7 deletions
diff --git a/Samples/OculusWorldDemo/OculusWorldDemo.cpp b/Samples/OculusWorldDemo/OculusWorldDemo.cpp
index febc153..7dfde26 100644
--- a/Samples/OculusWorldDemo/OculusWorldDemo.cpp
+++ b/Samples/OculusWorldDemo/OculusWorldDemo.cpp
@@ -71,6 +71,7 @@ OculusWorldDemoApp::OculusWorldDemoApp()
PositionTrackingEnabled(true),
PixelLuminanceOverdrive(true),
MirrorToWindow(true),
+ SupportsSrgb(true),
// Scene state
SceneMode(Scene_World),
@@ -246,6 +247,10 @@ bool OculusWorldDemoApp::SetupWindowAndRendering(int argc, const char** argv)
RenderParams.Display = DisplayId(Hmd->DisplayDeviceName, Hmd->DisplayId);
RenderParams.Multisample = 1;
RenderParams.Resolution = Hmd->Resolution;
+
+ if (OVR_strcmp(graphics, "GL") == 0 && !(Hmd->HmdCaps & ovrHmdCap_ExtendDesktop))
+ SupportsSrgb = false;
+
//RenderParams.Fullscreen = true;
pRender = pPlatform->SetupGraphics(OVR_DEFAULT_RENDER_DEVICE_SET,
graphics, RenderParams);
@@ -496,8 +501,9 @@ void OculusWorldDemoApp::CalculateHmdValues()
ovrRenderAPIConfig config = pRender->Get_ovrRenderAPIConfig();
unsigned distortionCaps = ovrDistortionCap_Chromatic |
- ovrDistortionCap_Vignette |
- ovrDistortionCap_SRGB;
+ ovrDistortionCap_Vignette;
+ if (SupportsSrgb)
+ distortionCaps |= ovrDistortionCap_SRGB;
if(PixelLuminanceOverdrive)
distortionCaps |= ovrDistortionCap_Overdrive;
if (TimewarpEnabled)
@@ -586,9 +592,11 @@ Sizei OculusWorldDemoApp::EnsureRendertargetAtLeastThisBig(int rtNum, Sizei requ
// Does that require actual reallocation?
if (Sizei(rt.Tex.Header.TextureSize) != newRTSize)
{
- rt.pTex = *pRender->CreateTexture(Texture_RGBA | Texture_RenderTarget |
- (MultisampleEnabled ? 4 : 1) | Texture_SRGB ,
- newRTSize.w, newRTSize.h, NULL);
+ int format = Texture_RGBA | Texture_RenderTarget | (MultisampleEnabled ? 4 : 1);
+ if (SupportsSrgb)
+ format |= Texture_SRGB;
+
+ rt.pTex = *pRender->CreateTexture(format, newRTSize.w, newRTSize.h, NULL);
rt.pTex->SetSampleMode(Sample_ClampBorder | Sample_Linear);
@@ -1205,7 +1213,7 @@ void OculusWorldDemoApp::RenderTextInfoHud(float textHeight)
OVR_sprintf(gpustat, sizeof(gpustat), " GPU Tex: %u MB", texMemInMB);
OVR_strcat(buf, sizeof(buf), gpustat);
}
-
+
DrawTextBox(pRender, 0.0f, 0.0f, textHeight, buf, DrawText_Center);
}
break;
diff --git a/Samples/OculusWorldDemo/OculusWorldDemo.h b/Samples/OculusWorldDemo/OculusWorldDemo.h
index 38843df..86f68b0 100644
--- a/Samples/OculusWorldDemo/OculusWorldDemo.h
+++ b/Samples/OculusWorldDemo/OculusWorldDemo.h
@@ -48,6 +48,7 @@ using namespace OVR::Util::Render;
#define WORLDDEMO_ASSET_PATH2 "../../../Assets/Tuscany/"
// This path allows the shortcut to work.
#define WORLDDEMO_ASSET_PATH3 "Samples/OculusWorldDemo/Assets/Tuscany/"
+#define WORLDDEMO_ASSET_PATH4 "../Assets/Tuscany/"
using namespace OVR;
using namespace OVR::OvrPlatform;
@@ -172,6 +173,8 @@ protected:
int ScreenNumber;
int FirstScreenInCycle;
+ bool SupportsSrgb;
+
struct RenderTarget
{
Ptr<Texture> pTex;
diff --git a/Samples/OculusWorldDemo/OculusWorldDemo_Scene.cpp b/Samples/OculusWorldDemo/OculusWorldDemo_Scene.cpp
index 0a81469..48c97ba 100644
--- a/Samples/OculusWorldDemo/OculusWorldDemo_Scene.cpp
+++ b/Samples/OculusWorldDemo/OculusWorldDemo_Scene.cpp
@@ -39,13 +39,16 @@ void OculusWorldDemoApp::InitMainFilePath()
{
String prefixPath1(pPlatform->GetContentDirectory() + "/" + WORLDDEMO_ASSET_PATH1),
prefixPath2(WORLDDEMO_ASSET_PATH2),
- prefixPath3(WORLDDEMO_ASSET_PATH3);
+ prefixPath3(WORLDDEMO_ASSET_PATH3),
+ prefixPath4(WORLDDEMO_ASSET_PATH4);
if (SysFile(prefixPath1 + MainFilePath).IsValid())
MainFilePath = prefixPath1 + MainFilePath;
else if (SysFile(prefixPath2 + MainFilePath).IsValid())
MainFilePath = prefixPath2 + MainFilePath;
else if (SysFile(prefixPath3 + MainFilePath).IsValid())
MainFilePath = prefixPath3 + MainFilePath;
+ else if (SysFile(prefixPath4 + MainFilePath).IsValid())
+ MainFilePath = prefixPath4 + MainFilePath;
}
}