Skip to content

Instantly share code, notes, and snippets.

@onslauth
Last active September 9, 2019 12:15
Show Gist options
  • Save onslauth/75127b022584e1ed2a07f5f1f1f5687e to your computer and use it in GitHub Desktop.
Save onslauth/75127b022584e1ed2a07f5f1f1f5687e to your computer and use it in GitHub Desktop.
OpenGL ES 2.0 Rendering

Problem:

I am trying to draw two planes that are intersected by a cylinder through the center of each plane.

When changing the alpha value of the planes, I would like them to become transparent, and show both the cylinder as well as the other plane, however this only works correctly when viewing it from behind.

Current settings:

GL_BLEND                    enabled
GL_DEPTH_TEST               enabled
GL_SAMPLE_ALPHA_TO_COVERAGE enabled

BlendFunc         = GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA
BlendFuncSeparate = GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE

Order of drawing:

Draw the planes first, left to right
Draw the cylinder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment