Login  Register

TextureData Object for depth texture

Posted by Overkill on Jul 07, 2017; 7:57pm
URL: https://forum.jogamp.org/TextureData-Object-for-depth-texture-tp4038062.html

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!