aire39
Posts: 4
Joined: Sat Sep 23, 2017 10:43 am

GL_LUMINANCE is an invalid value for gltexsubimage?

Wed Sep 26, 2018 1:48 am

I'm using gles 2.0 and I wanted to have a single byte format texture. I create a texture without initial data since I will provide the data at a later point in the program.

When I call the glTexSubImage function and set the format parameter to GL_LUMINANCE gles returns an invalid value error code. I doubled checked the documentation for gles 2.0 to be sure the parameter should be valid for this version of gles, which it is. Is there something I may be missing here?

Code: Select all

// initialize texture
glgenTexture(1, &textureHandle);
glBindTexture(GL_TEXTURE_2D, textureHandle);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, width, height, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, NULL);
 
....
 
// update texture data
glBindTexture(GL_TEXTURE_2D, textureHandle[0]);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_LUMINANCE, GL_UNSIGNED_BYTE, y_buffer);  // invalid value error

Return to “OpenGLES”