point cloud and bound!
This commit is contained in:
parent
2351068572
commit
8adda60cab
5 changed files with 29 additions and 22 deletions
|
@ -99,7 +99,7 @@ void main() {
|
||||||
dispColor.rgb = vec3(1);
|
dispColor.rgb = vec3(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// color.r = 1.;
|
// dispColor.rgb = vec3(depthToSilhouette(texture2D(u_depth, st/u_resolution).r));
|
||||||
gl_FragColor = vec4(dispColor, 1.0);
|
gl_FragColor = vec4(dispColor, 1.0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
#version 150
|
#ifdef GL_ES
|
||||||
|
precision mediump float;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Custom attributes.
|
// Custom attributes.
|
||||||
|
|
||||||
uniform sampler2DRect uColorTex; // Sampler for the color registered data
|
uniform sampler2D uColorTex; // Sampler for the color registered data
|
||||||
|
|
||||||
in vec2 gTexCoord;
|
in vec2 gTexCoord;
|
||||||
|
|
||||||
out vec4 fragColor;
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
fragColor = texture(uColorTex, gTexCoord);
|
gl_FragColor = texture2D(uColorTex, gTexCoord);
|
||||||
}
|
}
|
|
@ -1,4 +1,6 @@
|
||||||
#version 150
|
#ifdef GL_ES
|
||||||
|
precision mediump float;
|
||||||
|
#endif
|
||||||
|
|
||||||
layout (points) in;
|
layout (points) in;
|
||||||
layout (triangle_strip) out;
|
layout (triangle_strip) out;
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
#version 150
|
#ifdef GL_ES
|
||||||
|
precision mediump float;
|
||||||
|
#endif
|
||||||
|
|
||||||
// OF built-in attributes.
|
// OF built-in attributes.
|
||||||
|
|
||||||
|
@ -6,21 +8,23 @@ uniform mat4 modelViewMatrix;
|
||||||
|
|
||||||
// Custom attributes.
|
// Custom attributes.
|
||||||
|
|
||||||
uniform sampler2DRect uDepthTex; // Sampler for the depth space data
|
uniform sampler2D uDepthTex; // Sampler for the depth space data
|
||||||
uniform sampler2DRect uWorldTex; // Transformation from kinect depth/color space to kinect world space
|
uniform sampler2D uWorldTex; // Transformation from kinect depth/color space to kinect world space
|
||||||
|
|
||||||
uniform ivec2 uFrameSize;
|
uniform ivec2 uFrameSize;
|
||||||
|
|
||||||
|
uniform vec2 u_resolution;
|
||||||
|
|
||||||
out vec4 vPosition;
|
out vec4 vPosition;
|
||||||
out vec2 vTexCoord;
|
out vec2 vTexCoord;
|
||||||
flat out int vValid;
|
flat out int vValid;
|
||||||
|
|
||||||
void main()
|
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;
|
float depth = texture2D(uDepthTex, vTexCoord).x;
|
||||||
vec4 ray = texture(uWorldTex, vTexCoord);
|
vec4 ray = texture2D(uWorldTex, vTexCoord);
|
||||||
|
|
||||||
vValid = (depth != 0 && ray.x != 0 && ray.y != 0) ? 1 : 0;
|
vValid = (depth != 0 && ray.x != 0 && ray.y != 0) ? 1 : 0;
|
||||||
|
|
||||||
|
|
|
@ -20,15 +20,16 @@ void ofApp::setup()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load shader.
|
// Load shader.
|
||||||
auto shaderSettings = ofShaderSettings();
|
// auto shaderSettings = ofShaderSettings();
|
||||||
shaderSettings.shaderFiles[GL_VERTEX_SHADER] = "shaders/render.vert";
|
// shaderSettings.shaderFiles[GL_VERTEX_SHADER] = "shaders/render.vert";
|
||||||
shaderSettings.shaderFiles[GL_GEOMETRY_SHADER] = "shaders/render.geom";
|
// shaderSettings.shaderFiles[GL_GEOMETRY_SHADER] = "shaders/render.geom";
|
||||||
shaderSettings.shaderFiles[GL_FRAGMENT_SHADER] = "shaders/render.frag";
|
// shaderSettings.shaderFiles[GL_FRAGMENT_SHADER] = "shaders/render.frag";
|
||||||
shaderSettings.bindDefaults = true;
|
// shaderSettings.bindDefaults = true;
|
||||||
if (shader.setup(shaderSettings))
|
// if (shader.setup(shaderSettings))
|
||||||
{
|
// {
|
||||||
ofLogNotice(__FUNCTION__) << "Success loading shader!";
|
// ofLogNotice(__FUNCTION__) << "Success loading shader!";
|
||||||
}
|
// }
|
||||||
|
shader.load("shaders/render.vert", "shaders/render.frag", "shaders/render.geom");
|
||||||
|
|
||||||
// Setup vbo.
|
// Setup vbo.
|
||||||
std::vector<glm::vec3> verts(1);
|
std::vector<glm::vec3> verts(1);
|
||||||
|
|
Loading…
Reference in a new issue