comparison src/video/SDL_renderer_gl.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
77 const SDL_Color * colors, int firstcolor, 77 const SDL_Color * colors, int firstcolor,
78 int ncolors); 78 int ncolors);
79 static int GL_GetTexturePalette(SDL_Renderer * renderer, 79 static int GL_GetTexturePalette(SDL_Renderer * renderer,
80 SDL_Texture * texture, SDL_Color * colors, 80 SDL_Texture * texture, SDL_Color * colors,
81 int firstcolor, int ncolors); 81 int firstcolor, int ncolors);
82 static int GL_SetTextureColorMod(SDL_Renderer * renderer,
83 SDL_Texture * texture);
84 static int GL_SetTextureAlphaMod(SDL_Renderer * renderer,
85 SDL_Texture * texture);
86 static int GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, 82 static int GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
87 const SDL_Rect * rect, const void *pixels, 83 const SDL_Rect * rect, const void *pixels,
88 int pitch); 84 int pitch);
89 static int GL_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, 85 static int GL_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
90 const SDL_Rect * rect, int markDirty, void **pixels, 86 const SDL_Rect * rect, int markDirty, void **pixels,
116 GL_CreateRenderer, 112 GL_CreateRenderer,
117 { 113 {
118 "opengl", 114 "opengl",
119 (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTDISCARD | 115 (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTDISCARD |
120 SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED), 116 SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED),
121 (SDL_TEXTUREMODULATE_NONE | SDL_TEXTUREMODULATE_COLOR |
122 SDL_TEXTUREMODULATE_ALPHA),
123 15, 117 15,
124 { 118 {
125 SDL_PIXELFORMAT_INDEX1LSB, 119 SDL_PIXELFORMAT_INDEX1LSB,
126 SDL_PIXELFORMAT_INDEX1MSB, 120 SDL_PIXELFORMAT_INDEX1MSB,
127 SDL_PIXELFORMAT_INDEX8, 121 SDL_PIXELFORMAT_INDEX8,
289 renderer->DisplayModeChanged = GL_DisplayModeChanged; 283 renderer->DisplayModeChanged = GL_DisplayModeChanged;
290 renderer->CreateTexture = GL_CreateTexture; 284 renderer->CreateTexture = GL_CreateTexture;
291 renderer->QueryTexturePixels = GL_QueryTexturePixels; 285 renderer->QueryTexturePixels = GL_QueryTexturePixels;
292 renderer->SetTexturePalette = GL_SetTexturePalette; 286 renderer->SetTexturePalette = GL_SetTexturePalette;
293 renderer->GetTexturePalette = GL_GetTexturePalette; 287 renderer->GetTexturePalette = GL_GetTexturePalette;
294 renderer->SetTextureColorMod = GL_SetTextureColorMod;
295 renderer->SetTextureAlphaMod = GL_SetTextureAlphaMod;
296 renderer->UpdateTexture = GL_UpdateTexture; 288 renderer->UpdateTexture = GL_UpdateTexture;
297 renderer->LockTexture = GL_LockTexture; 289 renderer->LockTexture = GL_LockTexture;
298 renderer->UnlockTexture = GL_UnlockTexture; 290 renderer->UnlockTexture = GL_UnlockTexture;
299 renderer->DirtyTexture = GL_DirtyTexture; 291 renderer->DirtyTexture = GL_DirtyTexture;
300 renderer->RenderClear = GL_RenderClear; 292 renderer->RenderClear = GL_RenderClear;
946 ((GL_TextureData *) texture->driverdata)-> 938 ((GL_TextureData *) texture->driverdata)->
947 HACK_RYAN_FIXME); 939 HACK_RYAN_FIXME);
948 } 940 }
949 941
950 static int 942 static int
951 GL_SetTextureColorMod(SDL_Renderer * renderer, SDL_Texture * texture)
952 {
953 return 0;
954 }
955
956 static int
957 GL_SetTextureAlphaMod(SDL_Renderer * renderer, SDL_Texture * texture)
958 {
959 return 0;
960 }
961
962 static int
963 GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, 943 GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
964 const SDL_Rect * rect, const void *pixels, int pitch) 944 const SDL_Rect * rect, const void *pixels, int pitch)
965 { 945 {
966 GL_RenderData *renderdata = (GL_RenderData *) renderer->driverdata; 946 GL_RenderData *renderdata = (GL_RenderData *) renderer->driverdata;
967 GL_TextureData *data = (GL_TextureData *) texture->driverdata; 947 GL_TextureData *data = (GL_TextureData *) texture->driverdata;