comparison src/video/SDL_renderer_gles.c @ 5144:31e7f523ab3d

Making the API simpler, texture color and alpha modulation are supported by all renderers.
author Sam Lantinga <slouken@libsdl.org>
date Mon, 31 Jan 2011 23:37:30 -0800
parents e743b9c3f6d6
children c8e049de174c
comparison
equal deleted inserted replaced
5143:e743b9c3f6d6 5144:31e7f523ab3d
65 const SDL_Color * colors, int firstcolor, 65 const SDL_Color * colors, int firstcolor,
66 int ncolors); 66 int ncolors);
67 static int GLES_GetTexturePalette(SDL_Renderer * renderer, 67 static int GLES_GetTexturePalette(SDL_Renderer * renderer,
68 SDL_Texture * texture, SDL_Color * colors, 68 SDL_Texture * texture, SDL_Color * colors,
69 int firstcolor, int ncolors); 69 int firstcolor, int ncolors);
70 static int GLES_SetTextureColorMod(SDL_Renderer * renderer,
71 SDL_Texture * texture);
72 static int GLES_SetTextureAlphaMod(SDL_Renderer * renderer,
73 SDL_Texture * texture);
74 static int GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, 70 static int GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
75 const SDL_Rect * rect, const void *pixels, 71 const SDL_Rect * rect, const void *pixels,
76 int pitch); 72 int pitch);
77 static int GLES_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, 73 static int GLES_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
78 const SDL_Rect * rect, int markDirty, 74 const SDL_Rect * rect, int markDirty,
102 GLES_CreateRenderer, 98 GLES_CreateRenderer,
103 { 99 {
104 "opengl_es", 100 "opengl_es",
105 (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTDISCARD | 101 (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTDISCARD |
106 SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED), 102 SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED),
107 (SDL_TEXTUREMODULATE_NONE | SDL_TEXTUREMODULATE_COLOR |
108 SDL_TEXTUREMODULATE_ALPHA),
109 { 103 {
110 /* OpenGL ES 1.x supported formats list */ 104 /* OpenGL ES 1.x supported formats list */
111 SDL_PIXELFORMAT_RGBA4444, 105 SDL_PIXELFORMAT_RGBA4444,
112 SDL_PIXELFORMAT_RGBA5551, 106 SDL_PIXELFORMAT_RGBA5551,
113 SDL_PIXELFORMAT_RGB565, 107 SDL_PIXELFORMAT_RGB565,
229 renderer->DisplayModeChanged = GLES_DisplayModeChanged; 223 renderer->DisplayModeChanged = GLES_DisplayModeChanged;
230 renderer->CreateTexture = GLES_CreateTexture; 224 renderer->CreateTexture = GLES_CreateTexture;
231 renderer->QueryTexturePixels = GLES_QueryTexturePixels; 225 renderer->QueryTexturePixels = GLES_QueryTexturePixels;
232 renderer->SetTexturePalette = GLES_SetTexturePalette; 226 renderer->SetTexturePalette = GLES_SetTexturePalette;
233 renderer->GetTexturePalette = GLES_GetTexturePalette; 227 renderer->GetTexturePalette = GLES_GetTexturePalette;
234 renderer->SetTextureColorMod = GLES_SetTextureColorMod;
235 renderer->SetTextureAlphaMod = GLES_SetTextureAlphaMod;
236 renderer->UpdateTexture = GLES_UpdateTexture; 228 renderer->UpdateTexture = GLES_UpdateTexture;
237 renderer->LockTexture = GLES_LockTexture; 229 renderer->LockTexture = GLES_LockTexture;
238 renderer->UnlockTexture = GLES_UnlockTexture; 230 renderer->UnlockTexture = GLES_UnlockTexture;
239 renderer->DirtyTexture = GLES_DirtyTexture; 231 renderer->DirtyTexture = GLES_DirtyTexture;
240 renderer->RenderDrawPoints = GLES_RenderDrawPoints; 232 renderer->RenderDrawPoints = GLES_RenderDrawPoints;
492 int pitch) 484 int pitch)
493 { 485 {
494 GLES_TextureData *data = (GLES_TextureData *) texture->driverdata; 486 GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
495 renderdata->glBindTexture(data->type, data->texture); 487 renderdata->glBindTexture(data->type, data->texture);
496 renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1); 488 renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
497 }
498
499 static int
500 GLES_SetTextureColorMod(SDL_Renderer * renderer, SDL_Texture * texture)
501 {
502 return 0;
503 }
504
505 static int
506 GLES_SetTextureAlphaMod(SDL_Renderer * renderer, SDL_Texture * texture)
507 {
508 return 0;
509 } 489 }
510 490
511 static int 491 static int
512 GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, 492 GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
513 const SDL_Rect * rect, const void *pixels, int pitch) 493 const SDL_Rect * rect, const void *pixels, int pitch)