Skip to content
Snippets Groups Projects
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
Branches
Tags
No related merge requests found
#version 150
uniform sampler2D ColorTexture;
uniform sampler2D DepthStencil;
in vec2 vTexCoord;
out vec4 oColor;
vec2 coordinate;
void main(void)
{
coordinate = vTexCoord;
// Left side is the color image seen by the user
// Right side is the the depth map of the current view
// Texture coordinates have to be scaled
// and for the left image they also have to be shifted
if ( gl_TexCoord[0].s < 0.5 ) {
gl_TexCoord[0].s = gl_TexCoord[0].s * 2.0;
gl_FragColor = texture2D( ColorTexture, gl_TexCoord[0].st );
if ( vTexCoord.x < 0.5 ) {
coordinate.x = vTexCoord.x * 2.0;
oColor = texture2D( ColorTexture, coordinate );
} else {
gl_TexCoord[0].s = (gl_TexCoord[0].s - 0.5) * 2.0;
vec4 convert = texture2D( DepthStencil, gl_TexCoord[0].st );
coordinate.x = (vTexCoord.x - 0.5) * 2.0;
vec4 convert = texture2D( DepthStencil, coordinate );
// 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;
gl_FragColor = convert;
convert = vec4((-1586.34 *( 1.0 - (6.180772 / ( convert.r - 0.459813 + 6.180772)) ) + 127.5) / 255.0);
oColor = convert;
}
}
......
......@@ -7,22 +7,26 @@ uniform sampler2D DepthStencil;
in vec2 vTexCoord;
out vec4 oColor;
vec2 coordinate;
void main(void)
{
coordinate = vTexCoord;
// Left side is the color image seen by the user
// Right side is the the depth map of the current view
// Texture coordinates have to be scaled
// and for the left image they also have to be shifted
if ( vTexCoord.x < 0.5 ) {
vTexCoord.x = vTexCoord.x * 2.0;
oColor = texture2D( ColorTexture, vTexCoord );
coordinate.x = vTexCoord.x * 2.0;
oColor = texture2D( ColorTexture, coordinate );
} else {
vTexCoord.x = (vTexCoord.x - 0.5) * 2.0;
vec4 convert = texture2D( DepthStencil, vTexCoord );
coordinate.x = (vTexCoord.x - 0.5) * 2.0;
vec4 convert = texture2D( DepthStencil, coordinate );
// 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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment