Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

example shaders fixed

  • Loading branch information...
commit 07b47311126927a1b78f62306f876b1139c6e2d8 1 parent 6192df2
James George authored
7 example-sceneWithTimeline/bin/data/shaders/unproject.frag
View
@@ -5,7 +5,12 @@ uniform sampler2DRect tex0;
varying float VZPositionValid0;
void main()
{
+ if(VZPositionValid0 < 0.999){
+ discard;
+ }
+
vec4 col = texture2DRect(tex0, gl_TexCoord[0].st);
gl_FragColor = col * gl_Color;
-
+ //gl_FragColor = vec4(VZPositionValid0, 0.0, 0.0, 1.0);
+
}
53 example-sceneWithTimeline/bin/data/shaders/unproject.vert
View
@@ -3,7 +3,7 @@
uniform vec2 dim;
uniform vec2 fudge;
-uniform sampler2DRect depthTexture;
+//uniform sampler2DRect depthTexture;
uniform vec2 principalPoint;
uniform vec2 imageSize;
uniform vec2 fov;
@@ -12,34 +12,27 @@ uniform float farClip;
varying float VZPositionValid0;
void main(void)
{
+
+// float depthValue = texture2DRect(tex0, gl_TexCoord[0].st);
+ VZPositionValid0 = (gl_Vertex.z < farClip && gl_Vertex.z > 200.) ? 1.0 : 0.0;
+
+ vec4 pos = vec4( ((gl_Vertex.x - principalPoint.x) / imageSize.x) * gl_Vertex.z * fov.x,
+ ((gl_Vertex.y - principalPoint.y) / imageSize.y) * gl_Vertex.z * fov.y,
+ gl_Vertex.z, 1.0);
+
+ //projective texture on the
+ gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * pos;
+ gl_FrontColor = gl_Color;
+
+ mat4 tTex = gl_TextureMatrix[0];
+ vec4 texCd = tTex * pos;
+ texCd.xyz /= texCd.w;
+
+ texCd.xy *= -1.;
+ texCd.xy += 1.;
+ texCd.xy /= 2.;
+ texCd.xy += fudge;
- // float depthValue = texture2DRect(tex0, gl_TexCoord[0].st);
- if(gl_Vertex.z < farClip && gl_Vertex.z > 200.){
- vec4 pos = vec4( ((gl_Vertex.x - principalPoint.x) / imageSize.x) * gl_Vertex.z * fov.x,
- ((gl_Vertex.y - principalPoint.y) / imageSize.y) * gl_Vertex.z * fov.y,
- gl_Vertex.z, 1.0);
-
- //projective texture on the
- gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * pos;
- gl_FrontColor = gl_Color;
-
- mat4 tTex = gl_TextureMatrix[0];
- //vec4 texCd = tTex * gl_Vertex;
- vec4 texCd = tTex * pos;
- texCd.xyz /= texCd.w;
-
- texCd.xy *= -1.;
- texCd.xy += 1.;
- texCd.xy /= 2.;
- texCd.xy += fudge;
-
- texCd.xy *= dim;
- gl_TexCoord[0] = texCd;
- VZPositionValid0 = 1.;
- }
- else {
- gl_FrontColor = vec4(0.0);
- gl_Position = vec4(0.0);
- VZPositionValid0 = 0.;
- }
+ texCd.xy *= dim;
+ gl_TexCoord[0] = texCd;
}
3  gui/ofxRGBDCaptureGui.cpp
View
@@ -8,7 +8,6 @@
//TODO: threaded alignment generation
//TODO: feedback when alignment is saved
//TODO: feedback when alignment is dirty
-//TODO: fix coloring with red/white checkerboards
//TOOD: add in previews for selected objects
#include "ofxRGBDCaptureGui.h"
@@ -116,7 +115,7 @@ void ofxRGBDCaptureGui::setup(){
timeline.setLoopType(OF_LOOP_NORMAL);
depthSequence.setup();
-
+
ofxXmlSettings defaults;
if(defaults.loadFile("defaults.xml")){
loadDirectory(defaults.getValue("currentDir", ""));
Please sign in to comment.
Something went wrong with that request. Please try again.