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);
我想使用SDL_RenderCopy复制tex_bk,第二次使用SDL_RenderCopy混合tex_des。但是应用程序总是显示tex_des image.tex_bk图像总是消失。
答案 0 :(得分:3)
你混淆了这些功能。
SDL_SetTextureBlendMode
更改了对指定纹理应用Alpha混合的方式。
SDL_SetRenderDrawBlendMode
改变了渲染基元(如点,线和矩形)的alpha混合方式。
您正在寻找的功能可能是SDL_SetTextureAlphaMod
。