Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Ken Martin
VTK
Commits
3784f6d0
Commit
3784f6d0
authored
Feb 27, 2012
by
Clinton Stimpson
Browse files
Fix issue with context timestamp when using QVTKWidget2.
Change-Id: Ic5bc394e6cbe3d9ab8bedf1809af72912aa94411
parent
c3f21735
Changes
6
Hide whitespace changes
Inline
Side-by-side
Examples/GUI/Qt/GraphicsView/GraphicsView.hpp
View file @
3784f6d0
...
...
@@ -44,6 +44,7 @@ class GraphicsView : public QGraphicsView
p
->
beginNativePainting
();
#endif
mWidget
->
GetRenderWindow
()
->
PushState
();
mWidget
->
GetRenderWindow
()
->
OpenGLInitState
();
mWidget
->
GetRenderWindow
()
->
Render
();
mWidget
->
GetRenderWindow
()
->
PopState
();
#if QT_VERSION >= 0x040600
...
...
GUISupport/Qt/QVTKGraphicsItem.cxx
View file @
3784f6d0
...
...
@@ -137,7 +137,7 @@ void QVTKGraphicsItem::Start()
}
mWin
->
PushState
();
mWin
->
OpenGLInit
();
mWin
->
OpenGLInit
State
();
}
void
QVTKGraphicsItem
::
End
()
...
...
GUISupport/Qt/QVTKWidget2.cxx
View file @
3784f6d0
...
...
@@ -202,7 +202,7 @@ void QVTKWidget2::Start()
{
makeCurrent
();
mRenWin
->
PushState
();
mRenWin
->
OpenGLInit
();
mRenWin
->
OpenGLInit
State
();
}
void
QVTKWidget2
::
End
()
...
...
@@ -210,6 +210,15 @@ void QVTKWidget2::End()
mRenWin
->
PopState
();
}
void
QVTKWidget2
::
initializeGL
()
{
if
(
!
this
->
mRenWin
)
{
return
;
}
this
->
mRenWin
->
OpenGLInitContext
();
}
/*! handle resize event
*/
void
QVTKWidget2
::
resizeGL
(
int
w
,
int
h
)
...
...
GUISupport/Qt/QVTKWidget2.h
View file @
3784f6d0
...
...
@@ -99,6 +99,8 @@ protected Q_SLOTS:
virtual
void
SupportsOpenGL
(
vtkObject
*
caller
,
unsigned
long
vtk_event
,
void
*
client_data
,
void
*
call_data
);
protected:
// overloaded initialize handler
virtual
void
initializeGL
();
// overloaded resize handler
virtual
void
resizeGL
(
int
,
int
);
// overloaded paint handler
...
...
Rendering/vtkOpenGLRenderWindow.cxx
View file @
3784f6d0
...
...
@@ -238,38 +238,18 @@ void vtkOpenGLRenderWindow::StereoUpdate(void)
void
vtkOpenGLRenderWindow
::
OpenGLInit
()
{
// When a new OpenGL context is created, force an update
// of the extension manager by calling modified on it.
vtkOpenGLExtensionManager
*
extensions
=
this
->
GetExtensionManager
();
extensions
->
Modified
();
OpenGLInitContext
();
OpenGLInitState
();
}
this
->
ContextCreationTime
.
Modified
();
void
vtkOpenGLRenderWindow
::
OpenGLInitState
()
{
glMatrixMode
(
GL_MODELVIEW
);
glDepthFunc
(
GL_LEQUAL
);
glEnable
(
GL_DEPTH_TEST
);
glTexEnvf
(
GL_TEXTURE_ENV
,
GL_TEXTURE_ENV_MODE
,
GL_MODULATE
);
// initialize blending for transparency
// We have to set the function pointer to null, otherwise the following
// scenario would fail on Windows (and maybe other kind of configurations):
// 1. Render onscreen on GPU that supports OpenGL 1.4
// 2. Switch to offscreen with GDI Windows implementation (1.1)
vtkgl
::
BlendFuncSeparate
=
0
;
// Try to initialize vtkgl::BlendFuncSeparate() if available.
if
(
extensions
->
ExtensionSupported
(
"GL_VERSION_1_4"
))
{
extensions
->
LoadExtension
(
"GL_VERSION_1_4"
);
}
else
{
if
(
extensions
->
ExtensionSupported
(
"GL_EXT_blend_func_separate"
))
{
extensions
->
LoadCorePromotedExtension
(
"GL_EXT_blend_func_separate"
);
}
}
if
(
vtkgl
::
BlendFuncSeparate
!=
0
)
{
vtkgl
::
BlendFuncSeparate
(
GL_SRC_ALPHA
,
GL_ONE_MINUS_SRC_ALPHA
,
...
...
@@ -323,6 +303,34 @@ void vtkOpenGLRenderWindow::OpenGLInit()
glPixelStorei
(
GL_PACK_ALIGNMENT
,
1
);
}
void
vtkOpenGLRenderWindow
::
OpenGLInitContext
()
{
// When a new OpenGL context is created, force an update
// of the extension manager by calling modified on it.
vtkOpenGLExtensionManager
*
extensions
=
this
->
GetExtensionManager
();
extensions
->
Modified
();
this
->
ContextCreationTime
.
Modified
();
// We have to set the function pointer to null, otherwise the following
// scenario would fail on Windows (and maybe other kind of configurations):
// 1. Render onscreen on GPU that supports OpenGL 1.4
// 2. Switch to offscreen with GDI Windows implementation (1.1)
vtkgl
::
BlendFuncSeparate
=
0
;
// Try to initialize vtkgl::BlendFuncSeparate() if available.
if
(
extensions
->
ExtensionSupported
(
"GL_VERSION_1_4"
))
{
extensions
->
LoadExtension
(
"GL_VERSION_1_4"
);
}
else
{
if
(
extensions
->
ExtensionSupported
(
"GL_EXT_blend_func_separate"
))
{
extensions
->
LoadCorePromotedExtension
(
"GL_EXT_blend_func_separate"
);
}
}
}
void
vtkOpenGLRenderWindow
::
PrintSelf
(
ostream
&
os
,
vtkIndent
indent
)
{
...
...
Rendering/vtkOpenGLRenderWindow.h
View file @
3784f6d0
...
...
@@ -107,6 +107,12 @@ public:
// Initialize OpenGL for this window.
virtual
void
OpenGLInit
();
// Initialize the state of OpenGL that VTK wants for this window
virtual
void
OpenGLInitState
();
// Initialize VTK for rendering in a new OpenGL context
virtual
void
OpenGLInitContext
();
// Description:
// Return the OpenGL name of the back left buffer.
// It is GL_BACK_LEFT if GL is bound to the window-system-provided
...
...
Write
Preview
Supports
Markdown
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