TextureData Object for depth texture

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

TextureData Object for depth texture

Overkill
Creating a TextureData object likse this

    TextureData shadowData = new TextureData(
            gl.getGLProfile(),
            GL_DEPTH_COMPONENT32,
            shadowTextureWidth,
            shadowTextureHeight,
            0,
            GL_DEPTH_COMPONENT,
            GL_FLOAT,
            false,
            false,
            false,
            depthTexture,
            null);

produces the following exception:

    com.jogamp.opengl.GLException: Could not find PixelFormat for format and/or type: PixelAttributes[fmt
    0x1902, type 0x1406, null]

What fails is the creation of a GLPixelAttributes Object:

    GLPixelAttributes glpa = new GLPixelAttributes(GL_DEPTH_COMPONENT, GL_FLOAT);

produces the above exception.
A look into the source code reveals that there is neither a GL_DEPTH_COMPONENT nor GL_FLOAT in the corresponding switch-case construct in the file "GLPixelBuffer.class".
Since I want to use TextureData for storing depth values (Shadow Mapping), I would habe expected this to work.

The following works though, so I am a bit supprised that the TextureData does not work accordingly.

    gl.glTexImage2D(
        GL_TEXTURE_2D,
        0,
        GL_DEPTH_COMPONENT32,
        shadowTextureWidth,
        shadowTextureHeight,
        0,
        GL_DEPTH_COMPONENT,
        GL_FLOAT,
        null);

Thanks for any help!
Reply | Threaded
Open this post in threaded view
|

Re: TextureData Object for depth texture

gouessej
Administrator
Hi

Feel free to contribute. TextureData and Texture don't cover all possible cases, that's why the lower level API is still useful.
Julien Gouesse | Personal blog | Website