glCompressedTexImage2D JOGL
gl.glCompressedTexImage2D(GL.GL_TEXTURE_2D, 0, GL.GL_COMPRESSED_RGB, width, height, 0, nDataBytes, bb);
What should be the layout of data in the byte buffer bb?
I'm currently using
256*3 bytes for palette colors
followed by
width x height byte indices
i.e. nDataBytes = 256 * 3 + width * height
But I get INVALID_VALUE when querying glGetError.
Is the format wrongly specified? or nDataBytes has incorrect value?
Summarizing, I have a palettised texture with 256 3byte palette entries and 256 x 256 1byte indices. How do I load this texture into OpenGL?
Thanks in advance.
Quote:Original post by MARS_999
BTW you do have the data in bb compressed to a correct format?
This is what I'm trying to figure out!
If I use GL_COMPRESSED_RGB as the format, what should be the contents of bb?
No, I get green textures. For textures with alpha, it renders white.
Btw, as I mentioned previously, glCompressedTexImage2D executes with an INVALID_VALUE error.
Btw, as I mentioned previously, glCompressedTexImage2D executes with an INVALID_VALUE error.
GL_INVALID_VALUE is generated if imageSize is not consistent with the format, dimensions, and contents of the specified compressed image data.
yes, that is what the doc says.
So what should these parameters be?
The data that I have is a palette with 256 colors each containing 3 (RGB) bytes of data.
And 256 x 256 indices 1byte each. Now how do I pass this info to OpenGL??
Thanks.
So what should these parameters be?
The data that I have is a palette with 256 colors each containing 3 (RGB) bytes of data.
And 256 x 256 indices 1byte each. Now how do I pass this info to OpenGL??
Thanks.
Quote:What should be the layout of data in the byte buffer bb?
The glCompressedTexImage call takes an already compressed image in a format like S3TC, while you want to pass in a palette image to GL. Most GPUs don't support palette images anymore as far as I know. You should manually dereference the color indexes and pass in the data as RGB8 with glTexImage2D.
Quote:Original post by Momoko_Fan
Most GPUs don't support palette images anymore as far as I know. You should manually dereference the color indexes and pass in the data as RGB8 with glTexImage2D.
Thanks, that helps. Since OpenGLES does support palette images, I was under the impression that such a feature should be available with OpenGL as well.
Quote:Original post by chand81Quote:Original post by Momoko_Fan
Most GPUs don't support palette images anymore as far as I know. You should manually dereference the color indexes and pass in the data as RGB8 with glTexImage2D.
Thanks, that helps. Since OpenGLES does support palette images, I was under the impression that such a feature should be available with OpenGL as well.
This is not entirely correct.
Firstly, OpenGL does have support for palette texture. The reason you cannot use them is because the hardware vendors chose not to support them. And, even OpenGL ES, you still requires hardware support for maximum performance. So, more than likely, you would have to worry about whether your hardware support palette texture or not.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement