Mercurial > sdl-ios-xcode
diff src/video/SDL_renderer_gl.c @ 3458:0aed0755d1f1
Mike Gorchak to Sam
Hello Sam!
You have reverted back my patches for OpenGL renderer :)
To reproduce an issue, compare graphics output while running these tests:
testdraw2 --renderer opengl --blend mask --cyclealpha
and
testdraw2 --renderer software --blend mask --cyclealpha
You will see, that software renderer output is different from opengl renderer output.
Thanks!
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 19 Nov 2009 08:02:00 +0000 |
parents | 06e948183b59 |
children | 789b97008d8a |
line wrap: on
line diff
--- a/src/video/SDL_renderer_gl.c Thu Nov 19 05:33:41 2009 +0000 +++ b/src/video/SDL_renderer_gl.c Thu Nov 19 08:02:00 2009 +0000 @@ -1055,7 +1055,7 @@ } static void -GL_SetBlendMode(GL_RenderData * data, int blendMode) +GL_SetBlendMode(GL_RenderData * data, int blendMode, int isprimitive) { if (blendMode != data->blendMode) { switch (blendMode) { @@ -1064,9 +1064,16 @@ data->glDisable(GL_BLEND); break; case SDL_BLENDMODE_MASK: - data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - data->glEnable(GL_BLEND); - data->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + if (isprimitive) { + /* The same as SDL_BLENDMODE_NONE */ + blendMode = SDL_BLENDMODE_NONE; + data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + data->glDisable(GL_BLEND); + } else { + data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + data->glEnable(GL_BLEND); + data->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + } break; case SDL_BLENDMODE_BLEND: data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); @@ -1093,7 +1100,7 @@ { GL_RenderData *data = (GL_RenderData *) renderer->driverdata; - GL_SetBlendMode(data, renderer->blendMode); + GL_SetBlendMode(data, renderer->blendMode, 1); data->glColor4f((GLfloat) renderer->r * inv255f, (GLfloat) renderer->g * inv255f, @@ -1112,7 +1119,7 @@ { GL_RenderData *data = (GL_RenderData *) renderer->driverdata; - GL_SetBlendMode(data, renderer->blendMode); + GL_SetBlendMode(data, renderer->blendMode, 1); data->glColor4f((GLfloat) renderer->r * inv255f, (GLfloat) renderer->g * inv255f, @@ -1137,7 +1144,7 @@ { GL_RenderData *data = (GL_RenderData *) renderer->driverdata; - GL_SetBlendMode(data, renderer->blendMode); + GL_SetBlendMode(data, renderer->blendMode, 1); data->glColor4f((GLfloat) renderer->r * inv255f, (GLfloat) renderer->g * inv255f, @@ -1206,7 +1213,7 @@ data->glColor4f(1.0f, 1.0f, 1.0f, 1.0f); } - GL_SetBlendMode(data, texture->blendMode); + GL_SetBlendMode(data, texture->blendMode, 0); if (texture->scaleMode != data->scaleMode) { switch (texture->scaleMode) {