diff --git a/basegraph.cpp b/basegraph.cpp index d205568e..68f3375b 100644 --- a/basegraph.cpp +++ b/basegraph.cpp @@ -297,8 +297,12 @@ void display_data::set_projection(int ed) { } - if(ed) glhr::projection_multiply(glhr::translate(vid.ipd * ed/2, 0, 0)); - + if(ed) { + if(pers3) + glhr::projection_multiply(glhr::tmtogl(xpush(vid.ipd * ed/2))); + else + glhr::projection_multiply(glhr::translate(vid.ipd * ed/2, 0, 0)); + } if(pers3) { glhr::fog_max(1/sightranges[geometry], darkena(backcolor, 0, 0xFF)); diff --git a/hyper.h b/hyper.h index 84b67b4c..a0a0a169 100644 --- a/hyper.h +++ b/hyper.h @@ -4006,6 +4006,8 @@ namespace glhr { extern shader_projection new_shader_projection; + glmatrix tmtogl(const transmatrix& T); + void set_depthtest(bool b); glmatrix translate(ld x, ld y, ld z); void color2(color_t color, ld scale = 1); diff --git a/shaders.cpp b/shaders.cpp index acd55928..37d3d0b6 100644 --- a/shaders.cpp +++ b/shaders.cpp @@ -82,6 +82,14 @@ glmatrix scale(ld x, ld y, ld z) { return tmp; } +glmatrix tmtogl(const transmatrix& T) { + glmatrix tmp; + for(int i=0; i<4; i++) + for(int j=0; j<4; j++) + tmp[i][j] = T[i][j]; + return tmp; + } + glmatrix ortho(ld x, ld y, ld z) { return scale(1/x, 1/y, 1/z); }