| Summary: | Proposal: add SDL_BLENDMODE_ALPHA which affects only alpha-channel | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Ivan Epifanov <isage.dna> |
| Component: | render | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED INVALID | QA Contact: | Sam Lantinga <slouken> |
| Severity: | enhancement | ||
| Priority: | P2 | CC: | i.gnatenko.brain, mail |
| Version: | 2.0.3 | ||
| Hardware: | x86 | ||
| OS: | Other | ||
Nevermind. It's impossible to do without glBlendFuncSeparate, and we found another solution. |
Something like this (tested in opengl renderer) case SDL_BLENDMODE_ALPHA: data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); data->glEnable(GL_BLEND); data->glBlendFuncSeparate(GL_ZERO, GL_ONE, GL_ONE, GL_ZERO); break; This allows applying alpha masks to texture using alpha-channel from other texture, like this: SDL_SetRenderTarget(gRenderer, texBuf); SDL_SetTextureBlendMode(baseTexture,SDL_BLENDMODE_NONE); SDL_SetTextureBlendMode(maskTexture,SDL_BLENDMODE_ALPHA); SDL_RenderCopy(gRenderer,baseTexture, NULL, NULL); SDL_RenderCopy(gRenderer,eggTexture, NULL, NULL); After that we'll have baseTexture with alpha channel from maskTexture in texBuff. Or maybe there's a better way to do this?