Mercurial > sdl-ios-xcode
diff src/video/SDL_renderer_gles.c @ 3393:fe2f10481878
Fixed SDL_BLENDMODE_MASK for GL and GLES renderers, now blending works like in software renderer.
author | Mike Gorchak <lestat@i.com.ua> |
---|---|
date | Tue, 13 Oct 2009 06:51:20 +0000 |
parents | 3fe2248fde37 |
children | 83518f8fcd61 |
line wrap: on
line diff
--- a/src/video/SDL_renderer_gles.c Tue Oct 13 06:49:29 2009 +0000 +++ b/src/video/SDL_renderer_gles.c Tue Oct 13 06:51:20 2009 +0000 @@ -611,7 +611,7 @@ } static void -GLES_SetBlendMode(GLES_RenderData * data, int blendMode) +GLES_SetBlendMode(GLES_RenderData * data, int blendMode, int isprimitive) { if (blendMode != data->blendMode) { switch (blendMode) { @@ -620,6 +620,14 @@ data->glDisable(GL_BLEND); break; case SDL_BLENDMODE_MASK: + if (isprimitive) { + data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + data->glDisable(GL_BLEND); + /* The same as SDL_BLENDMODE_NONE */ + blendMode = SDL_BLENDMODE_NONE; + break; + } + /* fall through */ case SDL_BLENDMODE_BLEND: data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); data->glEnable(GL_BLEND); @@ -645,7 +653,7 @@ { GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata; - GLES_SetBlendMode(data, renderer->blendMode); + GLES_SetBlendMode(data, renderer->blendMode, 1); data->glColor4f((GLfloat) renderer->r * inv255f, (GLfloat) renderer->g * inv255f, @@ -669,7 +677,7 @@ { GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata; - GLES_SetBlendMode(data, renderer->blendMode); + GLES_SetBlendMode(data, renderer->blendMode, 1); data->glColor4f((GLfloat) renderer->r * inv255f, (GLfloat) renderer->g * inv255f, @@ -695,7 +703,7 @@ { GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata; - GLES_SetBlendMode(data, renderer->blendMode); + GLES_SetBlendMode(data, renderer->blendMode, 1); data->glColor4f((GLfloat) renderer->r * inv255f, (GLfloat) renderer->g * inv255f, @@ -789,7 +797,7 @@ data->glColor4f(1.0f, 1.0f, 1.0f, 1.0f); } - GLES_SetBlendMode(data, texture->blendMode); + GLES_SetBlendMode(data, texture->blendMode, 0); switch (texture->scaleMode) { case SDL_TEXTURESCALEMODE_NONE: