How to lighten use SDL_SetTextureColorMod |
ancientli
|
I can change r/g/b use SDL_SetTextureColorMod, and make texture darken. But can not lighten, how to do?
|
|||||||||||
|
How to lighten use SDL_SetTextureColorMod |
David Olofson
Guest
|
On Mon, Jul 25, 2016 at 4:51 AM, ancientcc wrote:
I don't think you can do that directly with any of the underlying APIs, without using custom shaders. (Modulating with > 1.0 requires clamping to keep values from wrapping around.) Provided color modulation works with SDL_BLENDMODE_ADD (not entirely sure it does, but can't see why it wouldn't), you can work around it by rendering twice when you have color modulation values above 255. For the second pass, switch to SDL_BLENDMODE_ADD. With color modulation 0, that should have no effect; with 255, it should double the brightness of the object. -- //David Olofson - Consultant, Developer, Artist, Open Source Advocate .--- Games, examples, libraries, scripting, sound, music, graphics ---. | http://consulting.olofson.net http://olofsonarcade.com | '---------------------------------------------------------------------' _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
How to lighten use SDL_SetTextureColorMod |
ancientli
|
OK!
Use the method you said, I had lightened texture. _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||
|