[prev in list] [next in list] [prev in thread] [next in thread] 

List:       vtk-developers
Subject:    Re: [vtk-developers] [vtkusers] VTK 6.3/OGL2/Qt5.3.2 : QVTKWidget regression, crash after "reparenti
From:       Simon ESNEAULT <simon.esneault () gmail ! com>
Date:       2015-11-19 9:12:53
Message-ID: CAC9gB0C5=W=HP5ej78CdcQ62G389MQC=oDfEOpL8e4M9bhPeTA () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hello Ken,

I've created a merge request here :
https://gitlab.kitware.com/vtk/vtk/merge_requests/925

Can you review it and eventually allow it to master if it is the correct
fix ?
I've also added Sean McBride as a reviewer.

Thanks
Simon

2015-11-18 17:42 GMT+01:00 Ken Martin <ken.martin@kitware.com>:

> Yes, if some process is causing the opengl context to be destroyed then we
> need to release the graphics resources tied to the old context. Sounds like
> that is the case here and the cocoa window was missing it.
> 
> On Wed, Nov 18, 2015 at 11:36 AM, Simon ESNEAULT <simon.esneault@gmail.com
> > wrote:
> 
> > Hello Ken,
> > 
> > A colleague has just found a solution that prevent the crash. Here is the
> > patch:
> > 
> > 
> > //----------------------------------------------------------------------------
> > 
> > --- VTK/Rendering/OpenGL2/vtkCocoaRenderWindow.mm Wed Nov 18 17:25:01
> > 2015
> > +++ VTK/Rendering/OpenGL2/vtkCocoaRenderWindow.mm Wed Nov 18 17:29:12
> > 2015
> > @@ -309,6 +309,7 @@
> > this->SetRootWindow(NULL);
> > this->WindowCreated = 0;
> > this->ViewCreated = 0;
> > +  this->ReleaseGraphicsResources();
> > }
> > 
> > 
> > //----------------------------------------------------------------------------
> > 
> > It just add a call to this->ReleaseGraphicsResources() at the end of the
> > DestroyWindow() method in vtkCocoaRenderWindow implementation, which is
> > called by the Finalize() method.
> > 
> > He found out this solution because this method is called in the
> > Finalize() method on the WIN32 implementation, and there is no crash in
> > Windows...
> > 
> > Do you think it is the correct fix? Or can this cause some unwanted side
> > effects ?
> > 
> > Regards
> > Simon
> > 
> > 
> > 2015-11-18 15:21 GMT+01:00 Ken Martin <ken.martin@kitware.com>:
> > 
> > > (sorry for the half written email, switching to the gmail web interface
> > > has me messing up)
> > > 
> > > I know zippo about Qt, but the version 120 error means that VTK thinks
> > > it has an old OpenGL 2.1 context as opposed to a 3.2 context. There is a
> > > setting in vtkOpenGLRenderWindow to indicate that it has a 3.2 context
> > > 
> > > 
> > > // Description::
> > > // Get if the context includes opengl core profile 3.2 support
> > > static bool GetContextSupportsOpenGL32();
> > > void SetContextSupportsOpenGL32(bool val);
> > > 
> > > it could be that the vtk Qt class is creating a 3.2 context but not
> > > setting the above methods to true? Or maybe somehow not calling void
> > > vtkOpenGLRenderWindow::OpenGLInitContext()
> > > 
> > > Just a guess.
> > > 
> > > Thanks
> > > Ken
> > > 
> > > 
> > > 
> > > On Wed, Nov 18, 2015 at 9:15 AM, Ken Martin <ken.martin@kitware.com>
> > > wrote:
> > > 
> > > > I know zippo about Qt, but the version 120 error means that VTK thinks
> > > > it has an old OpenGL 2.1 context as opposed to a 3.2 context. There is a
> > > > setting in vtkOpenGLRenderWindow to indicate that it has a 3.2 context
> > > > 
> > > > 
> > > > On Wed, Nov 18, 2015 at 8:55 AM, Simon ESNEAULT <
> > > > simon.esneault@gmail.com> wrote:
> > > > 
> > > > > Hello,
> > > > > 
> > > > > I've created a bug in Mantis for this
> > > > > http://www.vtk.org/Bug/view.php?id=15840
> > > > > 
> > > > > Looking at the code in QVTKWidget.cxx, here is the part that may be
> > > > > causing the problem, because it handles the reparenting part...
> > > > > 
> > > > > 
> > > > > 
> > > > > */*******************************************************************************/*
> > > > >                 
> > > > > *if(e->type() == QEvent::ParentAboutToChange)*
> > > > > *    {*
> > > > > *    this->markCachedImageAsDirty();*
> > > > > *    if (this->mRenWin)*
> > > > > *      {*
> > > > > *      // Finalize the window to remove graphics resources associated
> > > > > with*
> > > > > *      // this window*
> > > > > *      if(this->mRenWin->GetMapped())*
> > > > > *        {*
> > > > > *        this->mRenWin->Finalize();*
> > > > > *        }*
> > > > > *      }*
> > > > > *    }*
> > > > > *  else if(e->type() == QEvent::ParentChange)*
> > > > > *    {*
> > > > > *    if(this->mRenWin)*
> > > > > *      {*
> > > > > *      x11_setup_window();*
> > > > > *      // connect to new window*
> > > > > *      this->mRenWin->SetWindowId(
> > > > > reinterpret_cast<void*>(this->winId()));*
> > > > > 
> > > > > *      // start up the window to create graphics resources for this
> > > > > window*
> > > > > *      if(isVisible())*
> > > > > *        {*
> > > > > *        this->mRenWin->Start();*
> > > > > *        }*
> > > > > *      }*
> > > > > *    }*
> > > > > 
> > > > > */*******************************************************************************/*
> > > > >  
> > > > > Were there any significant changes in the methods GetMapped() /
> > > > > Finalize() / Start() of vtkRenderWindow (or children implementation) during
> > > > > the development of the new rendering backend that may lead to such a crash
> > > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > */*******************************************************************************/*
> > > > >                 
> > > > > *ERROR: In
> > > > > /Users/th-dev/EndoSize_OGL2/cmake-externals/VTK/src/Rendering/OpenGL2/vtkShaderProgram.cxx,
> > > > >  line 354*
> > > > > *vtkShaderProgram (0x6000001809c0): 1: #version 120*
> > > > > *2: #define highp*
> > > > > *3: #define mediump*
> > > > > *4: #define lowp*
> > > > > *5: *
> > > > > *6:
> > > > > /*=========================================================================*
> > > > >                 
> > > > > *7: *
> > > > > *8:   Program:   Visualization Toolkit*
> > > > > *9:   Module:    vtkPolyDataVS.glsl*
> > > > > *10: *
> > > > > *11:   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen*
> > > > > *12:   All rights reserved.*
> > > > > *13:   See Copyright.txt or http://www.kitware.com/Copyright.htm
> > > > > <http://www.kitware.com/Copyright.htm> for details.*
> > > > > *14: *
> > > > > *15:      This software is distributed WITHOUT ANY WARRANTY; without
> > > > > even*
> > > > > *16:      the implied warranty of MERCHANTABILITY or FITNESS FOR A
> > > > > PARTICULAR*
> > > > > *17:      PURPOSE.  See the above copyright notice for more
> > > > > information.*
> > > > > *18: *
> > > > > *19:
> > > > > =========================================================================*/*
> > > > >                 
> > > > > *20: *
> > > > > *21: attribute vec4 vertexMC;*
> > > > > *22: *
> > > > > *23: // frag position in VC*
> > > > > *24: varying vec4 vertexVCVSOutput;*
> > > > > *25: *
> > > > > *26: // optional normal declaration*
> > > > > *27: attribute vec3 normalMC;*
> > > > > *28: uniform mat3 normalMatrix;*
> > > > > *29: varying vec3 normalVCVSOutput;*
> > > > > *30: *
> > > > > *31: // extra lighting parameters*
> > > > > *32: //VTK::Light::Dec*
> > > > > *33: *
> > > > > *34: // Texture coordinates*
> > > > > *35: //VTK::TCoord::Dec*
> > > > > *36: *
> > > > > *37: // material property values*
> > > > > *38: //VTK::Color::Dec*
> > > > > *39: *
> > > > > *40: // clipping plane vars*
> > > > > *41: //VTK::Clip::Dec*
> > > > > *42: *
> > > > > *43: // camera and actor matrix values*
> > > > > *44: uniform mat4 MCDCMatrix;*
> > > > > *45: uniform mat4 MCVCMatrix;*
> > > > > *46: *
> > > > > *47: // Apple Bug*
> > > > > *48: //VTK::PrimID::Dec*
> > > > > *49: *
> > > > > *50: void main()*
> > > > > *51: {*
> > > > > *52:   //VTK::Color::Impl*
> > > > > *53: *
> > > > > *54:   normalVCVSOutput = normalMatrix * normalMC;*
> > > > > *55: *
> > > > > *56:   //VTK::TCoord::Impl*
> > > > > *57: *
> > > > > *58:   //VTK::Clip::Impl*
> > > > > *59: *
> > > > > *60:   //VTK::PrimID::Impl*
> > > > > *61: *
> > > > > *62:   vertexVCVSOutput = MCVCMatrix * vertexMC;*
> > > > > *63:   gl_Position = MCDCMatrix * vertexMC;*
> > > > > *64: *
> > > > > *65: *
> > > > > *66:   //VTK::Light::Impl*
> > > > > *67: }*
> > > > > *68: *
> > > > > 
> > > > > 
> > > > > *ERROR: In
> > > > > /Users/th-dev/EndoSize_OGL2/cmake-externals/VTK/src/Rendering/OpenGL2/vtkShaderProgram.cxx,
> > > > >  line 355*
> > > > > *vtkShaderProgram (0x6000001809c0): ERROR: 0:1: '' :  version '120' is
> > > > > not supported*
> > > > > *ERROR: 0:2: '' :  #version required and missing.*
> > > > > *ERROR: 0:21: 'attribute' : syntax error: syntax error*
> > > > > 
> > > > > 
> > > > > *(lldb) bt*
> > > > > ** thread #1: tid = 0x600e30, 0x0000000100609f1f
> > > > > VtkReparentingProblem`vtkShaderProgram::FindUniform(char const*) + 31,
> > > > > queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1,
> > > > > address=0x60)*
> > > > > *  * frame #0: 0x0000000100609f1f
> > > > > VtkReparentingProblem`vtkShaderProgram::FindUniform(char const*) + 31*
> > > > > *    frame #1: 0x00000001006074ab
> > > > > VtkReparentingProblem`vtkShaderProgram::SetUniformi(char const*, int) + 27*
> > > > > *    frame #2: 0x00000001005b8c28
> > > > > VtkReparentingProblem`vtkOpenGLPolyDataMapper::SetMapperShaderParameters(vtkOpenGLHelper&,
> > > > >  vtkRenderer*, vtkActor*) + 72*
> > > > > *    frame #3: 0x00000001005b8b1b
> > > > > VtkReparentingProblem`vtkOpenGLPolyDataMapper::UpdateShaders(vtkOpenGLHelper&,
> > > > >  vtkRenderer*, vtkActor*) + 1211*
> > > > > *    frame #4: 0x00000001005bb782
> > > > > VtkReparentingProblem`vtkOpenGLPolyDataMapper::RenderPieceDraw(vtkRenderer*,
> > > > >  vtkActor*) + 818*
> > > > > *    frame #5: 0x00000001005bbbe3
> > > > > VtkReparentingProblem`vtkOpenGLPolyDataMapper::RenderPiece(vtkRenderer*,
> > > > > vtkActor*) + 195*
> > > > > *    frame #6: 0x00000001004ba1fe
> > > > > VtkReparentingProblem`vtkPolyDataMapper::Render(vtkRenderer*, vtkActor*) +
> > > > > 174*
> > > > > *    frame #7: 0x0000000100561be0
> > > > > VtkReparentingProblem`vtkOpenGLActor::Render(vtkRenderer*, vtkMapper*) +
> > > > > 144*
> > > > > *    frame #8: 0x00000001004667c3
> > > > > VtkReparentingProblem`vtkActor::RenderOpaqueGeometry(vtkViewport*) + 435*
> > > > > *    frame #9: 0x00000001005caa87
> > > > > VtkReparentingProblem`vtkOpenGLRenderer::UpdateGeometry() + 263*
> > > > > *    frame #10: 0x00000001005ca945
> > > > > VtkReparentingProblem`vtkOpenGLRenderer::DeviceRender() + 181*
> > > > > *    frame #11: 0x00000001004cb96c
> > > > > VtkReparentingProblem`vtkRenderer::Render() + 604*
> > > > > *    frame #12: 0x00000001004d08cc
> > > > > VtkReparentingProblem`vtkRendererCollection::Render() + 92*
> > > > > *    frame #13: 0x00000001004c5d1a
> > > > > VtkReparentingProblem`vtkRenderWindow::DoStereoRender() + 138*
> > > > > *    frame #14: 0x00000001004c5098
> > > > > VtkReparentingProblem`vtkRenderWindow::Render() + 328*
> > > > > *    frame #15: 0x00000001005c7816
> > > > > VtkReparentingProblem`vtkOpenGLRenderWindow::Render() + 22*
> > > > > *    frame #16: 0x00000001004c8f17
> > > > > VtkReparentingProblem`vtkRenderWindowInteractor::Render() + 39*
> > > > > *    frame #17: 0x00000001006831dd
> > > > > VtkReparentingProblem`QVTKWidget::paintEvent(QPaintEvent*) + 109*
> > > > > *    frame #18: 0x0000000100bb73d6 QtWidgets`QWidget::event(QEvent*) +
> > > > > 1958*
> > > > > *    frame #19: 0x0000000100683079
> > > > > VtkReparentingProblem`QVTKWidget::event(QEvent*) + 281*
> > > > > *    frame #20: 0x0000000100b7effc
> > > > > QtWidgets`QApplicationPrivate::notify_helper(QObject*, QEvent*) + 300*
> > > > > *    frame #21: 0x0000000100b81abb
> > > > > QtWidgets`QApplication::notify(QObject*, QEvent*) + 6187*
> > > > > *    frame #22: 0x0000000101902932
> > > > > QtCore`QCoreApplication::notifyInternal(QObject*, QEvent*) + 114*
> > > > > *    frame #23: 0x0000000100bb2035
> > > > > QtWidgets`QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint
> > > > > const&, int, QPainter*, QWidgetBackingStore*) + 2997*
> > > > > *    frame #24: 0x0000000100b8aed0
> > > > > QtWidgets`QWidgetPrivate::repaint_sys(QRegion const&) + 400*
> > > > > *    frame #25: 0x0000000100bd4987
> > > > > QtWidgets`QWidgetWindow::event(QEvent*) + 423*
> > > > > *    frame #26: 0x0000000100b7effc
> > > > > QtWidgets`QApplicationPrivate::notify_helper(QObject*, QEvent*) + 300*
> > > > > *    frame #27: 0x0000000100b81abb
> > > > > QtWidgets`QApplication::notify(QObject*, QEvent*) + 6187*
> > > > > *    frame #28: 0x0000000101902932
> > > > > QtCore`QCoreApplication::notifyInternal(QObject*, QEvent*) + 114*
> > > > > *    frame #29: 0x00000001011c4d7a
> > > > > QtGui`QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent*)
> > > > >  + 314*
> > > > > *    frame #30: 0x00000001011c08a7
> > > > > QtGui`QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*)
> > > > >  + 951*
> > > > > *    frame #31: 0x00000001011af1cb
> > > > > QtGui`QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>)
> > > > >  + 315*
> > > > > *    frame #32: 0x0000000104a39f0d
> > > > > libqcocoa.dylib`QCocoaEventDispatcherPrivate::processPostedEvents() + 317*
> > > > > *    frame #33: 0x0000000104a3a8a8
> > > > > libqcocoa.dylib`QCocoaEventDispatcherPrivate::postedEventsSourceCallback(void*)
> > > > >  + 40*
> > > > > *    frame #34: 0x00007fff8f9e3a01
> > > > > CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ +
> > > > > 17*
> > > > > *    frame #35: 0x00007fff8f9d5b8d
> > > > > CoreFoundation`__CFRunLoopDoSources0 + 269*
> > > > > *    frame #36: 0x00007fff8f9d51bf CoreFoundation`__CFRunLoopRun + 927*
> > > > > *    frame #37: 0x00007fff8f9d4bd8 CoreFoundation`CFRunLoopRunSpecific
> > > > > + 296*
> > > > > *    frame #38: 0x00007fff8b65f56f HIToolbox`RunCurrentEventLoopInMode
> > > > > + 235*
> > > > > *    frame #39: 0x00007fff8b65f2ea HIToolbox`ReceiveNextEventCommon +
> > > > > 431*
> > > > > *    frame #40: 0x00007fff8b65f12b
> > > > > HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 71*
> > > > > *    frame #41: 0x00007fff894cf8ab AppKit`_DPSNextEvent + 978*
> > > > > *    frame #42: 0x00007fff894cee58 AppKit`-[NSApplication
> > > > > nextEventMatchingMask:untilDate:inMode:dequeue:] + 346*
> > > > > *    frame #43: 0x00007fff894c4af3 AppKit`-[NSApplication run] + 594*
> > > > > *    frame #44: 0x0000000104a395e4
> > > > > libqcocoa.dylib`QCocoaEventDispatcher::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)
> > > > >  + 2420*
> > > > > *    frame #45: 0x00000001018ff9ad
> > > > > QtCore`QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 381*
> > > > > *    frame #46: 0x0000000101902ee7 QtCore`QCoreApplication::exec() +
> > > > > 359*
> > > > > *    frame #47: 0x0000000100005dab VtkReparentingProblem`main + 59*
> > > > > *    frame #48: 0x0000000100005d64 VtkReparentingProblem`start + 52*
> > > > > 
> > > > > 
> > > > > */*******************************************************************************/*
> > > > >  
> > > > > Any hints ?
> > > > > 
> > > > > Regards,
> > > > > Simon
> > > > > 
> > > > > 2015-11-17 9:27 GMT+01:00 Simon ESNEAULT <simon.esneault@gmail.com>:
> > > > > 
> > > > > > Hello,
> > > > > > 
> > > > > > After the switch to the new rendering backend, we have a crash on our
> > > > > > program after reparenting a QVTKWidget on OSX. The crash is in the
> > > > > > method vtkShaderProgram::FindUniform() but we suspect it is about the
> > > > > > OpenGL context not being ready on time for the next paintEvent with the \
> > > > > > new parent.
> > > > > > 
> > > > > > Attached is a program that reproduce the problem, as well as a
> > > > > > complete backtrace for this crash. This used to work fine with the \
> > > > > > previous backend.
> > > > > > 
> > > > > > Hope this little test case helps
> > > > > > 
> > > > > > Thanks
> > > > > > Simon
> > > > > > 
> > > > > > --
> > > > > > ------------------------------------------------------------------
> > > > > > Simon Esneault
> > > > > > Rennes, France
> > > > > > ------------------------------------------------------------------
> > > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > --
> > > > > ------------------------------------------------------------------
> > > > > Simon Esneault
> > > > > Rennes, France
> > > > > ------------------------------------------------------------------
> > > > > 
> > > > > _______________________________________________
> > > > > Powered by www.kitware.com
> > > > > 
> > > > > Visit other Kitware open-source projects at
> > > > > http://www.kitware.com/opensource/opensource.html
> > > > > 
> > > > > Please keep messages on-topic and check the VTK FAQ at:
> > > > > http://www.vtk.org/Wiki/VTK_FAQ
> > > > > 
> > > > > Search the list archives at: http://markmail.org/search/?q=vtkusers
> > > > > 
> > > > > Follow this link to subscribe/unsubscribe:
> > > > > http://public.kitware.com/mailman/listinfo/vtkusers
> > > > > 
> > > > > 
> > > > 
> > > > 
> > > > --
> > > > Ken Martin PhD
> > > > Chairman & CFO
> > > > Kitware Inc.
> > > > 28 Corporate Drive
> > > > Clifton Park NY 12065
> > > > 518 371 3971
> > > > 
> > > > This communication, including all attachments, contains confidential
> > > > and legally privileged information, and it is intended only for the use of
> > > > the addressee.  Access to this email by anyone else is unauthorized. If you
> > > > are not the intended recipient, any disclosure, copying, distribution or
> > > > any action taken in reliance on it is prohibited and may be unlawful. If
> > > > you received this communication in error please notify us immediately and
> > > > destroy the original message.  Thank you.
> > > > 
> > > 
> > > 
> > > 
> > > --
> > > Ken Martin PhD
> > > Chairman & CFO
> > > Kitware Inc.
> > > 28 Corporate Drive
> > > Clifton Park NY 12065
> > > 518 371 3971
> > > 
> > > This communication, including all attachments, contains confidential and
> > > legally privileged information, and it is intended only for the use of the
> > > addressee.  Access to this email by anyone else is unauthorized. If you are
> > > not the intended recipient, any disclosure, copying, distribution or any
> > > action taken in reliance on it is prohibited and may be unlawful. If you
> > > received this communication in error please notify us immediately and
> > > destroy the original message.  Thank you.
> > > 
> > 
> > 
> > 
> > --
> > ------------------------------------------------------------------
> > Simon Esneault
> > Rennes, France
> > ------------------------------------------------------------------
> > 
> 
> 
> 
> --
> Ken Martin PhD
> Chairman & CFO
> Kitware Inc.
> 28 Corporate Drive
> Clifton Park NY 12065
> 518 371 3971
> 
> This communication, including all attachments, contains confidential and
> legally privileged information, and it is intended only for the use of the
> addressee.  Access to this email by anyone else is unauthorized. If you are
> not the intended recipient, any disclosure, copying, distribution or any
> action taken in reliance on it is prohibited and may be unlawful. If you
> received this communication in error please notify us immediately and
> destroy the original message.  Thank you.
> 



