Re: How to lighten use SDL_SetTextureColorMod
David Olofson <[email protected]>
| Newsgroups | gmane.comp.lib.sdl |
|---|---|
| Message-ID | <CAAcqxQpwWYL3zAmQqMqHDxeQ4meX6Bf7LeSHqrCq_HGBeYkyqg@mail.gmail.com> |
On Mon, Jul 25, 2016 at 4:51 AM, ancientcc <[email protected]> wrote: > I can change r/g/b use SDL_SetTextureColorMod, and make texture darken. But > can not lighten, how to do? 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 | '---------------------------------------------------------------------'