Jump to content
  • Advertisement
Sign in to follow this  
chand81

OpenGL glCompressedTexImage2D JOGL

This topic is 3804 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
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?

Share this post


Link to post
Share on other sites
No, I get green textures. For textures with alpha, it renders white.
Btw, as I mentioned previously, glCompressedTexImage2D executes with an INVALID_VALUE error.

Share this post


Link to post
Share on other sites
GL_INVALID_VALUE is generated if imageSize is not consistent with the format, dimensions, and contents of the specified compressed image data.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Quote:
Original post by chand81
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.


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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!