src/render/opengl/SDL_render_gl.c
changeset 12592 10722106b650
parent 12503 806492103856
child 12621 6a60a1e87d10
equal deleted inserted replaced
12591:66cd8731c3b1 12592:10722106b650
   441     int texture_w, texture_h;
   441     int texture_w, texture_h;
   442     GLenum scaleMode;
   442     GLenum scaleMode;
   443 
   443 
   444     GL_ActivateRenderer(renderer);
   444     GL_ActivateRenderer(renderer);
   445 
   445 
       
   446     renderdata->drawstate.texture = NULL;  /* we trash this state. */
       
   447 
   446     if (texture->access == SDL_TEXTUREACCESS_TARGET &&
   448     if (texture->access == SDL_TEXTUREACCESS_TARGET &&
   447         !renderdata->GL_EXT_framebuffer_object_supported) {
   449         !renderdata->GL_EXT_framebuffer_object_supported) {
   448         return SDL_SetError("Render targets not supported by OpenGL");
   450         return SDL_SetError("Render targets not supported by OpenGL");
   449     }
   451     }
   450 
   452 
   639 
   641 
   640     SDL_assert(texturebpp != 0);  /* otherwise, division by zero later. */
   642     SDL_assert(texturebpp != 0);  /* otherwise, division by zero later. */
   641 
   643 
   642     GL_ActivateRenderer(renderer);
   644     GL_ActivateRenderer(renderer);
   643 
   645 
       
   646     renderdata->drawstate.texture = NULL;  /* we trash this state. */
       
   647 
   644     renderdata->glEnable(textype);
   648     renderdata->glEnable(textype);
   645     renderdata->glBindTexture(textype, data->texture);
   649     renderdata->glBindTexture(textype, data->texture);
   646     renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
   650     renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
   647     renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH, (pitch / texturebpp));
   651     renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH, (pitch / texturebpp));
   648     renderdata->glTexSubImage2D(textype, 0, rect->x, rect->y, rect->w,
   652     renderdata->glTexSubImage2D(textype, 0, rect->x, rect->y, rect->w,
   699     GL_RenderData *renderdata = (GL_RenderData *) renderer->driverdata;
   703     GL_RenderData *renderdata = (GL_RenderData *) renderer->driverdata;
   700     const GLenum textype = renderdata->textype;
   704     const GLenum textype = renderdata->textype;
   701     GL_TextureData *data = (GL_TextureData *) texture->driverdata;
   705     GL_TextureData *data = (GL_TextureData *) texture->driverdata;
   702 
   706 
   703     GL_ActivateRenderer(renderer);
   707     GL_ActivateRenderer(renderer);
       
   708 
       
   709     renderdata->drawstate.texture = NULL;  /* we trash this state. */
   704 
   710 
   705     renderdata->glEnable(textype);
   711     renderdata->glEnable(textype);
   706     renderdata->glBindTexture(textype, data->texture);
   712     renderdata->glBindTexture(textype, data->texture);
   707     renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
   713     renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
   708     renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH, Ypitch);
   714     renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH, Ypitch);
  1467 
  1473 
  1468         data->glActiveTextureARB(GL_TEXTURE0_ARB);
  1474         data->glActiveTextureARB(GL_TEXTURE0_ARB);
  1469     }
  1475     }
  1470     data->glBindTexture(textype, texturedata->texture);
  1476     data->glBindTexture(textype, texturedata->texture);
  1471 
  1477 
       
  1478     data->drawstate.texturing = SDL_TRUE;
       
  1479     data->drawstate.texture = texture;
       
  1480 
  1472     if(texw) *texw = (float)texturedata->texw;
  1481     if(texw) *texw = (float)texturedata->texw;
  1473     if(texh) *texh = (float)texturedata->texh;
  1482     if(texh) *texh = (float)texturedata->texh;
  1474 
  1483 
  1475     return 0;
  1484     return 0;
  1476 }
  1485 }
  1493 
  1502 
  1494         data->glActiveTextureARB(GL_TEXTURE0_ARB);
  1503         data->glActiveTextureARB(GL_TEXTURE0_ARB);
  1495     }
  1504     }
  1496 
  1505 
  1497     data->glDisable(textype);
  1506     data->glDisable(textype);
       
  1507 
       
  1508     data->drawstate.texturing = SDL_FALSE;
       
  1509     data->drawstate.texture = NULL;
  1498 
  1510 
  1499     return 0;
  1511     return 0;
  1500 }
  1512 }
  1501 
  1513 
  1502 
  1514