[vtkusers] Fwd: Run VTK with OpenGL ES 2.0 backend

Konrad LEY konrad.ley at valeo.com
Wed Jul 11 07:25:16 EDT 2018


---------- Forwarded message ---------
From: Konrad LEY <konrad.ley at valeo.com>
Date: Mon, Jul 2, 2018 at 3:50 PM
Subject: Re: [vtkusers] Run VTK with OpenGL ES 2.0 backend
To: <dan.lipsa at kitware.com>


Hello Dan,

thank you very much for the info.

What a pity! Is there no chance for me to manually switch to the OpenGL ES
backend?

What you are saying is also what i'm experiencing:

For example when i run the simple Sphere example
https://www.vtk.org/Wiki/VTK/Examples/Cxx/GeometricObjects/Sphere i get the
output:

sh-4.3# ./Sphere
libGL error: unable to load driver: xilinx_drm_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: xilinx_drm
ERROR: In
/home/root/Downloads/VTK-8.1.1/Rendering/OpenGL2/vtkOpenGLRenderWindow.cxx,
line 785
vtkXOpenGLRenderWindow (0x19641d50): GLEW could not be initialized.


Segmentation fault


According to this post
https://forums.xilinx.com/t5/Embedded-Linux/libGL-error-unable-to-load-driver-xilinx-drm-dri-so/td-p/853905
that means that vtk is not using OpenGL ES 2.

When i force vtk to use EGLRenderWindow and change the Code of the simple
Sphere example to:


#include <vtkSphereSource.h>
#include <vtkPolyData.h>
#include <vtkSmartPointer.h>
#include <vtkPolyDataMapper.h>
#include <vtkActor.h>
#include <vtkEGLRenderWindow.h>
#include <vtkRenderer.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkNamedColors.h>
#include <vtkProperty.h>

int main(int, char *[])
{
  vtkSmartPointer<vtkNamedColors> colors =
    vtkSmartPointer<vtkNamedColors>::New();

  // Create a sphere
  vtkSmartPointer<vtkSphereSource> sphereSource =
    vtkSmartPointer<vtkSphereSource>::New();
  sphereSource->SetCenter(0.0, 0.0, 0.0);
  sphereSource->SetRadius(5.0);
  // Make the surface smooth.
  sphereSource->SetPhiResolution(100);
  sphereSource->SetThetaResolution(100);

  vtkSmartPointer<vtkPolyDataMapper> mapper =
    vtkSmartPointer<vtkPolyDataMapper>::New();
  mapper->SetInputConnection(sphereSource->GetOutputPort());

  vtkSmartPointer<vtkActor> actor =
    vtkSmartPointer<vtkActor>::New();
  actor->SetMapper(mapper);
  actor->GetProperty()->SetColor(colors->GetColor3d("Cornsilk").GetData());

  vtkSmartPointer<vtkRenderer> renderer =
    vtkSmartPointer<vtkRenderer>::New();
  vtkSmartPointer<vtkRenderWindow> renderWindow =
    vtkSmartPointer<vtkEGLRenderWindow>::New();
  renderWindow->SetWindowName("Sphere");
  renderWindow->AddRenderer(renderer);
//  vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
//    vtkSmartPointer<vtkRenderWindowInteractor>::New();
//  renderWindowInteractor->SetRenderWindow(renderWindow);

  renderer->AddActor(actor);
  renderer->SetBackground(colors->GetColor3d("DarkGreen").GetData());

  renderWindow->Render();
//  renderWindowInteractor->Start();

  return EXIT_SUCCESS;
}


I get the error message:

Warning: In
/home/root/Downloads/VTK-8.1.1/Rendering/OpenGL2/vtkEGLRenderWindow.cxx,
line 273
vtkEGLRenderWindow (0x1ca53d50): Setting an EGL display to device index: 0
require EGL_EXT_device_base EGL_EXT_platform_device EGL_EXT_platform_base
extensions

ERROR: In
/home/root/Downloads/VTK-8.1.1/Rendering/OpenGL2/vtkEGLRenderWindow.cxx,
line 356
vtkEGLRenderWindow (0x1ca53d50): No matching EGL configuration found.

ERROR: In
/home/root/Downloads/VTK-8.1.1/Rendering/OpenGL2/vtkOpenGLRenderWindow.cxx,
line 785
vtkEGLRenderWindow (0x1ca53d50): GLEW could not be initialized.

Segmentation fault

So still VTK wants to use GLEW, thus full OpenGL.

Is there a way to configure/patch VTK so it uses OpenGL ES 2.0 like in the
Android configuration?

Konrad

