Alternative to Geometric Shader in OpenGL ES 3.0

141 Views Asked by At

Objective

I would want to render a nifti file in browser with better appearances and better frame rates. I have to use OpenGL ES 3.0 in C++. This code is then being transpiled to JS and Web Assembly code using Emscripten. All I need in solutions in GLES 3.0

Expected Outcome

I expect to pass some vertices(like in OpenGL) and each of these vertices is expected to be the corner of a cube. I think you could call it a voxel.

Ways to solve in OpenGL 3.0

  • I can use geometry shader to create more primitives from the point but this makes each vertex a voxel and is less preferred than the next method because of absence of interpolation. This method has an advantage of offering great frame rates.
  • I could create a GL_ELEMENT_ARRAY_BUFFER. It would take a size of 9*(no. of elements in vertex array)*(4 bytes). I ordered each index so as that a GL_TRIANGLE_FAN would create only 3 adjacent sides of a cube in each vertex. So each vertex corresponts to 9 indices(the 9th index being 0xFFFFFFFF GL_PRIMITIVE_RESTART_FIXED_INDEX). I think there is a much better way using GL_TRIANGLE_STRIP.
  • The 3rd Method is using glDrawArraysInstanced. I not so sure if this supports interpolation between pixels.

The Actual Problem

Rendering it as glDrawArrays(GL_POINTS) itself gives me 25 fps(not enough). My probable hurdles are

  1. Could I just adjust gl_PointSize in the shader code so as to eliminate the space between each vertex I draw and hence get a good 3D image without gaps?(I would need to zoom the object) If so, how would I code that.
  2. I can't use GL_ELEMENT_ARRAY_BUFFER because it takes way too much memory and I have built with the maximum available (4294967296 bytes or 4 GB). So I have to get creative somehow(without geometry shader). If possible I need to interpolate color for each vertex to form individual cubes.
  3. Any other much better alternative for this is well welcomed.

THANKS IN ADVANCE.

I expect to get a solution which might enlighten me. For this to happen it must be something missed by me in the points listed above.

0

There are 0 best solutions below