diff --git a/zoneb/bin/data/shaders/render.vert b/zoneb/bin/data/shaders/render.vert index f0144b6..ceff96c 100644 --- a/zoneb/bin/data/shaders/render.vert +++ b/zoneb/bin/data/shaders/render.vert @@ -12,6 +12,7 @@ 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 ivec2 uDepthFrameSize; uniform vec2 u_resolution; @@ -21,7 +22,7 @@ flat out int vValid; void main() { - vTexCoord = vec2(gl_InstanceID % uFrameSize.x, gl_InstanceID / uFrameSize.x)/vec2(512,424); + vTexCoord = vec2(gl_InstanceID % uFrameSize.x, gl_InstanceID / uFrameSize.x) / uDepthFrameSize; float depth = texture2D(uDepthTex, vTexCoord).x; vec4 ray = texture2D(uWorldTex, vTexCoord); diff --git a/zoneb/src/ofApp.cpp b/zoneb/src/ofApp.cpp index ba828fd..611249f 100644 --- a/zoneb/src/ofApp.cpp +++ b/zoneb/src/ofApp.cpp @@ -84,6 +84,7 @@ void ofApp::draw() shader.setUniformTexture("uWorldTex", kinectDevice.getColorToWorldTex(), 2); shader.setUniformTexture("uColorTex", kinectDevice.getColorTex(), 3); shader.setUniform2i("uFrameSize", kinectDevice.getColorTex().getWidth(), kinectDevice.getColorTex().getHeight()); + shader.setUniform2i("uDepthFrameSize", kinectDevice.getDepthInColorTex().getWidth(), kinectDevice.getDepthInColorTex().getHeight()); numPoints = kinectDevice.getColorTex().getWidth() * kinectDevice.getColorTex().getHeight(); } @@ -93,6 +94,7 @@ void ofApp::draw() shader.setUniformTexture("uWorldTex", kinectDevice.getDepthToWorldTex(), 2); shader.setUniformTexture("uColorTex", kinectDevice.getColorInDepthTex(), 3); shader.setUniform2i("uFrameSize", kinectDevice.getDepthTex().getWidth(), kinectDevice.getDepthTex().getHeight()); + shader.setUniform2i("uDepthFrameSize", kinectDevice.getDepthTex().getWidth(), kinectDevice.getDepthTex().getHeight()); numPoints = kinectDevice.getDepthTex().getWidth() * kinectDevice.getDepthTex().getHeight(); }