Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Christian Butz
VTK
Commits
e8d8e2ae
Commit
e8d8e2ae
authored
Jul 01, 2011
by
Clinton Stimpson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add code to handle IsDirect() and SupportsOpenGL() in QVTKWidget2.
parent
3f59cbc0
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
67 additions
and
0 deletions
+67
-0
Common/vtkCommand.h
Common/vtkCommand.h
+2
-0
GUISupport/Qt/QVTKGraphicsItem.cxx
GUISupport/Qt/QVTKGraphicsItem.cxx
+17
-0
GUISupport/Qt/QVTKGraphicsItem.h
GUISupport/Qt/QVTKGraphicsItem.h
+4
-0
GUISupport/Qt/QVTKWidget2.cxx
GUISupport/Qt/QVTKWidget2.cxx
+16
-0
GUISupport/Qt/QVTKWidget2.h
GUISupport/Qt/QVTKWidget2.h
+4
-0
Rendering/vtkGenericOpenGLRenderWindow.cxx
Rendering/vtkGenericOpenGLRenderWindow.cxx
+14
-0
Rendering/vtkGenericOpenGLRenderWindow.h
Rendering/vtkGenericOpenGLRenderWindow.h
+10
-0
No files found.
Common/vtkCommand.h
View file @
e8d8e2ae
...
...
@@ -364,6 +364,8 @@ public:
WindowIsCurrentEvent
,
WindowFrameEvent
,
HighlightEvent
,
WindowSupportsOpenGLEvent
,
WindowIsDirectEvent
,
UserEvent
=
1000
};
//ETX
...
...
GUISupport/Qt/QVTKGraphicsItem.cxx
View file @
e8d8e2ae
...
...
@@ -64,6 +64,8 @@ void QVTKGraphicsItem::SetRenderWindow(vtkGenericOpenGLRenderWindow* win)
mConnect
->
Disconnect
(
mWin
,
vtkCommand
::
EndEvent
,
this
,
SLOT
(
End
()));
mConnect
->
Disconnect
(
mWin
,
vtkCommand
::
WindowFrameEvent
,
this
,
SLOT
(
Update
()));
mConnect
->
Disconnect
(
mWin
,
vtkCommand
::
WindowIsCurrentEvent
,
this
,
SLOT
(
IsCurrent
(
vtkObject
*
,
unsigned
long
,
void
*
,
void
*
)));
mConnect
->
Disconnect
(
mWin
,
vtkCommand
::
WindowIsDirectEvent
,
this
,
SLOT
(
IsDirect
(
vtkObject
*
,
unsigned
long
,
void
*
,
void
*
)));
mConnect
->
Disconnect
(
mWin
,
vtkCommand
::
WindowSupportsOpenGLEvent
,
this
,
SLOT
(
SupportsOpenGL
(
vtkObject
*
,
unsigned
long
,
void
*
,
void
*
)));
}
mIren
->
SetRenderWindow
(
win
);
...
...
@@ -83,6 +85,8 @@ void QVTKGraphicsItem::SetRenderWindow(vtkGenericOpenGLRenderWindow* win)
mConnect
->
Connect
(
mWin
,
vtkCommand
::
EndEvent
,
this
,
SLOT
(
End
()));
mConnect
->
Connect
(
mWin
,
vtkCommand
::
WindowFrameEvent
,
this
,
SLOT
(
Update
()));
mConnect
->
Connect
(
mWin
,
vtkCommand
::
WindowIsCurrentEvent
,
this
,
SLOT
(
IsCurrent
(
vtkObject
*
,
unsigned
long
,
void
*
,
void
*
)));
mConnect
->
Connect
(
mWin
,
vtkCommand
::
WindowIsDirectEvent
,
this
,
SLOT
(
IsDirect
(
vtkObject
*
,
unsigned
long
,
void
*
,
void
*
)));
mConnect
->
Connect
(
mWin
,
vtkCommand
::
WindowSupportsOpenGLEvent
,
this
,
SLOT
(
SupportsOpenGL
(
vtkObject
*
,
unsigned
long
,
void
*
,
void
*
)));
}
}
...
...
@@ -155,6 +159,19 @@ void QVTKGraphicsItem::IsCurrent(vtkObject*, unsigned long, void*, void* call_da
}
}
void
QVTKGraphicsItem
::
IsDirect
(
vtkObject
*
,
unsigned
long
,
void
*
,
void
*
call_data
)
{
int
*
ptr
=
reinterpret_cast
<
int
*>
(
call_data
);
*
ptr
=
1
;
}
void
QVTKGraphicsItem
::
SupportsOpenGL
(
vtkObject
*
,
unsigned
long
,
void
*
,
void
*
call_data
)
{
int
*
ptr
=
reinterpret_cast
<
int
*>
(
call_data
);
*
ptr
=
QGLFormat
::
hasOpenGL
();
}
#if QT_VERSION >= 0x040600
void
QVTKGraphicsItem
::
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
,
QWidget
*
)
#else
...
...
GUISupport/Qt/QVTKGraphicsItem.h
View file @
e8d8e2ae
...
...
@@ -76,6 +76,10 @@ class QVTK_EXPORT QVTKGraphicsItem : public QGraphicsWidget
virtual
void
End
();
// slot called when vtk wants to know if the context is current
virtual
void
IsCurrent
(
vtkObject
*
caller
,
unsigned
long
vtk_event
,
void
*
client_data
,
void
*
call_data
);
// slot called when vtk wants to know if a window is direct
virtual
void
IsDirect
(
vtkObject
*
caller
,
unsigned
long
vtk_event
,
void
*
client_data
,
void
*
call_data
);
// slot called when vtk wants to know if a window supports OpenGL
virtual
void
SupportsOpenGL
(
vtkObject
*
caller
,
unsigned
long
vtk_event
,
void
*
client_data
,
void
*
call_data
);
protected:
...
...
GUISupport/Qt/QVTKWidget2.cxx
View file @
e8d8e2ae
...
...
@@ -139,6 +139,8 @@ void QVTKWidget2::SetRenderWindow(vtkGenericOpenGLRenderWindow* w)
mConnect
->
Disconnect
(
mRenWin
,
vtkCommand
::
WindowFrameEvent
,
this
,
SLOT
(
Frame
()));
mConnect
->
Disconnect
(
mRenWin
,
vtkCommand
::
StartEvent
,
this
,
SLOT
(
Start
()));
mConnect
->
Disconnect
(
mRenWin
,
vtkCommand
::
EndEvent
,
this
,
SLOT
(
End
()));
mConnect
->
Disconnect
(
mRenWin
,
vtkCommand
::
WindowIsDirectEvent
,
this
,
SLOT
(
IsDirect
(
vtkObject
*
,
unsigned
long
,
void
*
,
void
*
)));
mConnect
->
Disconnect
(
mRenWin
,
vtkCommand
::
WindowSupportsOpenGLEvent
,
this
,
SLOT
(
SupportsOpenGL
(
vtkObject
*
,
unsigned
long
,
void
*
,
void
*
)));
}
// now set the window
...
...
@@ -178,6 +180,8 @@ void QVTKWidget2::SetRenderWindow(vtkGenericOpenGLRenderWindow* w)
mConnect
->
Connect
(
mRenWin
,
vtkCommand
::
WindowFrameEvent
,
this
,
SLOT
(
Frame
()));
mConnect
->
Connect
(
mRenWin
,
vtkCommand
::
StartEvent
,
this
,
SLOT
(
Start
()));
mConnect
->
Connect
(
mRenWin
,
vtkCommand
::
EndEvent
,
this
,
SLOT
(
End
()));
mConnect
->
Connect
(
mRenWin
,
vtkCommand
::
WindowIsDirectEvent
,
this
,
SLOT
(
IsDirect
(
vtkObject
*
,
unsigned
long
,
void
*
,
void
*
)));
mConnect
->
Connect
(
mRenWin
,
vtkCommand
::
WindowSupportsOpenGLEvent
,
this
,
SLOT
(
SupportsOpenGL
(
vtkObject
*
,
unsigned
long
,
void
*
,
void
*
)));
}
}
...
...
@@ -412,6 +416,18 @@ void QVTKWidget2::IsCurrent(vtkObject*, unsigned long, void*, void* call_data)
*
ptr
=
QGLContext
::
currentContext
()
==
this
->
context
();
}
void
QVTKWidget2
::
IsDirect
(
vtkObject
*
,
unsigned
long
,
void
*
,
void
*
call_data
)
{
int
*
ptr
=
reinterpret_cast
<
int
*>
(
call_data
);
*
ptr
=
this
->
context
()
->
format
().
directRendering
();
}
void
QVTKWidget2
::
SupportsOpenGL
(
vtkObject
*
,
unsigned
long
,
void
*
,
void
*
call_data
)
{
int
*
ptr
=
reinterpret_cast
<
int
*>
(
call_data
);
*
ptr
=
QGLFormat
::
hasOpenGL
();
}
void
QVTKWidget2
::
Frame
()
{
if
(
mRenWin
->
GetSwapBuffers
())
...
...
GUISupport/Qt/QVTKWidget2.h
View file @
e8d8e2ae
...
...
@@ -88,6 +88,10 @@ protected Q_SLOTS:
virtual
void
Start
();
// slot called when vtk wants to end the render
virtual
void
End
();
// slot called when vtk wants to know if a window is direct
virtual
void
IsDirect
(
vtkObject
*
caller
,
unsigned
long
vtk_event
,
void
*
client_data
,
void
*
call_data
);
// slot called when vtk wants to know if a window supports OpenGL
virtual
void
SupportsOpenGL
(
vtkObject
*
caller
,
unsigned
long
vtk_event
,
void
*
client_data
,
void
*
call_data
);
protected:
// overloaded resize handler
...
...
Rendering/vtkGenericOpenGLRenderWindow.cxx
View file @
e8d8e2ae
...
...
@@ -107,6 +107,20 @@ bool vtkGenericOpenGLRenderWindow::IsCurrent()
return
current
;
}
int
vtkGenericOpenGLRenderWindow
::
SupportsOpenGL
()
{
int
supports_ogl
=
0
;
this
->
InvokeEvent
(
vtkCommand
::
WindowSupportsOpenGLEvent
,
&
supports_ogl
);
return
supports_ogl
;
}
int
vtkGenericOpenGLRenderWindow
::
IsDirect
()
{
int
is_direct
=
0
;
this
->
InvokeEvent
(
vtkCommand
::
WindowIsDirectEvent
,
&
is_direct
);
return
is_direct
;
}
void
vtkGenericOpenGLRenderWindow
::
PushState
()
{
glPushClientAttrib
(
GL_CLIENT_ALL_ATTRIB_BITS
);
...
...
Rendering/vtkGenericOpenGLRenderWindow.h
View file @
e8d8e2ae
...
...
@@ -53,6 +53,16 @@ public:
//! responsibility to watch for WindowIsCurrentEvent and set the bool* flag
//! passed through the call data parameter.
bool
IsCurrent
();
//! Returns if OpenGL is supported. It is the class user's
//! responsibility to watch for WindowSupportsOpenGLEvent and set the int* flag
//! passed through the call data parameter.
int
SupportsOpenGL
();
//! Returns if the context is direct. It is the class user's
//! responsibility to watch for WindowIsDirectEvent and set the int* flag
//! passed through the call data parameter.
int
IsDirect
();
// {@
//! set the drawing buffers to use
...
...
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