On Thu, Jul 5, 2018 at 3:51 PM Dan Lipsa <dan.lipsa at kitware.com> wrote:

> Konrad,
> I believe OpenGL ES is only supported for mobile architectures
> https://blog.kitware.com/building-vtk-for-mobile-architectures/
>
> The desktop version, including the version compiled for EGL requires full
> OpenGL
>
> https://blog.kitware.com/off-screen-rendering-through-the-native-platform-interface-egl/
>
> Dan
>
>
> On Wed, Jun 27, 2018 at 11:33 AM Konrad LEY <konrad.ley at valeo.com> wrote:
>
>> Hello,
>>
>> I'm trying to run VTK on a Ultra96 board, which has a Mali-400 MP2 gpu
>> supporting OpenGL ES 2.0.
>> According to https://blog.kitware.com/raspberry-pi-likes-vtk/ VTK has a
>> OpenGL ES 2.0 backend and runs on EGL.
>> So I installed the libmali-dev package of my petalinux linux
>> distribution, which is providing me the following files:
>>
>> /usr/include/EGL/egl.h
>> /usr/include/EGL/eglext.h
>> /usr/include/EGL/eglplatform.h
>> /usr/include/GLES/gl.h
>> /usr/include/GLES/glext.h
>> /usr/include/GLES/glplatform.h
>> /usr/include/GLES2/gl2.h
>> /usr/include/GLES2/gl2ext.h
>> /usr/include/GLES2/gl2platform.h
>> /usr/include/KHR/khrplatform.h
>> /usr/lib/libEGL.so
>> /usr/lib/libGLESv1_CM.so
>> /usr/lib/libGLESv2.so
>> /usr/lib/libMali.so
>> /usr/lib/pkconfig/egl.pc
>> /usr/lib/pkconfig/glesv1.pc
>> /usr/lib/pkconfig/glesv1_cm.pc
>> /usr/lib/pkgconfig/glesv2.pc
>>
>> I can compile and run examples using OpenGL ES 2.0 now.
>>
>> Then I downloaded latest VTK-8.1.1 and ran cmake in the build folder. It
>> complained about not finding OpenGL so I also installed libgl-mesa-dev
>> package which is providing me:
>>
>> /usr/include/GL/gl.h
>> /usr/include/GL/gl_mangle.h
>> /usr/include/GL/glcorearb.h
>> /usr/include/GL/glext.h
>> /usr/include/GL/interal/dri_interface.h
>> /usr/include/GL/mesa_glinterop.h
>> /usr/include/GL/osmesa.h
>> /usr/include/GL/wglext.h
>> /usr/lib/libGL.la
>> /usr/lib/libGL.so
>> /usr/lib/pkgconfig/gl.pc
>>
>> After that CMake configuration completed.
>>
>> In the CMakeCache.txt I found out that VTK_HAS_EGL was set to OFF. I
>> turned it ON.
>> Then cmake complained about not finding EGL. So I had to manually set
>>
>> EGL_INCLUDE_DIR=/usr/include/EGL
>> EGL_LIBRARY=/usr/lib/libEGL.so
>> EGL_opengl_LIBRARY=/usr/lib/libGLESv2.so
>>
>> Compiling and installing works fine, but when I run the Sphere example it
>> returns the error:
>>
>>  ~# ./Sphere
>>  libGL error: unable to load driver: xilinx_drm_dri.so
>>  libGL error: driver pointer missing
>>  libGL error: failed to load driver: xilinx_drm
>>  ERROR: In
>> /home/root/Downloads/VTK-8.1.1/Rendering/OpenGL/vtkOpenGLRenderWindow.cxx,
>> line 785
>>  vtkXOpenGLRenderWindow (0x25503fc0): GLEW could not be initialized.
>>
>>  Segmentation fault
>>
>> How can I build for OpenGL ES 2.0 only?
>>
>> Correct me but I think there's something wrong when I have to install
>> OpenGL with the libgl-mesa-dev package. Also GLEW is for Desktop OpenGL
>> only?
>>
>> --
>> Viele Grüße / Best regards / Sincères
>> <http://dict.leo.org/frde/index_de.html#/search=Sinc%C3%A8res&searchLoc=1&resultOrder=basic&multiwordShowSingle=on&pos=2>
>>  salutations
>> <http://dict.leo.org/frde/index_de.html#/search=salutations&searchLoc=1&resultOrder=basic&multiwordShowSingle=on&pos=2>
>> Konrad Ley
>>
>> System Engineer Software
>> Comfort and Driving Assistance Systems (CDA)
>> Driving Assistance Research (DAR)
>> Site Kronach
>> Hummendorfer Str. 72
>> 96317 Kronach
>>
>> Phone:
>> E-Mail: konrad.ley at valeo.com <vorname.nachname at valeo.com>
>>
>> Valeo Schalter und Sensoren GmbH
>> Laiernstrasse 12
>> 74321 Bietigheim-Bissingen,
>> Sitz der Gesellschaft: 74321 Bietigheim-Bissingen
>> Handelsregister: Amtsgericht Stuttgart - HRB 301795
>> Vorsitzender des Aufsichtsrates: Derrick Zechmair
>> Geschäftsführer: Jens Hälker, Martin Mandry, Stiv Michael Smudja, Pierre-Yves
>> Veltois
>>
>> *This e-mail message is intended only for the use of the intended recipient(s).
>> The information contained therein may be confidential or privileged,
>> and its disclosure or reproduction is strictly prohibited.
>> If you are not the intended recipient, please return it immediately to its sender
>> at the above address and destroy it. *
>>
>>
>> *This e-mail message is intended for the internal use of the intended recipient(s) only.
>> The information contained herein is confidential/privileged. Its disclosure or reproduction is strictly prohibited.
>> If you are not the intended recipient, please inform the sender immediately, do not disclose it internally or to third parties and destroy it.*
>>
>> _______________________________________________
>> 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:
>> https://public.kitware.com/mailman/listinfo/vtkusers
>>
>

