Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between GL_TEXTURE_2D and GL_TEXTURE_EXTERNAL_OES

I'm new to OpenGL ES in android development. I found two types of texture during my study:

  1. GL_TEXTURE_2D
  2. GL_TEXTURE_EXTERNAL_OES

I was told that they are not compatible with each other.

I have two questions:

  1. What's the difference between them? Are they completely different types of textures?
  2. Does GL_TEXTURE_EXTERNAL_OES texture has to be YUV format? If not, what decides the data format?
like image 769
Jian Guo Avatar asked Dec 20 '18 08:12

Jian Guo


People also ask

What are external textures in 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).

What is the relationship between texture coordinates and resolution in OpenGL?

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.

What is the difference between normal textures and external textures?

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.

How many texture units can I use with OpenGL?

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.


1 Answers

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.

like image 128
solidpixel Avatar answered Nov 15 '22 00:11

solidpixel