diff options
| author | Jules Blok <jules.blok@gmail.com> | 2014-10-31 15:53:08 +0100 |
|---|---|---|
| committer | Jules Blok <jules.blok@gmail.com> | 2014-11-23 14:27:39 +0100 |
| commit | c3ad6e78207bc0f64a9687fd8f27fbe0f7606bc7 (patch) | |
| tree | 0703520d36c36edb9a65aaf0d64692cb54d4a89b /Source/Core/VideoBackends/OGL/PostProcessing.cpp | |
| parent | 6c8f3fa8616381ea2957a2a00834a490407b9b2a (diff) | |
PostProcessing: Add support for anaglyph stereoscopy mode.
Diffstat (limited to 'Source/Core/VideoBackends/OGL/PostProcessing.cpp')
| -rw-r--r-- | Source/Core/VideoBackends/OGL/PostProcessing.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/Source/Core/VideoBackends/OGL/PostProcessing.cpp b/Source/Core/VideoBackends/OGL/PostProcessing.cpp index 7cd99a05d7..905531226c 100644 --- a/Source/Core/VideoBackends/OGL/PostProcessing.cpp +++ b/Source/Core/VideoBackends/OGL/PostProcessing.cpp @@ -166,10 +166,13 @@ void OpenGLPostProcessing::ApplyShader() m_shader.Destroy(); m_uniform_bindings.clear(); - // load shader from disk - std::string default_shader = "void main() { SetOutput(Sample()); }\n"; + // load shader code std::string code = ""; - if (g_ActiveConfig.sPostProcessingShader != "") + std::string default_shader = "void main() { SetOutput(Sample()); }\n"; + + if (g_ActiveConfig.iStereoMode == STEREO_ANAGLYPH) + code = "void main() { SetOutput(float4(SampleLayer(1).r, SampleLayer(0).gba)); }\n"; + else if (g_ActiveConfig.sPostProcessingShader != "") code = m_config.LoadShader(); if (code == "") @@ -253,7 +256,12 @@ void OpenGLPostProcessing::CreateHeader() "\treturn texture(samp9, float3(location, layer));\n" "}\n" - "#define SampleOffset(offset) textureOffset(samp9, uv0, offset)\n" + "float4 SampleLayer(int layer)\n" + "{\n" + "\treturn texture(samp9, float3(uv0, layer));\n" + "}\n" + + "#define SampleOffset(offset) textureOffset(samp9, float3(uv0, layer), offset)\n" "float4 SampleFontLocation(float2 location)\n" "{\n" |
