PDA

View Full Version : 3D texture and GL_LUMINANCE8



zedrummer
09-25-2013, 09:35 AM
Hello

With the code:


glTexImage3D(GL_TEXTURE_2D_ARRAY_EXT,0,GL_LUMINANC E8,512,512,2,0,GL_LUMINANCE,GL_UNSIGNED_BYTE,tex2D array);

(tex2Darray pointing to a GLubyte array of the right dimension 512*512*2 bytes)

glGetError() gives the value 0x500 "GL_INVALID_ENUM"

Is there a problem with arrays of 2D texture with GL_LUMINANCE8?

Perhaps should I use glTexStorage3D() and glTexSubImage3D()? But what should be the "internalformat" of the first and the "format" and "type" of the second to accept GL_LUMINANCE8 texture?

Thanks
Cathy L.

zedrummer
09-25-2013, 09:36 AM
Oops that's not the right place for this post, sorry for that, could anybody move it? Thanks ans sorry again :-[

GClements
09-26-2013, 12:09 AM
Is there a problem with arrays of 2D texture with GL_LUMINANCE8?
Which version?

OpenGL 2 doesn't have GL_TEXTURE_2D_ARRAY_EXT (or GL_TEXTURE_2D_ARRAY).
GL_TEXTURE_2D_ARRAY_EXT is only available if the EXT_texture_array extension is available.
OpenGL 3 has GL_TEXTURE_2D_ARRAY but the core profile doesn't have GL_LUMINANCE or GL_LUMINANCE8.

EXT_texture_array was written against 2.0, so if you have EXT_texture_array, I believe that it should work. In OpenGL 3 compatibility profile, it should work with GL_TEXTURE_2D_ARRAY.

zedrummer
09-26-2013, 07:18 AM
Which version?

OpenGL 3 has GL_TEXTURE_2D_ARRAY but the core profile doesn't have GL_LUMINANCE or GL_LUMINANCE8.



Hello
Thanks for your answer.
I'm switching old OpenGL 1 code to 3.3 and I didn't know that GL_LUMINANCE/8 was deprecated. Thanks to you, I discovered that. Now googling around, I found that the way to load 1-byte monochrome texture is to use GL_RED.

Thanks again
Cathy L.