3
SDL_RenderClear(g_ren);

SDL_Texture *tex_bk = SDL_CreateTextureFromSurface(g_ren, bk);

SDL_Texture *tex_des = SDL_CreateTextureFromSurface(g_ren, widget);
SDL_RenderCopy(g_ren, tex_bk, NULL, NULL);
SDL_SetTextureBlendMode(tex_des,blendMode);
SDL_SetRenderDrawBlendMode(g_ren,blendMode);

SDL_RenderCopy(g_ren, tex_des, NULL, NULL);

SDL_RenderPresent(g_ren);
SDL_DestroyTexture(tex_des);
SDL_DestroyTexture(tex_bk);

I want use SDL_RenderCopy to copy the tex_bk and second time I use the SDL_RenderCopy blend the tex_des .but the application always show the tex_des image.tex_bk image always disappear.

genpfault
  • 51,148
  • 11
  • 85
  • 139
luning
  • 53
  • 1
  • 5

1 Answers1

3

You are confusing the functions.

SDL_SetTextureBlendMode changes the way how the alpha blending is applied for a specified texture.

SDL_SetRenderDrawBlendMode changes the way how the alpha blending is done for rendering primitives, like points, lines and rectangles.


The function you are looking for is probably SDL_SetTextureAlphaMod.

pampeho
  • 704
  • 6
  • 12