how to create GL_DEPTH24_STENCIL8_OES tex ?

This topic contains 12 replies, has 4 voices, and was last updated by  mkandula 5 years, 10 months ago.

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #30755

    mkandula
    Member

    Hi,

    I am trying to create a depth24_stencil8 texture for my framebuffer. I need it to be a texture and not render buffer.

    here is the code for it

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    glGenFramebuffers(1, &preLightFBO);

    glBindFramebuffer(GL_FRAMEBUFFER, preLightFBO);

    glGenTextures(1, &preLight_depthTex);

    glBindTexture(GL_TEXTURE_2D, preLight_depthTex);

    glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8_OES, prePassBuffersWidth, prePassBuffersHeight, 0, GL_DEPTH_STENCIL_OES, GL_UNSIGNED_INT_24_8_OES, 0);

    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);

    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, preLight_depthTex, 0);

    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,GL_TEXTURE_2D, preLight_depthTex, 0);

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    I am getting GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT. I check with glError after glTexImage2D, I get GL_INVALID_OPERATION.

    Using these params

    glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_STENCIL_OES, prePassBuffersWidth, prePassBuffersHeight, 0, GL_DEPTH_STENCIL_OES , GL_UNSIGNED_INT_24_8_OES, NULL)

    I get GL_INVALID_VALUE

    I am not doing anything different than whats here

    http://www.khronos.org/registry/gles/extensions/OES/OES_packed_depth_stencil.txt

    Can someone please help me understand why this will not work ?

    #35475

    Arron
    Member

    Hi,

    Your call to glTexImage2D has GL_DEPTH24_STENCIL8_OES as <internalFormat>. According to the spec, only GL_DEPTH_STENCIL_OES is valid. GL_DEPTH24_STENCIL8_OES is valid as <internalFormat> for glRenderbufferStorage.

    #35476

    mkandula
    Member

    Hi,

    Thanks for the reply !

    Doing

    glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_STENCIL_OES, prePassBuffersWidth, prePassBuffersHeight, 0, GL_DEPTH_STENCIL_OES, GL_UNSIGNED_INT_24_8_OES, 0);

         

    is giving me GL_INVALID_VALUE.

    What would cause this then ?

    #35477

    marco
    Member

    Hi,

    do you need the stencil buffer at all?
    Have you checked that the OES_packed_depth_stencil externsion is supported on your device?

    If you don’t need the stencil buffer, we’ve got an example in our SDK that boils down to:

    //Create the shadow map texture
    glGenTextures(1, &m_uiShadowMapTexture);
    glBindTexture(GL_TEXTURE_2D, m_uiShadowMapTexture);

    // Create the depth texture.
    glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, m_ui32ShadowMapSize, m_ui32ShadowMapSize, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL);
    […]
    glGenFramebuffers(1, &m_uiFrameBufferObject);
    glBindFramebuffer(GL_FRAMEBUFFER, m_uiFrameBufferObject);
    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, m_uiShadowMapTexture, 0);

    #35478

    mkandula
    Member

    Hi Marco,

    I have the depth component based FBO texture working and I do need the stencil bufffer for this case.

    My target device is iPhone and iPad which I am sure supports the stencil buffer.

    I am running the PVR SDK windows emulation. What I don’t understand is why

    CPVRTgles2Ext::IsGLExtensionSupported(“GL_OES_packed_depth_stencil”) is returning false on my PC. My graphic card supports shader model 4.0 and even DX9 supports the packed depth stencil !!

    #35479

    marco
    Member

    Hi mkandula,

    the emulation only exposes extensions that are actually available on PowerVR platforms.

    #35480

    mkandula, what version of the SDK are you using?

    #35481

    mkandula
    Member

    OGLES2_WINDOWS_X86EMULATION_2.08.28.0634

    #35482

    marco
    Member

    mkandula,
    Could you download and install the most recent SDK version (2.09.29.0649) and try again?
    It should be supported in that release.

    #35483

    Edit : Whoops, Marco beat me to it.

    GL_OES_packed_depth_stencil was introduced in the 2.9 version of VFrame so you will need to upgrade to use that extension.peter.quayle2012-02-14 13:13:53

    #35484

    mkandula
    Member

    But can someone tell me if this feature is supported on iPad and iPhone4 atleast ?

    #35485

    Arron
    Member

    A good way to check these things is to take a look at the GLBenchmark website.

    Here is the page to the iPhone4 GL environment: http://www.glbenchmark.com/phonedetails.jsp?benchmark=glpro21&D=Apple+iPhone+4&testgroup=gl’ defer async.

    In this case, the iPhone4 does indeed support GL_OES_packed_depth_stencil.

    You should be able to find all major consumer devices on that website.

    #35486

    mkandula
    Member

    Wohoo !! updating sorted this issue out !!

    You guys are the GODs of PVR !!

    Thank you very much !

Viewing 13 posts - 1 through 13 (of 13 total)
You must be logged in to reply to this topic.