src/render/opengles2/SDL_render_gles2.c
changeset 12594 89dbef84cdcb
parent 12531 af47ff0de5ab
child 12595 4ecb6ce33406
equal deleted inserted replaced
12593:307b9da13612 12594:89dbef84cdcb
  1398     GLenum type;
  1398     GLenum type;
  1399     GLenum scaleMode;
  1399     GLenum scaleMode;
  1400 
  1400 
  1401     GLES2_ActivateRenderer(renderer);
  1401     GLES2_ActivateRenderer(renderer);
  1402 
  1402 
       
  1403     renderdata->drawstate.texture = NULL;  /* we trash this state. */
       
  1404 
  1403     /* Determine the corresponding GLES texture format params */
  1405     /* Determine the corresponding GLES texture format params */
  1404     switch (texture->format)
  1406     switch (texture->format)
  1405     {
  1407     {
  1406     case SDL_PIXELFORMAT_ARGB8888:
  1408     case SDL_PIXELFORMAT_ARGB8888:
  1407     case SDL_PIXELFORMAT_ABGR8888:
  1409     case SDL_PIXELFORMAT_ABGR8888:
  1593     /* Bail out if we're supposed to update an empty rectangle */
  1595     /* Bail out if we're supposed to update an empty rectangle */
  1594     if (rect->w <= 0 || rect->h <= 0) {
  1596     if (rect->w <= 0 || rect->h <= 0) {
  1595         return 0;
  1597         return 0;
  1596     }
  1598     }
  1597 
  1599 
       
  1600     renderdata->drawstate.texture = NULL;  /* we trash this state. */
       
  1601 
  1598     /* Create a texture subimage with the supplied data */
  1602     /* Create a texture subimage with the supplied data */
  1599     data->glBindTexture(tdata->texture_type, tdata->texture);
  1603     data->glBindTexture(tdata->texture_type, tdata->texture);
  1600     GLES2_TexSubImage2D(data, tdata->texture_type,
  1604     GLES2_TexSubImage2D(data, tdata->texture_type,
  1601                     rect->x,
  1605                     rect->x,
  1602                     rect->y,
  1606                     rect->y,
  1671     /* Bail out if we're supposed to update an empty rectangle */
  1675     /* Bail out if we're supposed to update an empty rectangle */
  1672     if (rect->w <= 0 || rect->h <= 0) {
  1676     if (rect->w <= 0 || rect->h <= 0) {
  1673         return 0;
  1677         return 0;
  1674     }
  1678     }
  1675 
  1679 
       
  1680     renderdata->drawstate.texture = NULL;  /* we trash this state. */
       
  1681 
  1676     data->glBindTexture(tdata->texture_type, tdata->texture_v);
  1682     data->glBindTexture(tdata->texture_type, tdata->texture_v);
  1677     GLES2_TexSubImage2D(data, tdata->texture_type,
  1683     GLES2_TexSubImage2D(data, tdata->texture_type,
  1678                     rect->x / 2,
  1684                     rect->x / 2,
  1679                     rect->y / 2,
  1685                     rect->y / 2,
  1680                     (rect->w + 1) / 2,
  1686                     (rect->w + 1) / 2,
  1865     GLES2_RenderData *data = (GLES2_RenderData *)renderer->driverdata;
  1871     GLES2_RenderData *data = (GLES2_RenderData *)renderer->driverdata;
  1866     GLES2_TextureData *texturedata = (GLES2_TextureData *)texture->driverdata;
  1872     GLES2_TextureData *texturedata = (GLES2_TextureData *)texture->driverdata;
  1867     GLES2_ActivateRenderer(renderer);
  1873     GLES2_ActivateRenderer(renderer);
  1868 
  1874 
  1869     data->glBindTexture(texturedata->texture_type, texturedata->texture);
  1875     data->glBindTexture(texturedata->texture_type, texturedata->texture);
       
  1876     renderdata->drawstate.texture = texture;
  1870 
  1877 
  1871     if (texw) {
  1878     if (texw) {
  1872         *texw = 1.0;
  1879         *texw = 1.0;
  1873     }
  1880     }
  1874     if (texh) {
  1881     if (texh) {
  1883     GLES2_RenderData *data = (GLES2_RenderData *)renderer->driverdata;
  1890     GLES2_RenderData *data = (GLES2_RenderData *)renderer->driverdata;
  1884     GLES2_TextureData *texturedata = (GLES2_TextureData *)texture->driverdata;
  1891     GLES2_TextureData *texturedata = (GLES2_TextureData *)texture->driverdata;
  1885     GLES2_ActivateRenderer(renderer);
  1892     GLES2_ActivateRenderer(renderer);
  1886 
  1893 
  1887     data->glBindTexture(texturedata->texture_type, 0);
  1894     data->glBindTexture(texturedata->texture_type, 0);
       
  1895     data->drawstate.texture = NULL;
  1888 
  1896 
  1889     return 0;
  1897     return 0;
  1890 }
  1898 }
  1891 
  1899 
  1892 
  1900