diff --git a/zoneb/bin/data/shaders/bound.frag b/zoneb/bin/data/shaders/bound.frag index 2e82b4e..7bee519 100644 --- a/zoneb/bin/data/shaders/bound.frag +++ b/zoneb/bin/data/shaders/bound.frag @@ -99,7 +99,7 @@ void main() { dispColor.rgb = vec3(1); } - // color.r = 1.; + // dispColor.rgb = vec3(depthToSilhouette(texture2D(u_depth, st/u_resolution).r)); gl_FragColor = vec4(dispColor, 1.0); #endif diff --git a/zoneb/bin/data/shaders/render.frag b/zoneb/bin/data/shaders/render.frag index 4098e35..911ea12 100644 --- a/zoneb/bin/data/shaders/render.frag +++ b/zoneb/bin/data/shaders/render.frag @@ -1,14 +1,14 @@ -#version 150 +#ifdef GL_ES +precision mediump float; +#endif // Custom attributes. -uniform sampler2DRect uColorTex; // Sampler for the color registered data +uniform sampler2D uColorTex; // Sampler for the color registered data in vec2 gTexCoord; -out vec4 fragColor; - void main() { - fragColor = texture(uColorTex, gTexCoord); + gl_FragColor = texture2D(uColorTex, gTexCoord); } \ No newline at end of file diff --git a/zoneb/bin/data/shaders/render.geom b/zoneb/bin/data/shaders/render.geom index bdea1a0..1e61044 100644 --- a/zoneb/bin/data/shaders/render.geom +++ b/zoneb/bin/data/shaders/render.geom @@ -1,4 +1,6 @@ -#version 150 +#ifdef GL_ES +precision mediump float; +#endif layout (points) in; layout (triangle_strip) out; diff --git a/zoneb/bin/data/shaders/render.vert b/zoneb/bin/data/shaders/render.vert index 3786f21..a885a5f 100644 --- a/zoneb/bin/data/shaders/render.vert +++ b/zoneb/bin/data/shaders/render.vert @@ -1,4 +1,6 @@ -#version 150 +#ifdef GL_ES +precision mediump float; +#endif // OF built-in attributes. @@ -6,21 +8,23 @@ uniform mat4 modelViewMatrix; // Custom attributes. -uniform sampler2DRect uDepthTex; // Sampler for the depth space data -uniform sampler2DRect uWorldTex; // Transformation from kinect depth/color space to kinect world space +uniform sampler2D uDepthTex; // Sampler for the depth space data +uniform sampler2D uWorldTex; // Transformation from kinect depth/color space to kinect world space uniform ivec2 uFrameSize; +uniform vec2 u_resolution; + out vec4 vPosition; out vec2 vTexCoord; flat out int vValid; void main() { - vTexCoord = vec2(gl_InstanceID % uFrameSize.x, gl_InstanceID / uFrameSize.x); + vTexCoord = vec2(gl_InstanceID % uFrameSize.x, gl_InstanceID / uFrameSize.x)/u_resolution; - float depth = texture(uDepthTex, vTexCoord).x; - vec4 ray = texture(uWorldTex, vTexCoord); + float depth = texture2D(uDepthTex, vTexCoord).x; + vec4 ray = texture2D(uWorldTex, vTexCoord); vValid = (depth != 0 && ray.x != 0 && ray.y != 0) ? 1 : 0; diff --git a/zoneb/src/ofApp.cpp b/zoneb/src/ofApp.cpp index bf08d9b..80645d0 100644 --- a/zoneb/src/ofApp.cpp +++ b/zoneb/src/ofApp.cpp @@ -20,15 +20,16 @@ void ofApp::setup() } // Load shader. - auto shaderSettings = ofShaderSettings(); - shaderSettings.shaderFiles[GL_VERTEX_SHADER] = "shaders/render.vert"; - shaderSettings.shaderFiles[GL_GEOMETRY_SHADER] = "shaders/render.geom"; - shaderSettings.shaderFiles[GL_FRAGMENT_SHADER] = "shaders/render.frag"; - shaderSettings.bindDefaults = true; - if (shader.setup(shaderSettings)) - { - ofLogNotice(__FUNCTION__) << "Success loading shader!"; - } + // auto shaderSettings = ofShaderSettings(); + // shaderSettings.shaderFiles[GL_VERTEX_SHADER] = "shaders/render.vert"; + // shaderSettings.shaderFiles[GL_GEOMETRY_SHADER] = "shaders/render.geom"; + // shaderSettings.shaderFiles[GL_FRAGMENT_SHADER] = "shaders/render.frag"; + // shaderSettings.bindDefaults = true; + // if (shader.setup(shaderSettings)) + // { + // ofLogNotice(__FUNCTION__) << "Success loading shader!"; + // } + shader.load("shaders/render.vert", "shaders/render.frag", "shaders/render.geom"); // Setup vbo. std::vector verts(1);