-- 
------------------------------------------------------------------
Simon Esneault
Rennes, France
------------------------------------------------------------------


[Attachment #5 (text/html)]

<div dir="ltr">Hello Ken,<br><br>I&#39;ve created a merge request here :<br><a \
href="https://gitlab.kitware.com/vtk/vtk/merge_requests/925" \
target="_blank">https://gitlab.kitware.com/vtk/vtk/merge_requests/925</a><br><br>Can \
you review it and eventually allow it to master if it is the correct fix ?  \
<br>I&#39;ve also added Sean McBride as a reviewer.<br><br>Thanks<br>Simon</div><div \
class="gmail_extra"><br><div class="gmail_quote">2015-11-18 17:42 GMT+01:00 Ken \
Martin <span dir="ltr">&lt;<a href="mailto:ken.martin@kitware.com" \
target="_blank">ken.martin@kitware.com</a>&gt;</span>:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr">Yes, if some process is causing the opengl \
context to be destroyed then we need to release the graphics resources tied to the \
old context. Sounds like that is the case here and the cocoa window was missing \
it.</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div \
class="gmail_quote">On Wed, Nov 18, 2015 at 11:36 AM, Simon ESNEAULT <span \
dir="ltr">&lt;<a href="mailto:simon.esneault@gmail.com" \
target="_blank">simon.esneault@gmail.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr">Hello Ken,<br><br>A colleague has just found a \
solution that prevent the crash. Here is the patch:<br><div><br>  \
//----------------------------------------------------------------------------<div><br><div><div>--- \
VTK/Rendering/OpenGL2/vtkCocoaRenderWindow.mm<span \
style="white-space:pre-wrap">	</span>Wed Nov 18 17:25:01 2015</div><div>+++ \
VTK/Rendering/OpenGL2/vtkCocoaRenderWindow.mm<span \
style="white-space:pre-wrap">	</span>Wed Nov 18 17:29:12 2015</div><div>@@ -309,6 \
+309,7 @@</div><div>     this-&gt;SetRootWindow(NULL);</div><div>     \
this-&gt;WindowCreated = 0;</div><div>     this-&gt;ViewCreated = 0;</div><div>+   \
this-&gt;ReleaseGraphicsResources();</div><div>  }</div></div><div><br></div><div>  \
//----------------------------------------------------------------------------</div><div><br></div><div>It \
just add a call to this-&gt;ReleaseGraphicsResources() at the end of the \
DestroyWindow() method in vtkCocoaRenderWindow implementation, which is called by the \
Finalize() method.<br><br>He found out this solution because this method is called in \
the Finalize() method on the WIN32 implementation, and there is no crash in \
Windows...<br><br>Do you think it is the correct fix? Or can this cause some unwanted \
side effects ?  <br><br>Regards<br>Simon</div><br></div></div></div><div \
class="gmail_extra"><br><div class="gmail_quote">2015-11-18 15:21 GMT+01:00 Ken \
Martin <span dir="ltr">&lt;<a href="mailto:ken.martin@kitware.com" \
target="_blank">ken.martin@kitware.com</a>&gt;</span>:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr"><span style="font-size:12.8px">(sorry for the \
half written email, switching to the gmail web interface has me messing up)  \
</span><span><div><span style="font-size:12.8px"><br></span></div><div><span \
style="font-size:12.8px">I know zippo about Qt, but the version 120 error means that \
VTK thinks it has an old OpenGL 2.1 context as opposed to a 3.2 context. There is a \
setting in vtkOpenGLRenderWindow to indicate that it has a 3.2 \
context</span><br><div><span \
style="font-size:12.8px"><br></span></div></div><div><span \
style="font-size:12.8px"><br></span></div></span><div><div><span \
style="font-size:12.8px">// Description::</span></div><div><span \
style="font-size:12.8px">   // Get if the context includes opengl core profile 3.2 \
support</span></div><div><span style="font-size:12.8px">   static bool \
GetContextSupportsOpenGL32();</span></div><div><span style="font-size:12.8px">   void \
SetContextSupportsOpenGL32(bool val);</span></div></div><div><span \
style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">it \
could be that the vtk Qt class is creating a 3.2 context but not setting the above \
methods to true? Or maybe somehow not calling  void \
vtkOpenGLRenderWindow::OpenGLInitContext()</span></div><div><span \
style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Just a \
guess.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span \
style="font-size:12.8px">Thanks</span></div><span><font color="#888888"><div><span \
style="font-size:12.8px">Ken</span></div><div><span \
style="font-size:12.8px"><br></span></div><div><span \
style="font-size:12.8px"><br></span></div></font></span></div><div><div><div \
class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 18, 2015 at 9:15 AM, Ken \
Martin <span dir="ltr">&lt;<a href="mailto:ken.martin@kitware.com" \
target="_blank">ken.martin@kitware.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr">I know zippo about Qt, but the version 120 \
error means that VTK thinks it has an old OpenGL 2.1 context as opposed to a 3.2 \
context. There is a setting in vtkOpenGLRenderWindow to indicate that it has a 3.2 \
context<div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On \
Wed, Nov 18, 2015 at 8:55 AM, Simon ESNEAULT <span dir="ltr">&lt;<a \
href="mailto:simon.esneault@gmail.com" \
target="_blank">simon.esneault@gmail.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr">Hello,<br><br>I&#39;ve created a bug in Mantis \
for this<br><a href="http://www.vtk.org/Bug/view.php?id=15840" \
target="_blank">http://www.vtk.org/Bug/view.php?id=15840</a><br><br>Looking at the \
code in QVTKWidget.cxx, here is the part that may be causing the problem, because it \
handles the reparenting \
part...<br><br><i>/*******************************************************************************/<br></i><div><i>if(e-&gt;type() \
== QEvent::ParentAboutToChange)</i></div><div><i>      {</i></div><div><i>      \
this-&gt;markCachedImageAsDirty();</i></div><div><i>      if \
(this-&gt;mRenWin)</i></div><div><i>         {</i></div><div><i>         // Finalize \
the window to remove graphics resources associated with</i></div><div><i>         // \
this window</i></div><div><i>         \
if(this-&gt;mRenWin-&gt;GetMapped())</i></div><div><i>            {</i></div><div><i> \
this-&gt;mRenWin-&gt;Finalize();</i></div><div><i>            }</i></div><div><i>     \
}</i></div><div><i>      }</i></div><div><i>   else if(e-&gt;type() == \
QEvent::ParentChange)</i></div><div><i>      {</i></div><div><i>      \
if(this-&gt;mRenWin)</i></div><div><i>         {</i></div><div><i>         \
x11_setup_window();</i></div><div><i>         // connect to new \
window</i></div><div><i>         this-&gt;mRenWin-&gt;SetWindowId( \
reinterpret_cast&lt;void*&gt;(this-&gt;winId()));</i></div><div><i><br></i></div><div><i> \
// start up the window to create graphics resources for this window</i></div><div><i> \
if(isVisible())</i></div><div><i>            {</i></div><div><i>            \
this-&gt;mRenWin-&gt;Start();</i></div><div><i>            }</i></div><div><i>        \
}</i></div><div><i>      \
}</i></div><i>/*******************************************************************************/</i><br><br><div>Were \
there any significant changes in the methods GetMapped() / Finalize() / Start() of \
vtkRenderWindow (or children implementation) during the development of the new \
rendering backend that may lead to such a crash :  \
</div><div><br></div><div><i>/*******************************************************************************/<br></i><div><i>ERROR: \
In /Users/th-dev/EndoSize_OGL2/cmake-externals/VTK/src/Rendering/OpenGL2/vtkShaderProgram.cxx, \
line 354</i></div><div><i>vtkShaderProgram (0x6000001809c0): 1: #version \
120</i></div><div><i>2: #define highp</i></div><div><i>3: #define \
mediump</i></div><div><i>4: #define lowp</i></div><div><i>5:  </i></div><div><i>6: \
/*=========================================================================</i></div><div><i>7: \
</i></div><div><i>8:    Program:    Visualization Toolkit</i></div><div><i>9:    \
Module:      vtkPolyDataVS.glsl</i></div><div><i>10:  </i></div><div><i>11:    \
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen</i></div><div><i>12:    All \
rights reserved.</i></div><div><i>13:    See Copyright.txt or <a \
href="http://www.kitware.com/Copyright.htm" \
target="_blank">http://www.kitware.com/Copyright.htm</a> for \
details.</i></div><div><i>14:  </i></div><div><i>15:         This software is \
distributed WITHOUT ANY WARRANTY; without even</i></div><div><i>16:         the \
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR</i></div><div><i>17:  \
PURPOSE.   See the above copyright notice for more information.</i></div><div><i>18:  \
</i></div><div><i>19: \
=========================================================================*/</i></div><div><i>20: \
</i></div><div><i>21: attribute vec4 vertexMC;</i></div><div><i>22:  \
</i></div><div><i>23: // frag position in VC</i></div><div><i>24: varying vec4 \
vertexVCVSOutput;</i></div><div><i>25:  </i></div><div><i>26: // optional normal \
declaration</i></div><div><i>27: attribute vec3 normalMC;</i></div><div><i>28: \
uniform mat3 normalMatrix;</i></div><div><i>29: varying vec3 \
normalVCVSOutput;</i></div><div><i>30:  </i></div><div><i>31: // extra lighting \
parameters</i></div><div><i>32: //VTK::Light::Dec</i></div><div><i>33:  \
</i></div><div><i>34: // Texture coordinates</i></div><div><i>35: \
//VTK::TCoord::Dec</i></div><div><i>36:  </i></div><div><i>37: // material property \
values</i></div><div><i>38: //VTK::Color::Dec</i></div><div><i>39:  \
</i></div><div><i>40: // clipping plane vars</i></div><div><i>41: \
//VTK::Clip::Dec</i></div><div><i>42:  </i></div><div><i>43: // camera and actor \
matrix values</i></div><div><i>44: uniform mat4 MCDCMatrix;</i></div><div><i>45: \
uniform mat4 MCVCMatrix;</i></div><div><i>46:  </i></div><div><i>47: // Apple \
Bug</i></div><div><i>48: //VTK::PrimID::Dec</i></div><div><i>49:  \
</i></div><div><i>50: void main()</i></div><div><i>51: {</i></div><div><i>52:    \
//VTK::Color::Impl</i></div><div><i>53:  </i></div><div><i>54:    normalVCVSOutput = \
normalMatrix * normalMC;</i></div><div><i>55:  </i></div><div><i>56:    \
//VTK::TCoord::Impl</i></div><div><i>57:  </i></div><div><i>58:    \
//VTK::Clip::Impl</i></div><div><i>59:  </i></div><div><i>60:    \
//VTK::PrimID::Impl</i></div><div><i>61:  </i></div><div><i>62:    vertexVCVSOutput = \
MCVCMatrix * vertexMC;</i></div><div><i>63:    gl_Position = MCDCMatrix * \
vertexMC;</i></div><div><i>64:  </i></div><div><i>65:  </i></div><div><i>66:    \
//VTK::Light::Impl</i></div><div><i>67: }</i></div><div><i>68:  \
</i></div><div><i><br></i></div><div><i><br></i></div><div><i>ERROR: In \
/Users/th-dev/EndoSize_OGL2/cmake-externals/VTK/src/Rendering/OpenGL2/vtkShaderProgram.cxx, \
line 355</i></div><div><i>vtkShaderProgram (0x6000001809c0): ERROR: 0:1: &#39;&#39; : \
version &#39;120&#39; is not supported</i></div><div><i>ERROR: 0:2: &#39;&#39; :   \
#version required and missing.</i></div><div><i>ERROR: 0:21: &#39;attribute&#39; : \
syntax error: syntax \
error</i></div><div><i><br></i></div><div><i><br></i></div><div><i>(lldb) \
bt</i></div><div><i>* thread #1: tid = 0x600e30, 0x0000000100609f1f \
VtkReparentingProblem`vtkShaderProgram::FindUniform(char const*) + 31, queue = \
&#39;com.apple.main-thread&#39;, stop reason = EXC_BAD_ACCESS (code=1, \
address=0x60)</i></div><div><i>   * frame #0: 0x0000000100609f1f \
VtkReparentingProblem`vtkShaderProgram::FindUniform(char const*) + \
31</i></div><div><i>      frame #1: 0x00000001006074ab \
VtkReparentingProblem`vtkShaderProgram::SetUniformi(char const*, int) + \
27</i></div><div><i>      frame #2: 0x00000001005b8c28 \
VtkReparentingProblem`vtkOpenGLPolyDataMapper::SetMapperShaderParameters(vtkOpenGLHelper&amp;, \
vtkRenderer*, vtkActor*) + 72</i></div><div><i>      frame #3: 0x00000001005b8b1b \
VtkReparentingProblem`vtkOpenGLPolyDataMapper::UpdateShaders(vtkOpenGLHelper&amp;, \
vtkRenderer*, vtkActor*) + 1211</i></div><div><i>      frame #4: 0x00000001005bb782 \
VtkReparentingProblem`vtkOpenGLPolyDataMapper::RenderPieceDraw(vtkRenderer*, \
vtkActor*) + 818</i></div><div><i>      frame #5: 0x00000001005bbbe3 \
VtkReparentingProblem`vtkOpenGLPolyDataMapper::RenderPiece(vtkRenderer*, vtkActor*) + \
195</i></div><div><i>      frame #6: 0x00000001004ba1fe \
VtkReparentingProblem`vtkPolyDataMapper::Render(vtkRenderer*, vtkActor*) + \
174</i></div><div><i>      frame #7: 0x0000000100561be0 \
VtkReparentingProblem`vtkOpenGLActor::Render(vtkRenderer*, vtkMapper*) + \
144</i></div><div><i>      frame #8: 0x00000001004667c3 \
VtkReparentingProblem`vtkActor::RenderOpaqueGeometry(vtkViewport*) + \
435</i></div><div><i>      frame #9: 0x00000001005caa87 \
VtkReparentingProblem`vtkOpenGLRenderer::UpdateGeometry() + 263</i></div><div><i>     \
frame #10: 0x00000001005ca945 VtkReparentingProblem`vtkOpenGLRenderer::DeviceRender() \
+ 181</i></div><div><i>      frame #11: 0x00000001004cb96c \
VtkReparentingProblem`vtkRenderer::Render() + 604</i></div><div><i>      frame #12: \
0x00000001004d08cc VtkReparentingProblem`vtkRendererCollection::Render() + \
92</i></div><div><i>      frame #13: 0x00000001004c5d1a \
VtkReparentingProblem`vtkRenderWindow::DoStereoRender() + 138</i></div><div><i>      \
frame #14: 0x00000001004c5098 VtkReparentingProblem`vtkRenderWindow::Render() + \
328</i></div><div><i>      frame #15: 0x00000001005c7816 \
VtkReparentingProblem`vtkOpenGLRenderWindow::Render() + 22</i></div><div><i>      \
frame #16: 0x00000001004c8f17 \
VtkReparentingProblem`vtkRenderWindowInteractor::Render() + 39</i></div><div><i>      \
frame #17: 0x00000001006831dd \
VtkReparentingProblem`QVTKWidget::paintEvent(QPaintEvent*) + 109</i></div><div><i>    \
frame #18: 0x0000000100bb73d6 QtWidgets`QWidget::event(QEvent*) + \
1958</i></div><div><i>      frame #19: 0x0000000100683079 \
VtkReparentingProblem`QVTKWidget::event(QEvent*) + 281</i></div><div><i>      frame \
#20: 0x0000000100b7effc QtWidgets`QApplicationPrivate::notify_helper(QObject*, \
QEvent*) + 300</i></div><div><i>      frame #21: 0x0000000100b81abb \
QtWidgets`QApplication::notify(QObject*, QEvent*) + 6187</i></div><div><i>      frame \
#22: 0x0000000101902932 QtCore`QCoreApplication::notifyInternal(QObject*, QEvent*) + \
114</i></div><div><i>      frame #23: 0x0000000100bb2035 \
QtWidgets`QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&amp;, QPoint \
const&amp;, int, QPainter*, QWidgetBackingStore*) + 2997</i></div><div><i>      frame \
#24: 0x0000000100b8aed0 QtWidgets`QWidgetPrivate::repaint_sys(QRegion const&amp;) + \
400</i></div><div><i>      frame #25: 0x0000000100bd4987 \
QtWidgets`QWidgetWindow::event(QEvent*) + 423</i></div><div><i>      frame #26: \
0x0000000100b7effc QtWidgets`QApplicationPrivate::notify_helper(QObject*, QEvent*) + \
300</i></div><div><i>      frame #27: 0x0000000100b81abb \
QtWidgets`QApplication::notify(QObject*, QEvent*) + 6187</i></div><div><i>      frame \
</font></span></font></span></div><span><font color="#888888">
</font></span></blockquote></div><span><font color="#888888"><br><br \
clear="all"><div><br></div>-- <br><div><div \
dir="ltr"><div>------------------------------------------------------------------<br>Simon \
Esneault<div>Rennes, \
France<br>------------------------------------------------------------------</div></div></div></div>
 </font></span></div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" \
target="_blank">www.kitware.com</a><br> <br>
Visit other Kitware open-source projects at <a \
href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" \
target="_blank">http://www.kitware.com/opensource/opensource.html</a><br> <br>
Please keep messages on-topic and check the VTK FAQ at: <a \
href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" \
target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br> <br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" \
rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br> <br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" \
target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br> \
<br></blockquote></div><span><font color="#888888"><br><br \
clear="all"><div><br></div>-- <br><div>Ken Martin PhD<div>Chairman &amp; \
CFO<br>Kitware Inc.<br>28 Corporate Drive<br>Clifton Park NY 12065<br><a \
href="tel:518%20371%203971" value="+15183713971" target="_blank">518 371 \
3971</a><div><br></div><div><span \
style="font-size:10pt;font-family:Tahoma,sans-serif">This communication, including \
all attachments, contains confidential and legally privileged information, and it is \
intended only for the use of the addressee.   Access to this email by anyone else is \
unauthorized. If you are not the intended recipient, any disclosure, copying, \
distribution or any action taken in reliance on it is prohibited and may be unlawful. \
If you received this communication in error please notify us immediately and destroy \
the original message.   Thank you.</span></div></div></div>
</font></span></div>
</blockquote></div><br><br clear="all"><span><font color="#888888"><div><br></div>-- \
<br><div>Ken Martin PhD<div>Chairman &amp; CFO<br>Kitware Inc.<br>28 Corporate \
Drive<br>Clifton Park NY 12065<br><a href="tel:518%20371%203971" value="+15183713971" \
target="_blank">518 371 3971</a><div><br></div><div><span \
style="font-size:10pt;font-family:Tahoma,sans-serif">This communication, including \
all attachments, contains confidential and legally privileged information, and it is \
intended only for the use of the addressee.   Access to this email by anyone else is \
unauthorized. If you are not the intended recipient, any disclosure, copying, \
distribution or any action taken in reliance on it is prohibited and may be unlawful. \
If you received this communication in error please notify us immediately and destroy \
the original message.   Thank you.</span></div></div></div>
</font></span></div><span><font color="#888888">
</font></span></div></div></blockquote></div><span><font color="#888888"><br><br \
clear="all"><div><br></div>-- <br><div><div \
dir="ltr"><div>------------------------------------------------------------------<br>Simon \
Esneault<div>Rennes, \
France<br>------------------------------------------------------------------</div></div></div></div>
 </font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div>Ken Martin \
PhD<div>Chairman &amp; CFO<br>Kitware Inc.<br>28 Corporate Drive<br>Clifton Park NY \
12065<br>518 371 3971<div><br></div><div><span \
style="font-size:10pt;font-family:Tahoma,sans-serif">This communication, including \
all attachments, contains confidential and legally privileged information, and it is \
intended only for the use of the addressee.   Access to this email by anyone else is \
unauthorized. If you are not the intended recipient, any disclosure, copying, \
distribution or any action taken in reliance on it is prohibited and may be unlawful. \
If you received this communication in error please notify us immediately and destroy \
the original message.   Thank you.</span></div></div></div>
</div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div \
class="gmail_signature"><div \
dir="ltr"><div>------------------------------------------------------------------<br>Simon \
Esneault<div>Rennes, \
France<br>------------------------------------------------------------------</div></div></div></div>
 </div>



_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic