Changeset 2792


Ignore:
Timestamp:
Jun 29, 2013, 4:29:20 PM (4 years ago)
Author:
sam
Message:

gpu: add a 16-bit depth buffer to framebuffers on WebGL and GL ES.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gpu/framebuffer.cpp

    r2787 r2792  
    345345    GLenum internal_format = fbo_format.GetFormat();
    346346    GLenum format = fbo_format.GetFormatOrder();
    347 #   else
     347#   elif GL_ES_VERSION_2_0
    348348    /* In OpenGL ES, internal format and format must match. */
    349349    GLenum internal_format = fbo_format.GetFormat();
    350350    GLenum format = fbo_format.GetFormat();
    351 #   endif
    352     GLenum wrapmode = GL_REPEAT;
     351    GLenum depth = GL_DEPTH_COMPONENT16; /* for WebGL */
     352#   else
     353    /* In OpenGL ES, internal format and format must match. */
     354    GLenum internal_format = fbo_format.GetFormat();
     355    GLenum format = fbo_format.GetFormat();
     356#   endif
     357    GLenum wrapmode = GL_CLAMP_TO_EDGE;
    353358    GLenum filtering = GL_NEAREST;
    354359
     
    380385
    381386    m_data->m_depth = GL_INVALID_ENUM;
    382 #   if GL_VERSION_1_1
    383     /* FIXME: not implemented on GL ES, see
    384      * http://stackoverflow.com/q/4041682/111461 */
     387#   if GL_VERSION_1_1 || GL_ES_VERSION_2_0
    385388    if (depth != GL_INVALID_ENUM)
    386389    {
     390        /* XXX: might not work on GL ES, see
     391         * http://stackoverflow.com/q/4041682/111461
     392         * See also http://qt-project.org/forums/viewthread/11734 */
    387393        glGenRenderbuffers(1, &m_data->m_depth);
    388394        glBindRenderbuffer(GL_RENDERBUFFER, m_data->m_depth);
     
    393399#   endif
    394400
     401    glBindTexture(GL_TEXTURE_2D, 0);
     402
    395403#   if GL_VERSION_1_1 || GL_ES_VERSION_2_0
    396404    GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
     
    419427#   endif
    420428    glDeleteTextures(1, &m_data->m_texture);
    421 #   if GL_VERSION_1_1
     429#   if GL_VERSION_1_1 || GL_ES_VERSION_2_0
    422430    if (m_data->m_depth != GL_INVALID_ENUM)
    423431        glDeleteRenderbuffers(1, &m_data->m_depth);
  • trunk/src/lolgl.h

    r2633 r2792  
    6060#endif
    6161
     62#define LOL_CHECK_GLERROR() \
     63    { \
     64        GLenum error = glGetError(); \
     65        ASSERT(error == GL_NO_ERROR, "OpenGL error: 0x%04x\n", error); \
     66    }
     67
    6268#endif // __LOL_LOLGL_H__
    6369
Note: See TracChangeset for help on using the changeset viewer.