opengl-esopengl-es-2.0vtkgoogle-nativeclient

VTK - rendering artifacts with OpenGL ES 2.0


I am trying to run VTK Sphere example on Google Native Client (PNaCl) application which fully supports OpenGL ES 2.0. On Win32 the example works perfectly fine (left image below), but in application that uses GLES2 it renders with artifacts (right image below). Spheres are slightly rotated, so artifacts are better visible. However 2D ImageRotate example works fine with GLES2, so I suspect these artifacts are related to 3D rendering in VTK.

Here is video I've recorded, the rendering issue is better visible on a cube. Some walls of the cube are transparent. Any ideas why? Does VTK fully support GLES2?

Win32 (left) and GL ES 2.0 (right) Win32 (left) and GL ES 2.0 (right)


Solution

  • I finally got it to work as I expect.

    The problem was that I was not setting depth properly while creating OpenGL context (and also samples size - antialiasing issues). If anybody will face this problem in the future, you have to define your attrib list something like that:

    const int32_t attrib_list[] =
    {
        PP_GRAPHICS3DATTRIB_ALPHA_SIZE,     8,
        PP_GRAPHICS3DATTRIB_DEPTH_SIZE,     24,
        PP_GRAPHICS3DATTRIB_SAMPLES,        8,
        PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS, 8,
    
        // ...
    
        PP_GRAPHICS3DATTRIB_NONE,
    };
    

    Now it's rendering properly.