Loading half float textures using JOGL - possible bug?

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

Loading half float textures using JOGL - possible bug?

mpleasance
I have texture data in half float format that I would like to load into textures.
The call to glTexImage2D fails using GL2.GL_HALF_FLOAT as the type.
Below is the complete call that I make:

                   gl.glTexImage2D(this.texture_[index].getTarget(),
                                   0,
                                   GL2.GL_LUMINANCE16F,
                                   width,
                                   height,
                                   0,
                                   GL.GL_LUMINANCE,
                                   GL2.GL_HALF_FLOAT,
                                   buffer);                  

Calling glGetError afterwards indicates that an invalid enum is being used.
I checked the enum values and GL2.GL_HALF_FLOAT = 36193 (0x8D61).
This corresponds to HALF_FLOAT_OES tokens defined in the OES_vertex_half_float and OES_texture_float extensions against OpenGL 2.0 ES.
http://www.khronos.org/registry/gles/extensions/OES/OES_vertex_half_float.txt
http://www.khronos.org/registry/gles/extensions/OES/OES_texture_float.txt

I believe that the type I want to be using is HALF_FLOAT_ARB which is specified in the ARB_half_float_pixel extension (extension specific to using half float as pixel data).  The value of this token is 5131 (0x140B).
http://www.opengl.org/registry/specs/ARB/half_float_pixel.txt

In JOGL, this value is defined by GL2.GL_HALF_APPLE, but when I try to use this for the type parameter in glTexImage2D I get the following exception:

Caused by: javax.media.opengl.GLException: type 0x140b/format 0x1909 not supported [yet], pls notify the maintainer in case this is our bug.
        at com.jogamp.opengl.util.GLBuffers.sizeof(GLBuffers.java:505)
        at jogamp.opengl.gl4.GL4bcImpl.imageSizeInBytes(GL4bcImpl.java:34462)
        at jogamp.opengl.gl4.GL4bcImpl.glTexImage2D(GL4bcImpl.java:25283)

Inspecting GLBuffers.java, GL2.GL_HALF_APPLE is not in the list of accepted types in the sizeof function.

If I convert my half float data to float and use GL_FLOAT for the type, everything works as expected.
If I keep the data in half float and specify unsigned short, then the call to glTexImage2D works, but it isn't really what I need.

I'm using jogamp 2.0-rc8 and all of the relevant float/half float extensions are present.

Am I doing something wrong or is this a bug?
Reply | Threaded
Open this post in threaded view
|

Re: Loading half float textures using JOGL - possible bug?

Sven Gothel
Administrator
On 06/14/2012 10:07 PM, mpleasance [via jogamp] wrote:

> I have texture data in half float format that I would like to load into textures.
> The call to glTexImage2D fails using GL2.GL_HALF_FLOAT as the type.
> Below is the complete call that I make:
>
>                    gl.glTexImage2D(this.texture_[index].getTarget(),
>                                    0,
>                                    GL2.GL_LUMINANCE16F,
>                                    width,
>                                    height,
>                                    0,
>                                    GL.GL_LUMINANCE,
>                                    GL2.GL_HALF_FLOAT,
>                                    buffer);                  
>
> Calling glGetError afterwards indicates that an invalid enum is being used.
> I checked the enum values and GL2.GL_HALF_FLOAT = 36193 (0x8D61).
> This corresponds to HALF_FLOAT_OES tokens defined in the OES_vertex_half_float
> and OES_texture_float extensions against OpenGL 2.0 ES.
> http://www.khronos.org/registry/gles/extensions/OES/OES_vertex_half_float.txt
> http://www.khronos.org/registry/gles/extensions/OES/OES_texture_float.txt
>
> I believe that the type I want to be using is HALF_FLOAT_ARB which is
> specified in the ARB_half_float_pixel extension (extension specific to using
> half float as pixel data).  The value of this token is 5131 (0x140B).
> http://www.opengl.org/registry/specs/ARB/half_float_pixel.txt
yes, it is a bug - thank you for reporting this, a fix is underway.

https://jogamp.org/bugzilla/show_bug.cgi?id=590

>
> In JOGL, this value is defined by GL2.GL_HALF_APPLE, but when I try to use
> this for the type parameter in glTexImage2D I get the following exception:
>
> Caused by: javax.media.opengl.GLException: type 0x140b/format 0x1909 not
> supported [yet], pls notify the maintainer in case this is our bug.
>         at com.jogamp.opengl.util.GLBuffers.sizeof(GLBuffers.java:505)
>         at jogamp.opengl.gl4.GL4bcImpl.imageSizeInBytes(GL4bcImpl.java:34462)
>         at jogamp.opengl.gl4.GL4bcImpl.glTexImage2D(GL4bcImpl.java:25283)
>
> Inspecting GLBuffers.java, GL2.GL_HALF_APPLE is not in the list of accepted
> types in the sizeof function.
will be fixed as well, adding handling the 'new' HALF_FLOAT_OES.

~Sven


signature.asc (910 bytes) Download Attachment