Commit 79acfdec authored by Jan Möbius's avatar Jan Möbius
Browse files

Fixed depth shaders

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@17467 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 46dd1f8f
#version 150
uniform sampler2D ColorTexture; uniform sampler2D ColorTexture;
uniform sampler2D DepthStencil; uniform sampler2D DepthStencil;
in vec2 vTexCoord;
out vec4 oColor;
vec2 coordinate;
void main(void) void main(void)
{ {
coordinate = vTexCoord;
// Left side is the color image seen by the user // Left side is the color image seen by the user
// Right side is the the depth map of the current view // Right side is the the depth map of the current view
// Texture coordinates have to be scaled // Texture coordinates have to be scaled
// and for the left image they also have to be shifted // and for the left image they also have to be shifted
if ( gl_TexCoord[0].s < 0.5 ) { if ( vTexCoord.x < 0.5 ) {
gl_TexCoord[0].s = gl_TexCoord[0].s * 2.0; coordinate.x = vTexCoord.x * 2.0;
gl_FragColor = texture2D( ColorTexture, gl_TexCoord[0].st ); oColor = texture2D( ColorTexture, coordinate );
} else { } else {
gl_TexCoord[0].s = (gl_TexCoord[0].s - 0.5) * 2.0; coordinate.x = (vTexCoord.x - 0.5) * 2.0;
vec4 convert = texture2D( DepthStencil, gl_TexCoord[0].st ); vec4 convert = texture2D( DepthStencil, coordinate );
// This conversion is specified in the docs for a 20'' Display // This conversion is specified in the docs for a 20'' Display
convert.rgba = (-1586.34 *( 1.0 - (6.180772 / ( convert.r - 0.459813 + 6.180772)) ) + 127.5) / 255.0; convert = vec4((-1586.34 *( 1.0 - (6.180772 / ( convert.r - 0.459813 + 6.180772)) ) + 127.5) / 255.0);
gl_FragColor = convert; oColor = convert;
} }
} }
......
...@@ -7,22 +7,26 @@ uniform sampler2D DepthStencil; ...@@ -7,22 +7,26 @@ uniform sampler2D DepthStencil;
in vec2 vTexCoord; in vec2 vTexCoord;
out vec4 oColor; out vec4 oColor;
vec2 coordinate;
void main(void) void main(void)
{ {
coordinate = vTexCoord;
// Left side is the color image seen by the user // Left side is the color image seen by the user
// Right side is the the depth map of the current view // Right side is the the depth map of the current view
// Texture coordinates have to be scaled // Texture coordinates have to be scaled
// and for the left image they also have to be shifted // and for the left image they also have to be shifted
if ( vTexCoord.x < 0.5 ) { if ( vTexCoord.x < 0.5 ) {
vTexCoord.x = vTexCoord.x * 2.0; coordinate.x = vTexCoord.x * 2.0;
oColor = texture2D( ColorTexture, vTexCoord ); oColor = texture2D( ColorTexture, coordinate );
} else { } else {
vTexCoord.x = (vTexCoord.x - 0.5) * 2.0; coordinate.x = (vTexCoord.x - 0.5) * 2.0;
vec4 convert = texture2D( DepthStencil, vTexCoord ); vec4 convert = texture2D( DepthStencil, coordinate );
// This conversion is specified in the docs for a 42'' Display // This conversion is specified in the docs for a 42'' Display
convert.rgba = (-1960.37 *( 1.0 - (7.655192 / ( convert.r - 0.467481 + 7.655192)) ) + 127.5) / 255.0; convert = vec4((-1960.37 *( 1.0 - (7.655192 / ( convert.r - 0.467481 + 7.655192)) ) + 127.5) / 255.0);
oColor = convert; oColor = convert;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment