I'm new to OpenGL ES in android development. I found two types of texture during my study:
GL_TEXTURE_2D
GL_TEXTURE_EXTERNAL_OES
I was told that they are not compatible with each other.
I have two questions:
GL_TEXTURE_EXTERNAL_OES
texture has to be YUV
format? If not, what decides the data format?External textures are defined and allocated elsewhere, and imported into OpenGL ES in some implementation-defined manner. One common use is for importing YUV video, so external samplers also have to be able to handle color-space conversion and non-standard memory layouts (e.g. multi-plane YUV surfaces).
Texture coordinates do not depend on resolution but can be any floating point value, thus OpenGL has to figure out which texture pixel (also known as a texel) to map the texture coordinate to. This becomes especially important if you have a very large object and a low resolution texture.
Normal textures are defined, allocated, and managed entirely by OpenGL ES. External textures are defined and allocated elsewhere, and imported into OpenGL ES in some implementation-defined manner.
OpenGL should have a at least a minimum of 16 texture units for you to use which you can activate using GL_TEXTURE0 to GL_TEXTURE15. They are defined in order so we could also get GL_TEXTURE8 via GL_TEXTURE0 + 8 for example, which is useful when we'd have to loop over several texture units.
What's the difference between them?
Normal textures are defined, allocated, and managed entirely by OpenGL ES.
External textures are defined and allocated elsewhere, and imported into OpenGL ES in some implementation-defined manner. One common use is for importing YUV video, so external samplers also have to be able to handle color-space conversion and non-standard memory layouts (e.g. multi-plane YUV surfaces).
Does GL_TEXTURE_EXTERNAL_OES texture has to be YUV format?
No. Some external entity in the system defines the format - it's invisible to the application, and color space conversion is magically handled by the driver stack. Exactly what formats are supported is implementation-defined.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With