Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Luis Penaranda
panoramic
Commits
dade31c1
Commit
dade31c1
authored
Sep 04, 2013
by
Luis Penaranda
Browse files
added orthographic projection
parent
44ec9b4f
Changes
3
Hide whitespace changes
Inline
Side-by-side
openglcanvas.cpp
View file @
dade31c1
...
...
@@ -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
);
...
...
panowindow1.ui
View file @
dade31c1
...
...
@@ -207,6 +207,11 @@
<string>
Zorin-Barr
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
Orthographic
</string>
</property>
</item>
</widget>
</item>
<item
row=
"12"
column=
"1"
>
...
...
shaders/vertex_shader.vert
View file @
dade31c1
...
...
@@ -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);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment