Login  Register

Re: GL_RGB or GL_BGR in TEXTURE_2D_ARRAY?

Posted by PJDM on Jun 01, 2011; 4:45am
URL: https://forum.jogamp.org/GL-RGB-or-GL-BGR-in-TEXTURE-2D-ARRAY-tp3008936p3009404.html

There is no .getPixelOrCompressionsFormat() method, but changing the code to the following works, and is obviously more flexible.

        gl.glTexImage3D(GL3.GL_TEXTURE_2D_ARRAY, 0, data.getInternalFormat(), 64, 64, 5, 0, data.getPixelFormat(), GL3.GL_UNSIGNED_BYTE, null);
...
            gl.glTexSubImage3D(GL3.GL_TEXTURE_2D_ARRAY, 0, 0, 0, i, 64, 64, 1, data.getPixelFormat(), GL3.GL_UNSIGNED_BYTE, data.getBuffer());

Yes, hard-coding widths and heights is also bad. :-)

Thanks.

PJDM