diff --git a/openglcanvas.cpp b/openglcanvas.cpp index 16097fa71db18a8d8e60d8eee2b4ec72526ef03b..4c9a865a2b7cc2479502a68127b324b1aaf08185 100644 --- a/openglcanvas.cpp +++ b/openglcanvas.cpp @@ -522,6 +522,15 @@ void OpenGLCanvas::vertex_transformation(float *positions, int m, int n, float c positions[3*(j+i*n)+1] = v/extent; positions[3*(j+i*n)+2] = z; } + + if (visualization=="Orthographic"){ + u = x; + v = y; + positions[3*(j+i*n)] = u/extent; + positions[3*(j+i*n)+1] = v/extent; + positions[3*(j+i*n)+2] = z; + } + } } @@ -598,6 +607,14 @@ float OpenGLCanvas::calculate_extent(float fov_rads){ u = x/(-z); v = y/(-z); } + if (visualization=="Orthographic"){ + if(z<0.){ + u=x; + v=y; + }else{ + u=v=1.f; + } + } return u; } @@ -789,6 +806,7 @@ void OpenGLCanvas::paintGL(){ else if (visualization=="Stereographic") vis_mode=4.0; else if (visualization=="Mercator") vis_mode=5.0; else if (visualization=="Zorin-Barr") vis_mode=6.0; + else if (visualization=="Orthographic") vis_mode=7.0; glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0.0, 2.0/extent, 0.0, 2.0/scale, 0.0, -2.0/vis_mode); diff --git a/panowindow1.ui b/panowindow1.ui index aec84ac8e473a00cf9c4c928b66c149b38976d56..e2164dfbeca7b9721eb5d1cfe69a14258ef8c876 100644 --- a/panowindow1.ui +++ b/panowindow1.ui @@ -207,6 +207,11 @@ Zorin-Barr + + + Orthographic + + diff --git a/shaders/vertex_shader.vert b/shaders/vertex_shader.vert index 964f1c388e7cf80d81c05e9c2285605c7aee1c92..daa99b838e5e1e8154b58fd7db88f3c5dd766053 100644 --- a/shaders/vertex_shader.vert +++ b/shaders/vertex_shader.vert @@ -92,6 +92,11 @@ void main(void){ v=zbrho*sin(zbalpha); gl_Position = vec4(u/extent,v/extent,z,1.0); } + else if (vis_mode==7.0){ // Orthographic + u=x; + v=y; + gl_Position = vec4(u/extent,v/extent,z,1.0); + } // gl_Position = vec4(u/2.0,v/2.0,z,1.0);