[vtkusers] Crash in vtkShaderProgram/vtkOpenGLPolyDataMapper

Ken Martin ken.martin at kitware.com
Fri Apr 15 14:07:57 EDT 2016


Usually that crash means something failing in initializing OpenGL (or the
shader program hit something the local system could not handle) and it
crashes later on when it first dereferences the shader program.  Usually
VTK is good about displaying an error message in those cases (and usually
it fails 100% of the time for a given system, not sometimes)

If you have built VTK with testing on you can run

ctest -R VBOPLY

or

ctest -R Apple

both do a sanity check to see if the hardware has reasonable OpenGL
support. Assuming those work OK I would suspect the issue it related to a
multi window or multithreading issue where VTK is doing something when
OpenGL is set to a different context or thread.

Ken

On Fri, Apr 15, 2016 at 1:40 PM, dei <david.ei at novodynamics.com> wrote:

> I'm attempting to add a VTK 3D mesh viewer to our java app which builds a
> triangular mesh from  a CAT scan image series. I'm using the VTK-Java
> vtkRenderWindowPanel class to embed the VTK viewer into a JTabbedPane of
> our
> app. It works some of the time, but occasionally crashes with an Access
> Violation in the unmanaged vtkShaderProgram->FindUniform() function.
>
> I was able to break on a crash in a C++ debugger. It crashes attempting to
> dereference a null vtkShaderProgram 'this' pointer. I'm not sure how
> FindUniform() could be invoked with a null 'this' pointer? Maybe because
> FindUniform() is an inline function? Anyway, I've been able to crawl the
> call stack and find out that vtkOpenGLPolyDataMapper contains a "Tris"
> object, which has a null 'Program', which eventually ends up as the null
> 'this' pointer. I haven't yet figured out what a 'Tris' is or how it is
> initialized.
>
> I researched the vtkShaderProgram and it seems that it should be managed by
> vtkOpenGLPolyDataMapper. I tried updating my NVIDIA video driver but it
> made
> no difference.
>
> I am very new to VTK and don't yet have a grasp of the 'big picture'. I
> apologize if these are very newbie questions:
>   Is there a way to force the initialization of the default
> vtkShaderProgram?
>   Is there a way to check to see that it has been initialized?
>   What has to occur to initialize it?
>   Any other suggestions would be welcome.
>
> I should mention that a very simple java app that (no dicom, or CAT image
> processing) that uses the same VTK initialization logic seems to be 100%
> reliable.
>
> The call stack looks like:
>
> >       vtkRenderingOpenGL2-7.0.dll!vtkShaderProgram::FindUniform(const
> char *
> name=0x000007fedd9d4dd8) Line 772       C++
>         vtkRenderingOpenGL2-7.0.dll!vtkShaderProgram::SetUniformi(const
> char *
> name=0x000007fedd9d4dd8, int i=0) Line 498      C++
>
>
> vtkRenderingOpenGL2-7.0.dll!vtkOpenGLPolyDataMapper::SetMapperShaderParameters(vtkOpenGLHelper
> & cellBO={...}, vtkRenderer * ren=0x00000000538a5980, vtkActor *
> actor=0x0000000053975d40) Line 1451     C++
>
>
> vtkRenderingOpenGL2-7.0.dll!vtkOpenGLPolyDataMapper::UpdateShaders(vtkOpenGLHelper
> & cellBO={...}, vtkRenderer * ren=0x00000000538a5980, vtkActor *
> actor=0x0000000053975d40) Line 1433     C++
>
>
> vtkRenderingOpenGL2-7.0.dll!vtkOpenGLPolyDataMapper::RenderPieceDraw(vtkRenderer
> * ren=0x00000000538a5980, vtkActor * actor=0x0000000053975d40) Line 2087
>       C++
>
>
> vtkRenderingOpenGL2-7.0.dll!vtkOpenGLPolyDataMapper::RenderPiece(vtkRenderer
> * ren=0x00000000538a5980, vtkActor * actor=0x0000000053975d40) Line 2240
>       C++
>         vtkRenderingCore-7.0.dll!vtkPolyDataMapper::Render(vtkRenderer *
> ren=0x00000000538a5980, vtkActor * act=0x0000000053975d40) Line 64      C++
>         vtkRenderingOpenGL2-7.0.dll!vtkOpenGLActor::Render(vtkRenderer *
> ren=0x00000000538a5980, vtkMapper * mapper=0x000000005398a930) Line 86  C++
>
> vtkRenderingCore-7.0.dll!vtkActor::RenderOpaqueGeometry(vtkViewport *
> vp=0x00000000538a5980) Line 196 C++
>         vtkRenderingOpenGL2-7.0.dll!vtkOpenGLRenderer::UpdateGeometry()
> Line 211
> C++
>         vtkRenderingOpenGL2-7.0.dll!vtkOpenGLRenderer::DeviceRender() Line
> 159  C++
>         vtkRenderingCore-7.0.dll!vtkRenderer::Render() Line 317 C++
>         vtkRenderingCore-7.0.dll!vtkRendererCollection::Render() Line 53
>       C++
>         vtkRenderingCore-7.0.dll!vtkRenderWindow::DoStereoRender() Line
> 775     C++
>         vtkRenderingCore-7.0.dll!vtkRenderWindow::DoFDRender() Line 743 C++
>         vtkRenderingCore-7.0.dll!vtkRenderWindow::DoAARender() Line 622 C++
>         vtkRenderingCore-7.0.dll!vtkRenderWindow::Render() Line 438     C++
>         vtkRenderingOpenGL2-7.0.dll!vtkOpenGLRenderWindow::Render() Line
> 600    C++
>
> vtkRenderingCoreJava.dll!Java_vtk_vtkRenderWindow_Render_19(JNIEnv_ *
> env=0x000000004d7e79f8, _jobject * obj=0x000000021b00c790) Line 123     C++
>         0000000021bca86c()      Unknown
> ...
>
> Best Regards,
> David Ei
>
>
>
> --
> View this message in context:
> http://vtk.1045678.n5.nabble.com/Crash-in-vtkShaderProgram-vtkOpenGLPolyDataMapper-tp5737734.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160415/936a71a9/attachment.html>


More information about the vtkusers mailing list