From f605fddfdfb36931ddd2646521eedddbb684213e Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Tue, 17 Mar 2015 19:38:50 +0100 Subject: aspect ratio fix, disable grid --- client2.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/client2.cpp b/client2.cpp index e82c3bf..7083a7a 100644 --- a/client2.cpp +++ b/client2.cpp @@ -93,9 +93,9 @@ const char* drawOnCanvasFragmentSource = //" outColor = vec4(point_in_cam_pic/vec2(CAM_XRES,CAM_YRES),-point_in_cam_pic_uniform.z/1000,1);\n" " else\n" " outColor = vec4(0.0,0.0,0.0,0.00);" - " float xxx = Texcoord.x/3.141592654*180/10+100;" - " float yyy = Texcoord.y/3.141592654*180/10+100;" - " if ( (abs(xxx- int(xxx)) < 0.03) || (abs(yyy- int(yyy)) <.03)) outColor = vec4(0.5,0.5,0.5,1);" + //" float xxx = Texcoord.x/3.141592654*180/10+100;" + //" float yyy = Texcoord.y/3.141592654*180/10+100;" + //" if ( (abs(xxx- int(xxx)) < 0.03) || (abs(yyy- int(yyy)) <.03)) outColor = vec4(0.5,0.5,0.5,1);" "}\n"; @@ -105,7 +105,7 @@ const char* drawFromCanvasFragmentSource = "uniform float eye_yaw;\n" "uniform float eye_pitch;\n" "uniform float eye_roll;\n" - "const float aspect_ratio=1280./720.;\n" + "const float aspect_ratio=1280./2/720.;\n" "const float horiz_field_of_view=60/180.*3.141592654;\n" "const float CAM_FX=1/2.0 / tan(horiz_field_of_view/2.0);\n" "const mat3 eye_cal_inv = transpose(mat3(1/CAM_FX, 0, -1/2/CAM_FX, 0, 1/CAM_FX, -1/aspect_ratio/2/CAM_FX, 0,0,1));\n" @@ -151,10 +151,11 @@ const char* oculusFragmentSource = "uniform sampler2D texVideo;\n" "in vec2 Screencoord;\n" "out vec4 outColor;\n" - "const vec2 LeftLensCenter = vec2(0.2, 0.);\n" - "const vec2 RightLensCenter = vec2(-0.2, 0.);\n" + "const vec2 LeftLensCenter = vec2(0, 0.);\n" + "const vec2 RightLensCenter = vec2(-0, 0.);\n" //"const vec4 HmdWarpParam = vec4(1, 0, 0, 0);\n" - "const vec4 HmdWarpParam = vec4(1, 0.2, 0.1, 0);\n" + "const vec4 HmdWarpParam = vec4(1, 0.2, 0.1, 0)*0.78;\n" + //"const vec4 HmdWarpParam = vec4(1, 0., 0., 0);\n" "const float aberr_r = 0.99;\n" "const float aberr_b = 1.01;\n" // "const float aberr_r = 0.97;\n" @@ -165,8 +166,9 @@ const char* oculusFragmentSource = "{\n" " vec2 LensCenter = Screencoord.x < 0 ? LeftLensCenter : RightLensCenter;\n" " float x = (Screencoord.x > 0? Screencoord.x : (Screencoord.x+1))*2 -1;\n" // between -1 and 1 - " float y = (Screencoord.y)/2.5*4.;\n" + " float y = (Screencoord.y);\n" " vec2 theta = (vec2(x,y) - LensCenter);\n" +// " theta=theta/2;\n" " float rSq = theta.x*theta.x+theta.y*theta.y;\n" " vec2 rvector = theta * (HmdWarpParam.x + HmdWarpParam.y * rSq +" " HmdWarpParam.z * rSq * rSq + HmdWarpParam.w * rSq * rSq * rSq);\n" -- cgit v1.2.1