How will it be when in glTexImage2D I choose a different internal format from the way I tried it in the shader?

For example, I write this in code:

glTexImage2D(GL_TEXTURE_2D, i, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);

      

and in the shader:

glFragColor = texture2D(sampler, uv).rgba

      

what will happen, is there an official definition for this situation?

+3


source to share


1 answer


The aspect ratio in the Khronos group spec says:



Image formats don't have to store every component. When a shader samples such a texture, it will still be allowed for a 4-digit RGBA vector. Components not saved in image format are filled in automatically. Zeros are used if R, G, or B are missing, and missing Alpha always resolves to 1.

Note: Rewinding the texture can change missing values.

+3


source







All Articles