Note that there are some explanatory texts on larger screens.

plurals
  1. POOpenGL ES 2.0 texture is transparent, but does not show OpenGL content behind
    primarykey
    data
    text
    <p>Using <strong>OpenGL ES 2.0</strong> on <strong>iOS 4</strong>.</p> <p>I have an <strong>OpenGL</strong> view that inherits from <strong>UIView</strong>. It is in front of a <strong>UIImageView</strong> that provides a background.</p> <p>I have a .<strong>png</strong> image with transparency that I am using for an <strong>OpenGL</strong> texture.</p> <p>The problem I am having is the transparency of the image in the <strong>OpenGL</strong> view shows through to the image in the <strong>UIImageView</strong> background. I would like to show content in the <strong>OpenGL</strong> view that is behind the elements with the transparent texture.</p> <p>The underneath <strong>OpenGL</strong> texture is being rendered, but any portion that has the transparent texture on top does not show the underneath <strong>OpenGL</strong> texture. It shows the <strong>UIImageView</strong> background.</p> <p>What do I need to do so that the transparency will show content in the <strong>OpenGL</strong> view that is behind the transparent content?</p> <p><strong>EDIT</strong>:</p> <p>I restructured the index array so all elements with transparent textures come at the end and should be rendered after all opaque elements when I call <strong>glDrawElements</strong>.</p> <p>Still having the problem with the transparency.</p> <p>I set up some data so that I have 4 vertices and 6 indices for 2 triangles to draw a square with the opaque texture. There are also 4 vertices and 6 indices for 2 triangles to draw a square with the transparent texture which come after the other entries in the vertex/index arrays. The transparent element coordinates render it in front of the opaque element.</p> <p>I can see the transparent element, and I can also see the edges of the opaque element sticking out from behind. However, instead of showing the opaque element which lies immediately behind the transparent element, the transparency goes right through and shows the background of the view behind the OpenGL view.</p> <p>Opaque yellow square:</p> <p><img src="https://i.stack.imgur.com/EPg1b.png" alt="Opaque yellow square"></p> <p>Transparent test image:</p> <p><img src="https://i.stack.imgur.com/435mv.png" alt="Transparent test image"></p> <p>The transparent image covers the opaque image but the transparency shows the background not the opaque image behind:</p> <p><img src="https://i.stack.imgur.com/zjrvh.png" alt="enter image description here"><img src="https://i.stack.imgur.com/Ci183.png" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload