JoGL Texture Issue

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

JoGL Texture Issue

The)Dson
This post was updated on .
Using
https://jogamp.org/deployment/jogamp-current/archive/jogamp-fat-all.7z

with Java v1.8 on windows 11 & a RGB8 .png

I'm getting
Chosen GLCapabilities =GLCaps[wgl vid 20 arb: rgba 8/8/8/8, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]]
INIT GL IS            =jogamp.opengl.gl4.GL4bcImpl
textureData.getInternalFormat() =32849= 0x8051
Exception in thread "AWT-EventQueue-0" com.jogamp.opengl.GLException: Caught GLException: format 0x8051 not supported [yet], pls notify the maintainer in case this is our bug. on thread AWT-EventQueue-0
from the init method of an extended GLCanvas
  System.out.prinbtln( "Chosen GLCapabilities =" + drawable.getChosenGLCapabilities());
  System.out.prinbtln( "INIT GL IS            =" + gl.getClass().getName());
  System.out.prinbtln( "textureData.getInternalFormat() =" + textureData.getInternalFormat() + String.format( "= %#x", textureData.getInternalFormat() ) );
  gl.glTexImage2D( GL2.GL_TEXTURE_2D, 0, textureData.getInternalFormat(), textureData.getWidth(), textureData.getHeight(), 0, textureData.getInternalFormat(), textureData.getPixelType(), textureData.getBuffer() );

which equates to GL_RGB8 according to
https://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/constant-values.html#com.jogamp.opengl.GL2.GL_RGB8
which is correct.
But also happens with GL_RGBA8
I would have thought these very common, however, is there a list of platform supported formats ? or can it be obtained programmatically ?
Reply | Threaded
Open this post in threaded view
|

Re: JoGL Texture Issue

gouessej
Administrator
Have you simply looked at our source code?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JoGL Texture Issue

The)Dson
Figured it out by using

gl.glTexImage2D( GL_TEXTURE_2D, 0, 3, textureData.getWidth(), textureData.getHeight(), 0, GL_RGB, textureData.getPixelType(), textureData.getBuffer() );

which is kind of logical, but so was the other way, still it works ! :)
Reply | Threaded
Open this post in threaded view
|

Re: JoGL Texture Issue

Sven Gothel
Administrator
This post was updated on .
thank you .. needs an update in GLBuffers...
Reply | Threaded
Open this post in threaded view
|

Re: JoGL Texture Issue

Sven Gothel
Administrator
Sven Gothel wrote
thank you .. needs an update in GLBuffers...
Nope, you are using the wrong format, i.e.
https://registry.khronos.org/OpenGL-Refpages/gl4/html/glTexImage2D.xhtml
https://registry.khronos.org/OpenGL-Refpages/es3/html/glTexImage2D.xhtml

format

    Specifies the format of the pixel data. The following symbolic values are accepted: GL_RED, GL_RG, GL_RGB, GL_BGR, GL_RGBA, GL_BGRA, GL_RED_INTEGER, GL_RG_INTEGER, GL_RGB_INTEGER, GL_BGR_INTEGER, GL_RGBA_INTEGER, GL_BGRA_INTEGER, GL_STENCIL_INDEX, GL_DEPTH_COMPONENT, GL_DEPTH_STENCIL.
and in your code you pass the internal format as the 7th argument format.

The latter gets used to
Buffers.rangeCheckBytes(pixels, imageSizeInBytes(format,  type, width, height, 1  , false));
inside our glTexImage2D(..) function before passing along to OpenGL.

Hope it helps.