[vtkusers] GPURayCast and Texture3D volume mappers fail to render

Miro Drahos mdrahos at robodoc.com
Wed Sep 11 18:36:21 EDT 2013


Thanks burlen and Julien.

I did call Render() to initialize the GL context. Created a new plain 
vtkRenderWindow too (in my application I use QVTKWidget):
   cout << " DEBUG standalone renwin" << endl;
vtkRenderWindow * rw = vtkRenderWindow::New();
   rw->SetSize(512, 512);
   rw->Render();

   VTK_CREATE(vtkRenderer, ren);
   ren->AddViewProp(this->m_volume);
   rw->AddRenderer(ren);

   vtkOpenGLExtensionManager *extensions=vtkOpenGLExtensionManager::New();
   extensions->SetRenderWindow(rw);
   extensions->Update();

   cout << " SUPPORTS 1.3? " << 
extensions->ExtensionSupported("GL_VERSION_1_3") << endl;
   cout << "====================== exts: ==================== " <<
     extensions->GetExtensionsString() <<
     "================================================== " << endl;
   rw->Render();
   cout << " DEBUG standalone renwin done" << endl;

But the terminal output shows empty string:
  DEBUG standalone renwin
  SUPPORTS 1.3? 0
====================== exts: ==================== 
==================================================
ERROR: In 
/home/miro/BUILDS/VTK5.10.1/VolumeRendering/vtkOpenGLVolumeTextureMapper3D.cxx, 
line 100
vtkOpenGLVolumeTextureMapper3D (0xba0c9c0): required extensions not 
supported

  DEBUG standalone renwin done

Julien's hint got me to dig deeper into why I am getting the empty 
GetExtensionsString().

Looking at the sources, the reason why it returns an empty string is 
because of this #define:
VTK_NO_EXTENSION_LOADING
which causes vtkOpenGLExtensionManager::ReadOpenGLExtensions() to set 
the extensions to empty string
This #define gets into play from #include'd 
vtkOpenGLExtensionManagerConfigure.h which contains only the following:

/* #undef VTK_USE_WGL_GET_PROC_ADDRESS */
/* #undef VTK_USE_APPLE_LOADER */
/* #undef VTK_USE_GLX_GET_PROC_ADDRESS */
/* #undef VTK_USE_GLX_GET_PROC_ADDRESS_ARB */
/* #undef VTK_USE_VTK_DYNAMIC_LOADER */
*#define VTK_NO_EXTENSION_LOADING*

/* #undef VTK_DEFINE_GLX_GET_PROC_ADDRESS_PROTOTYPE */

// If using vtkDynamicLoader, we need to know where the libraries are.
#define OPENGL_LIBRARIES 
"/usr/lib/x86_64-linux-gnu/libGLU.so;/usr/lib/x86_64-linux-gnu/libGL.so;/usr/lib/x86_64-linux-gnu/libSM.so;/usr/lib/x86_64-linux-gnu/libICE.so;/usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so"

This #define must have gotten there when configuring the VTK build. I 
tried to search CMakeLists.txt for VTK_NO_EXTENSION_LOADING and it 
appers in this section (which I admit I have no clue about):
IF(VTK_USE_X)
       CHECK_FUNCTION_EXISTS(glXGetProcAddressARB 
VTK_USE_GLX_GET_PROC_ADDRESS_ARB)
       IF (VTK_USE_GLX_GET_PROC_ADDRESS_ARB)
         IF (NOT 
"${VTK_GLX_GET_PROC_ADDRESS_ARB_PROTOTYPE_EXISTS_INCLUDES}" STREQUAL 
"${OPENGL_INCLUDE_DIR}")
           # The OpenGL includes changed.  Retest glXGetProcAddressARB 
prototype.
SET(VTK_GLX_GET_PROC_ADDRESS_ARB_PROTOTYPE_EXISTS_TESTED 0)
         ENDIF (NOT 
"${VTK_GLX_GET_PROC_ADDRESS_ARB_PROTOTYPE_EXISTS_INCLUDES}" STREQUAL 
"${OPENGL_INCLUDE_DIR}")
         IF (NOT VTK_GLX_GET_PROC_ADDRESS_ARB_PROTOTYPE_EXISTS_TESTED)
           MESSAGE(STATUS "Looking for glXGetProcAddressARB in GL/glx.h")
