Changeset 2748


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

gpu: fix framebuffer handling in OpenGL ES and add some sanity checks.

Location:
trunk
Files:
2 edited

Legend:

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

    r2741 r2748  
    9292    case RGBA_32_F:     return GL_RGBA32F_ARB;
    9393#elif defined HAVE_GLES_2X
    94     /* FIXME: not implemented at all */
    95 
     94    /* FIXME: incomplete */
     95    case RGBA_8:
     96    case RGBA_8_I:
     97    case RGBA_8_UI:     return GL_RGBA;
    9698#elif defined __APPLE__ && defined __MACH__
    9799    case R_8:
     
    222224    /* FIXME: not implemented at all */
    223225#elif defined HAVE_GLES_2X
    224     /* FIXME: not implemented at all */
     226    /* FIXME: incomplete */
     227    case R_8:   case RG_8:   case RGB_8:   case RGBA_8:
     228    case R_8_I: case RG_8_I: case RGB_8_I: case RGBA_8_I:
     229        return GL_BYTE;
     230    case R_8_UI: case RG_8_UI: case RGB_8_UI: case RGBA_8_UI:
     231        return GL_UNSIGNED_BYTE;
    225232#elif defined __APPLE__ && defined __MACH__
    226233    case R_8:   case RG_8:   case RGB_8:   case RGBA_8:
     
    311318    GLenum format = fbo_format.GetFormatOrder();
    312319#   else
     320    /* In OpenGL ES, internal format and format must match. */
    313321    GLenum internal_format = fbo_format.GetFormat();
    314     GLenum format = fbo_format.GetFormatOrder();
     322    GLenum format = fbo_format.GetFormat();
    315323#   endif
    316324    GLenum wrapmode = GL_REPEAT;
     
    328336    glActiveTexture(GL_TEXTURE0);
    329337    glBindTexture(GL_TEXTURE_2D, m_data->m_texture);
    330     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, (GLenum)wrapmode);
    331     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, (GLenum)wrapmode);
    332     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (GLenum)filtering);
    333     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, (GLenum)filtering);
     338    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrapmode);
     339    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrapmode);
     340    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filtering);
     341    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filtering);
    334342    glTexImage2D(GL_TEXTURE_2D, 0, internal_format, size.x, size.y, 0,
    335343                 format, GL_UNSIGNED_BYTE, nullptr);
     
    358366
    359367#   if GL_VERSION_1_1 || GL_ES_VERSION_2_0
    360     glCheckFramebufferStatus(GL_FRAMEBUFFER);
     368    GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
     369    ASSERT(status == GL_FRAMEBUFFER_COMPLETE,
     370           "invalid framebuffer status 0x%x", status);
    361371#   endif
    362372
  • trunk/tutorial/08_fbo.cpp

    r2747 r2748  
    138138    System::Init(argc, argv);
    139139
    140     Application app("Tutorial 08: Framebuffer Object", ivec2(640, 480), 60.0f);
     140    Application app("Tutorial 08: Framebuffer Object", ivec2(512, 512), 60.0f);
    141141
    142142    new FBO();
Note: See TracChangeset for help on using the changeset viewer.