Ignore:
Timestamp:
Aug 13, 2012, 9:13:03 AM (8 years ago)
Author:
sam
Message:

gpu: support framebuffer objects on OpenGL ES (depth buffer isn't
supported yet).

File:
1 edited

Legend:

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

    r1523 r1731  
    6262#if defined USE_D3D9 || defined _XBOX
    6363    /* FIXME: not implemented on Direct3D */
    64 #elif GL_VERSION_1_1
    65     GLenum format = GL_RGBA8;
     64#else
     65#   if GL_VERSION_1_1
     66    GLenum internal_format = GL_RGBA8;
     67    GLenum format = GL_BGRA;
    6668    GLenum depth = GL_DEPTH_COMPONENT;
     69#   else
     70    GLenum internal_format = GL_RGBA;
     71    GLenum format = GL_RGBA;
     72#   endif
    6773    GLenum wrapmode = GL_REPEAT;
    6874    GLenum filtering = GL_NEAREST;
     
    7884    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (GLenum)filtering);
    7985    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, (GLenum)filtering);
    80     glTexImage2D(GL_TEXTURE_2D, 0, (GLenum)format, size.x, size.y, 0,
    81                  GL_BGRA, GL_UNSIGNED_BYTE, NULL);
     86    glTexImage2D(GL_TEXTURE_2D, 0, internal_format, size.x, size.y, 0,
     87                 format, GL_UNSIGNED_BYTE, NULL);
    8288
    8389    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
    8490                           GL_TEXTURE_2D, m_data->m_texture, 0);
    8591    m_data->m_depth = GL_INVALID_ENUM;
     92#   if GL_VERSION_1_1
     93    /* FIXME: not implemented on GL ES, see
     94     * http://stackoverflow.com/q/4041682/111461 */
    8695    if (depth != GL_INVALID_ENUM)
    8796    {
     
    92101                                  GL_RENDERBUFFER, m_data->m_depth);
    93102    }
     103#   endif
    94104    glCheckFramebufferStatus(GL_FRAMEBUFFER);
    95105
    96106    Unbind();
    97 #else
    98     /* FIXME: not implemented on GL ES, see
    99      * http://stackoverflow.com/q/4041682/111461 */
    100107#endif
    101108}
Note: See TracChangeset for help on using the changeset viewer.