Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
237eb386
Commit
237eb386
authored
Nov 07, 2009
by
cornimueller
Browse files
[ADD] GL views are adjusted on window resizes, so the aspect ratio is correct
parent
eba0f635
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
src/graphicsEngine/WGEViewer.cpp
src/graphicsEngine/WGEViewer.cpp
+6
-6
No files found.
src/graphicsEngine/WGEViewer.cpp
View file @
237eb386
...
...
@@ -54,9 +54,11 @@ WGEViewer::WGEViewer( osg::ref_ptr<WindowData> wdata, int x, int y, int width, i
m_View
=
osg
::
ref_ptr
<
osgViewer
::
Viewer
>
(
new
osgViewer
::
Viewer
()
);
m_View
->
getCamera
()
->
setGraphicsContext
(
m_GraphicsContext
);
// m_View->getCamera()->setProjectionMatrixAsPerspective( 30.0f, 1.333, 1.0, 1000.0 );
m_View
->
getCamera
()
->
setProjectionMatrixAsOrtho
(
-
120
,
120
,
-
120
,
120
,
-
1000
,
+
1000
);
m_View
->
getCamera
()
->
setViewport
(
new
osg
::
Viewport
(
0
,
0
,
10
,
10
)
);
// m_View->getCamera()->setProjectionMatrixAsPerspective(
// 30.0, static_cast< double >( width ) / static_cast< double >( height ), 1.0, 1000.0 );
m_View
->
getCamera
()
->
setProjectionMatrixAsOrtho
(
-
120.0
*
width
/
height
,
120.0
*
width
/
height
,
-
120.0
,
120.0
,
-
1000.0
,
+
1000.0
);
m_View
->
getCamera
()
->
setViewport
(
0
,
0
,
width
,
height
);
m_View
->
getCamera
()
->
setProjectionResizePolicy
(
osg
::
Camera
::
HORIZONTAL
);
// add the stats handler
m_View
->
addEventHandler
(
new
osgViewer
::
StatsHandler
);
...
...
@@ -128,9 +130,7 @@ void WGEViewer::resize( int width, int height )
WGEGraphicsWindow
::
resize
(
width
,
height
);
// also update the camera
// m_View->getCamera()->setProjectionMatrixAsPerspective( 30.0f, 1.333, 1.0, 1000.0 );
m_View
->
getCamera
()
->
setProjectionMatrixAsOrtho
(
-
120
,
120
,
-
120
,
120
,
-
1000
,
+
1000
);
m_View
->
getCamera
()
->
setViewport
(
new
osg
::
Viewport
(
0
,
0
,
width
,
height
)
);
m_View
->
getCamera
()
->
setViewport
(
0
,
0
,
width
,
height
);
}
void
WGEViewer
::
close
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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