Frage

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.

War es hilfreich?

Lösung

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top