The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
SDL2 transparensy
Mantis


Joined: 04 May 2012
Posts: 9
Hi.
I do not sense the behavior SDL_SetTextureAlphaMod().
If I make:
Code:
SDL_Texture *img = IMG_LoadTexture(render, "image.png");
SDL_SetTextureAlphaMod(img, 127);

the texture is thanslucent.
But I make:
Code:
*img = SDL_CreateTexture(render, SDL_PIXELFORMAT_RGBA8888, 0, 150, 50);
SDL_SetTextureAlphaMod(img, 127);

the texure not transparensy. I will yea make transparent image.png and load it Shocked
Any ideas?
mr_tawan


Joined: 13 Jan 2014
Posts: 161
You might want to try calling SDL_SetTextureBlendMode();
Mantis


Joined: 04 May 2012
Posts: 9
Sorry.
Now I understand yet less.
I fill texture blue color. If I use key SDL_BLENDMODE_BLEND the image is not visible, but I use SDL_BLENDMODE_NONE
Code:
SDL_Texture *backgr = IMG_LoadTexture(render, "image.png");
SDL_Texture *img = SDL_Texture *img = SDL_CreateTexture(render, SDL_PIXELFORMAT_RGBA8888, 0, 150, 50);
SDL_SetTextureBlendMode(img, SDL_BLENDMODE_NONE);
SDL_SetTextureColorMod(img, 0, 0, 200);
SDL_SetTextureAlphaMod(img, 127);
SDL_Rect bk_pos;
bk_pos.x = 0;
bk_pos.y = 0;
bk_pos.w = 150;
bk_pos.h = 50;

while (true)
{
   SDL_RenderClear(render);
   SDL_RenderCopy(render, backgr, NULL, NULL);
   SDL_RenderCopy(render, img, NULL, &bk_pos);
   SDL_RenderPresent(ren);
}

in image not plain blue, but is blended the elements my desktop Surprised
Mantis


Joined: 04 May 2012
Posts: 9
I jast do non understand, what is happened Shocked
I have run whitout flag SDL_INIT_AUDIO and all works good.
SDL2 transparensy
Sam Lantinga


Joined: 10 Sep 2009
Posts: 1765
Can you report a bug to bugzilla.libsdl.org and include what operating system you're using, what renderer you're using and attach a simple example, with any data files it requires?

Thanks!



On Fri, Jul 11, 2014 at 1:13 PM, Mantis wrote:
Quote:
I jast do non understand, what is happened
I have run whitout flag SDL_INIT_AUDIO and all works good.


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org