Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
0d12fb03
Commit
0d12fb03
authored
Jan 18, 2014
by
Anatoly Baksheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implemented workaround of a problem with x-server for ubuntu
parent
7410593d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
12 deletions
+32
-12
precomp.hpp
modules/viz/src/precomp.hpp
+1
-0
vizimpl.cpp
modules/viz/src/vizimpl.cpp
+29
-12
vizimpl.hpp
modules/viz/src/vizimpl.hpp
+2
-0
No files found.
modules/viz/src/precomp.hpp
View file @
0d12fb03
...
...
@@ -51,6 +51,7 @@
#include <list>
#include <vector>
#include <iomanip>
#include <limits>
#include <vtkAppendPolyData.h>
#include <vtkAssemblyPath.h>
...
...
modules/viz/src/vizimpl.cpp
View file @
0d12fb03
...
...
@@ -45,24 +45,18 @@
#include "precomp.hpp"
/////////////////////////////////////////////////////////////////////////////////////////////
cv
::
viz
::
Viz3d
::
VizImpl
::
VizImpl
(
const
String
&
name
)
:
spin_once_state_
(
false
),
widget_actor_map_
(
new
WidgetActorMap
)
cv
::
viz
::
Viz3d
::
VizImpl
::
VizImpl
(
const
String
&
name
)
:
spin_once_state_
(
false
),
window_position_
(
Vec2i
(
std
::
numeric_limits
<
int
>::
min
())),
widget_actor_map_
(
new
WidgetActorMap
)
{
renderer_
=
vtkSmartPointer
<
vtkRenderer
>::
New
();
window_name_
=
VizStorage
::
generateWindowName
(
name
);
// Create render window
window_
=
vtkSmartPointer
<
vtkRenderWindow
>::
New
();
window_name_
=
VizStorage
::
generateWindowName
(
name
);
cv
::
Vec2i
window_size
=
cv
::
Vec2i
(
window_
->
GetScreenSize
())
/
2
;
window_
->
SetSize
(
window_size
.
val
);
window_
->
AddRenderer
(
renderer_
);
window_
->
AlphaBitPlanesOff
();
window_
->
PointSmoothingOff
();
window_
->
LineSmoothingOff
();
window_
->
PolygonSmoothingOff
();
window_
->
SwapBuffersOn
();
window_
->
SetStereoTypeToAnaglyph
();
// Create the interactor style
style_
=
vtkSmartPointer
<
InteractorStyle
>::
New
();
...
...
@@ -111,9 +105,32 @@ void cv::viz::Viz3d::VizImpl::close()
interactor_
->
TerminateApp
();
// This tends to close the window...
}
void
cv
::
viz
::
Viz3d
::
VizImpl
::
recreateRenderWindow
()
{
//recreating is workaround for Ubuntu -- a crash in x-server
Vec2i
window_size
(
window_
->
GetSize
());
int
fullscreen
=
window_
->
GetFullScreen
();
window_
=
vtkSmartPointer
<
vtkRenderWindow
>::
New
();
if
(
window_position_
[
0
]
!=
std
::
numeric_limits
<
int
>::
min
())
//also workaround
window_
->
SetPosition
(
window_position_
.
val
);
window_
->
SetSize
(
window_size
.
val
);
window_
->
SetFullScreen
(
fullscreen
);
window_
->
AddRenderer
(
renderer_
);
window_
->
AlphaBitPlanesOff
();
window_
->
PointSmoothingOff
();
window_
->
LineSmoothingOff
();
window_
->
PolygonSmoothingOff
();
window_
->
SwapBuffersOn
();
window_
->
SetStereoTypeToAnaglyph
();
}
/////////////////////////////////////////////////////////////////////////////////////////////
void
cv
::
viz
::
Viz3d
::
VizImpl
::
spin
()
{
recreateRenderWindow
();
interactor_
=
vtkSmartPointer
<
vtkRenderWindowInteractor
>::
New
();
interactor_
->
SetRenderWindow
(
window_
);
interactor_
->
SetInteractorStyle
(
style_
);
...
...
@@ -129,6 +146,7 @@ void cv::viz::Viz3d::VizImpl::spinOnce(int time, bool force_redraw)
if
(
interactor_
==
0
)
{
spin_once_state_
=
true
;
recreateRenderWindow
();
interactor_
=
vtkSmartPointer
<
vtkRenderWindowInteractor
>::
New
();
interactor_
->
SetRenderWindow
(
window_
);
interactor_
->
SetInteractorStyle
(
style_
);
...
...
@@ -400,7 +418,6 @@ void cv::viz::Viz3d::VizImpl::setViewerPose(const Affine3d &pose)
camera
.
SetViewUp
(
up_vec
.
val
);
renderer_
->
ResetCameraClippingRange
();
renderer_
->
Render
();
}
/////////////////////////////////////////////////////////////////////////////////////////////
...
...
@@ -510,6 +527,6 @@ void cv::viz::Viz3d::VizImpl::setRepresentation(int representation)
//////////////////////////////////////////////////////////////////////////////////////////////
cv
::
String
cv
::
viz
::
Viz3d
::
VizImpl
::
getWindowName
()
const
{
return
window_name_
;
}
void
cv
::
viz
::
Viz3d
::
VizImpl
::
setFullScreen
(
bool
mode
)
{
window_
->
SetFullScreen
(
mode
);
}
void
cv
::
viz
::
Viz3d
::
VizImpl
::
setWindowPosition
(
const
Point
&
position
)
{
window_
->
SetPosition
(
position
.
x
,
position
.
y
);
}
void
cv
::
viz
::
Viz3d
::
VizImpl
::
setWindowPosition
(
const
Point
&
position
)
{
window_
position_
=
position
;
window_
->
SetPosition
(
position
.
x
,
position
.
y
);
}
void
cv
::
viz
::
Viz3d
::
VizImpl
::
setWindowSize
(
const
Size
&
window_size
)
{
window_
->
SetSize
(
window_size
.
width
,
window_size
.
height
);
}
cv
::
Size
cv
::
viz
::
Viz3d
::
VizImpl
::
getWindowSize
()
const
{
return
Size
(
Point
(
Vec2i
(
window_
->
GetSize
())));
}
modules/viz/src/vizimpl.hpp
View file @
0d12fb03
...
...
@@ -122,6 +122,7 @@ private:
vtkSmartPointer
<
vtkRenderWindow
>
window_
;
String
window_name_
;
Vec2i
window_position_
;
vtkSmartPointer
<
TimerCallback
>
timer_callback_
;
vtkSmartPointer
<
ExitCallback
>
exit_callback_
;
...
...
@@ -131,6 +132,7 @@ private:
Ptr
<
WidgetActorMap
>
widget_actor_map_
;
bool
removeActorFromRenderer
(
vtkSmartPointer
<
vtkProp
>
actor
);
void
recreateRenderWindow
();
};
#endif
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