TRY_COMPILE(VTK_GLX_GET_PROC_ADDRESS_ARB_PROTOTYPE_EXISTS
             ${CMAKE_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/CheckglXGetProcAddressARB.cxx
             CMAKE_FLAGS 
"-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}"
"-DINCLUDE_DIRECTORIES:STRING=${OPENGL_INCLUDE_DIR}"
             OUTPUT_VARIABLE OUTPUT)
           MESSAGE(STATUS "Looking for glXGetProcAddressARB in GL/glx.h 
- ${VTK_GLX_GET_PROC_ADDRESS_ARB_PROTOTYPE_EXISTS}")
           FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeOutput.log
             "Determining if glXGetProcAddressARB exists in GL/glx.h 
${VTK_GLX_GET_PROC_ADDRESS_ARB_PROTOTYPE_EXISTS} with the following 
output:\n"
             "${OUTPUT}\n\n")
SET(VTK_GLX_GET_PROC_ADDRESS_ARB_PROTOTYPE_EXISTS_TESTED 1
             CACHE INTERNAL "Already set 
VTK_GLX_GET_PROC_ADDRESS_ARB_PROTOTYPE_EXISTS")
SET(VTK_GLX_GET_PROC_ADDRESS_ARB_PROTOTYPE_EXISTS_INCLUDES
             "${OPENGL_INCLUDE_DIR}"
             CACHE INTERNAL "OpenGL includes used to test 
glXGetProcAddressARB prototype.")
         ENDIF (NOT VTK_GLX_GET_PROC_ADDRESS_ARB_PROTOTYPE_EXISTS_TESTED)
         IF (NOT VTK_GLX_GET_PROC_ADDRESS_ARB_PROTOTYPE_EXISTS)
           SET(VTK_DEFINE_GLX_GET_PROC_ADDRESS_PROTOTYPE 1)
         ENDIF (NOT VTK_GLX_GET_PROC_ADDRESS_ARB_PROTOTYPE_EXISTS)
       ELSE (VTK_USE_GLX_GET_PROC_ADDRESS_ARB)
         CHECK_FUNCTION_EXISTS(glXGetProcAddress 
VTK_USE_GLX_GET_PROC_ADDRESS)
         IF (NOT VTK_USE_GLX_GET_PROC_ADDRESS)
           #         SET(VTK_USE_VTK_DYNAMIC_LOADER 1)
           MESSAGE(STATUS "Could not find extension loader. Extensions 
disabled.")
*          SET(VTK_NO_EXTENSION_LOADING 1)*
         ENDIF (NOT VTK_USE_GLX_GET_PROC_ADDRESS)
       ENDIF (VTK_USE_GLX_GET_PROC_ADDRESS_ARB)
     ELSE(VTK_USE_X)
*      SET(VTK_NO_EXTENSION_LOADING 1)*
     ENDIF(VTK_USE_X)

When configuring VTK, the cmake option VTK_OPENGL_HAS_OSMESA was OFF, if 
it matters at all.
Some other openGL options in cmake config:
  OPENGL_INCLUDE_DIR /usr/include
  OPENGL_gl_LIBRARY /usr/lib/x86_64-linux-gnu/libGL.so
  OPENGL_glu_LIBRARY /usr/lib/x86_64-linux-gnu/libGLU.so
  OPENGL_xmesa_INCLUDE_DIR OPENGL_xmesa_INCLUDE_DIR-NOTFOUND

Now after I installed nvidia propriatory driver, I got another libGL.so 
in /usr/lib/nvidia-310/libGL.so so I re-configured vtk with
OPENGL_gl_LIBRARY                /usr/lib/nvidia-310/libGL.so
instead and recompiled, but it didn't change things. The 
vtkOpenGLExtensionManagerConfigure.h still #defines 
VTK_NO_EXTENSION_LOADING.

The tests (thanks burlen!) show the following:

$ ctest -R LoadOpenGL --verbose | grep GL_
203: GL_VENDOR: NVIDIA Corporation
203: GL_VERSION: 4.3.0 NVIDIA 310.44
203: GL_RENDERER: GeForce GT 520/PCIe/SSE2
Errors while running CTest

The relevant failed line was this:
The following tests FAILED:
     203 - LoadOpenGLExtension (Failed)

Then the Tests binary shows nvidia's libGL.so in use, as expected:
$ ldd bin/RenderingCxxTests | grep GL
     libGL.so.1 => /usr/lib/nvidia-310/libGL.so.1 (0x00007f75d8888000)

But most interestingly,
ctest -R GPURay
all tests in this battery pass, only one segfaults:

  8/17 Test #303: TestGPURayCastDataTypesMinIP 
.....................***Exception: SegFault  0.02 sec

That being said, I see the renderwindow flicker, but I don't see any 
content (e.g. sphere) rendered. I'd like to run the tests in interactive 
mode, but not sure how?

I could build the latest vtk version from git and see whether I can 
replicate the issue there if you think it would make debugging easier.

Some more info on my system:
Installed OpenGL-related packages:
$ sudo dpkg-query -l | egrep -i 'mesa|opengl'
ii  compiz-core 1:0.9.9~daily13.06.19~13.04-0ubuntu1       amd64        
OpenGL window and compositing manager
ii  compiz-plugins-default 1:0.9.9~daily13.06.19~13.04-0ubuntu1       
amd64        OpenGL window and compositing manager - default plugins
ii  glew-utils 1.9.0.is.1.8.0-0ubuntu1                    amd64        
OpenGL Extension Wrangler - utilities
ii  libegl1-mesa:amd64 9.1.3-0ubuntu0.3                           
amd64        free implementation of the EGL API -- runtime
ii  libegl1-mesa-dev 9.1.3-0ubuntu0.3                           
amd64        free implementation of the EGL API -- development files
ii  libegl1-mesa-drivers:amd64 
9.1.3-0ubuntu0.3                           amd64        free 
implementation of the EGL API -- hardware drivers
ii  libgl1-mesa-dev 9.1.3-0ubuntu0.3                           
amd64        free implementation of the OpenGL API -- GLX development files
ii  libgl1-mesa-dri:amd64 9.1.3-0ubuntu0.3                           
amd64        free implementation of the OpenGL API -- DRI modules
ii  libgl1-mesa-dri-dbg:amd64 9.1.3-0ubuntu0.3                           
amd64        Debugging symbols for the Mesa DRI modules
ii  libgl1-mesa-glx:amd64 9.1.3-0ubuntu0.3                           
amd64        free implementation of the OpenGL API -- GLX runtime
ii  libgl2ps0 1.3.6-1                                    amd64        
Lib providing high quality vector output for OpenGL application
ii  libglapi-mesa:amd64 9.1.3-0ubuntu0.3                           
amd64        free implementation of the GL API -- shared library
ii  libgles2-mesa:amd64 9.1.3-0ubuntu0.3                           
amd64        free implementation of the OpenGL|ES 2.x API -- runtime
ii  libglew1.8:amd64 1.9.0.is.1.8.0-0ubuntu1                    
amd64        OpenGL Extension Wrangler - runtime environment
ii  libglewmx1.8:amd64 1.9.0.is.1.8.0-0ubuntu1                    
amd64        OpenGL Extension Wrangler (Multiple Rendering Contexts)
ii  libglu1-mesa:amd64 9.0.0-0ubuntu1                             
amd64        Mesa OpenGL utility library (GLU)
ii  libglu1-mesa-dev 9.0.0-0ubuntu1                             
amd64        Mesa OpenGL utility library -- development files
ii  libopenvg1-mesa:amd64 9.1.3-0ubuntu0.3                           
amd64        free implementation of the OpenVG API -- runtime
ii  libopenvg1-mesa-dev 9.1.3-0ubuntu0.3                           
amd64        free implementation of the OpenVG API -- development files
ii  libqt4-opengl:amd64 4:4.8.4+dfsg-0ubuntu9.2                    
amd64        Qt 4 OpenGL module
ii  libreoffice-ogltrans 1:4.0.2-0ubuntu1                           
amd64 LibreOffice Impress extension for transitions using OpenGL
ii  libtxc-dxtn-s2tc0:amd64 0~git20121227-1                            
amd64        Texture compression library for Mesa
ii  mesa-common-dev 9.1.3-0ubuntu0.3                           
amd64        Developer documentation for Mesa
ii  mesa-utils 8.0.1+git20110129+d8f7d6b-0ubuntu2         amd64 
Miscellaneous Mesa GL utilities
ii  x11proto-gl-dev 1.4.16-1                                   
all          X11 OpenGL extension wire protocol

Thanks again!
Miro





On 09/11/2013 03:08 PM, burlen wrote:
> also, did you call "renWin->Render()" once before using the extension 
> manager? or class that uses the extension manager?
>
> On 09/11/2013 02:21 PM, burlen wrote:
>> in your vtk build dir, what does the output of
>>
>>     $ ctest -R LoadOpenGL --verbose | grep GL_
>>
>> say? If it's not reporting the expected versions then you could 
>> verify which driver VTK using with:
>>
>>     $ ldd bin/vtkRenderingVolumeCxxTests | grep GL
>>
>> you may try this also on your app to verify. Do VTK's tests have the 
>> same issue?
>>
>>     $ ctest -R GPURay --verbose
>>
>> if none of this helps, would you be willing to work with the 
>> development version of VTK? it will be easier to find and fix the bug.
>>
>> Burlen
>>
>> On 09/10/2013 07:21 PM, Miro Drahos wrote:
>>> Hi all,
>>> I am having an issue with volume mappers and hope someone can 
>>> provide some constructive feedback.
>>> When trying to use vtkGPUVolumeRayCastMapper rendering fails with 
>>> the message:
>>> ERROR: In 
>>> /home/miro/BUILDS/VTK5.10.1/VolumeRendering/vtkOpenGLGPUVolumeRayCastMapper.cxx, 
>>> line 4011
>>> vtkOpenGLGPUVolumeRayCastMapper (0x12e15ce0): Rendering failed 
>>> because the following OpenGL extensions are required but not 
>>> supported:  OpenGL 1.3 is required but not supported
>>>
>>> If I run
>>> glGetString(GL_VERSION)
>>> I get the correct output string:
>>> 4.3.0 NVIDIA 310.44
>>>
>>> and yet the 
>>> vtkOpenGLExtensionManager::ExtensionSupported("GL_VERSION_1_3") 
>>> somehow returns 0.
>>>
>>> I am using vtk 5.10, my graphics card is NVIDIA GT520, using NVIDIA 
>>> propriatory driver 310.44 on Linux Mint 15 (same thing with 
>>> open-source nouveau driver).
>>> Some terminal output that may be relevant:
>>>
>>> $ glewinfo   | grep GL_VER
>>> GL_VERSION_1_1: OK
>>> GL_VERSION_1_2: OK
>>> GL_VERSION_1_2_1: OK
>>> GL_VERSION_1_3: OK
>>> GL_VERSION_1_4: OK
>>> GL_VERSION_1_5: OK
>>> GL_VERSION_2_0: OK
>>> GL_VERSION_2_1: OK
>>> GL_VERSION_3_0: OK
>>> GL_VERSION_3_1: OK
>>> GL_VERSION_3_2: OK
>>> GL_VERSION_3_3: OK
>>> GL_VERSION_4_0: OK
>>> GL_VERSION_4_1: OK
>>> GL_VERSION_4_2: OK
>>>
>>> $ inxi -Gx
>>> Graphics:  Card: NVIDIA GF119 [GeForce GT 520] bus-ID: 01:00.0
>>>            X.Org: 1.13.3 drivers: nvidia (unloaded: 
>>> fbdev,vesa,nouveau) Resolution: 1920x1080 at 60.0hz, 1920x1080 at 60.0hz
>>>            GLX Renderer: GeForce GT 520/PCIe/SSE2 GLX Version: 4.3.0 
>>> NVIDIA 310.44 Direct Rendering: Yes
>>>
>>>
>>> More puzzling yet it gets when I try to use 
>>> vtkVolumeMapperTexture3D, I get
>>> ERROR: In 
>>> /home/miro/BUILDS/VTK5.10.1/VolumeRendering/vtkOpenGLGPUVolumeRayCastMapper.cxx, 
>>> line 4011
>>> vtkOpenGLGPUVolumeRayCastMapper (0x12e15ce0): Rendering failed 
>>> because the following OpenGL extensions are required but not supported:
>>>
>>> With no list of problem extensions...
>>>
>>> Thank you very much for any input on this!
>>>
>>> ------------------------------------------------------------------------
>>> Miroslav Drahoš
>>> software engineer
>>> <http://www.robodoc.com>
>>> *Curexo Technology Corporation*
>>> 47320 Mission Falls Ct
>>> Fremont CA, 94539
>>> Tel: (510) 249-2300 x2372
>>> Fax: (510) 249-2396
>>> www.robodoc.com <http://www.robodoc.com>
>>>
>>>
>>>
>>> _______________________________________________
>>> Powered bywww.kitware.com
>>>
>>> Visit other Kitware open-source projects athttp://www.kitware.com/opensource/opensource.html
>>>
>>> Please keep messages on-topic and check the VTK FAQ at:http://www.vtk.org/Wiki/VTK_FAQ
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130911/2a21e912/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 7158 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130911/2a21e912/attachment.jpeg>


More information about the vtkusers mailing list