-- 
Viele Grüße / Best regards / Sincères
<http://dict.leo.org/frde/index_de.html#/search=Sinc%C3%A8res&searchLoc=1&resultOrder=basic&multiwordShowSingle=on&pos=2>
 salutations
<http://dict.leo.org/frde/index_de.html#/search=salutations&searchLoc=1&resultOrder=basic&multiwordShowSingle=on&pos=2>
Konrad Ley

System Engineer Software
Comfort and Driving Assistance Systems (CDA)
Driving Assistance Research (DAR)
Site Kronach
Hummendorfer Str. 72
96317 Kronach

Phone:
E-Mail: konrad.ley at valeo.com <vorname.nachname at valeo.com>





Valeo Schalter und Sensoren GmbH
Laiernstrasse 12
74321 Bietigheim-Bissingen,
Sitz der Gesellschaft: 74321 Bietigheim-Bissingen
Handelsregister: Amtsgericht Stuttgart - HRB 301795
Vorsitzender des Aufsichtsrates: Derrick Zechmair
Geschäftsführer: Jens Hälker, Martin Mandry, Stiv Michael Smudja, Pierre-Yves
Veltois

*This e-mail message is intended only for the use of the intended recipient(s).
The information contained therein may be confidential or privileged,
and its disclosure or reproduction is strictly prohibited.
If you are not the intended recipient, please return it immediately to
its sender
at the above address and destroy it. *



-- 
Viele Grüße / Best regards / Sincères
<http://dict.leo.org/frde/index_de.html#/search=Sinc%C3%A8res&searchLoc=1&resultOrder=basic&multiwordShowSingle=on&pos=2>
 salutations
<http://dict.leo.org/frde/index_de.html#/search=salutations&searchLoc=1&resultOrder=basic&multiwordShowSingle=on&pos=2>
Konrad Ley

System Engineer Software
Comfort and Driving Assistance Systems (CDA)
Driving Assistance Research (DAR)
Site Kronach
Hummendorfer Str. 72
96317 Kronach

Phone:
E-Mail: konrad.ley at valeo.com <vorname.nachname at valeo.com>





Valeo Schalter und Sensoren GmbH
Laiernstrasse 12
74321 Bietigheim-Bissingen,
Sitz der Gesellschaft: 74321 Bietigheim-Bissingen
Handelsregister: Amtsgericht Stuttgart - HRB 301795
Vorsitzender des Aufsichtsrates: Derrick Zechmair
Geschäftsführer: Jens Hälker, Martin Mandry, Stiv Michael Smudja, Pierre-Yves
Veltois

*This e-mail message is intended only for the use of the intended recipient(s).
The information contained therein may be confidential or privileged,
and its disclosure or reproduction is strictly prohibited.
If you are not the intended recipient, please return it immediately to
its sender
at the above address and destroy it. *

-- 
*This e-mail message is intended for the internal use of the intended 
recipient(s) only.
The information contained herein is 
confidential/privileged. Its disclosure or reproduction is strictly 
prohibited.
If you are not the intended recipient, please inform the sender 
immediately, do not disclose it internally or to third parties and destroy 
it.*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20180711/1c1091d6/attachment.html>


More information about the vtkusers mailing list