SDL2目标纹理背景阿尔法

时间:2015-01-23 14:03:30

标签: c sdl-2 texture2d render-to-texture

我想创建一个带alpha背景的纹理目标。是否可以在SDL2中使用?

因此,当我编写例如10个纹理到1时,纹理之间会出现一些其他纹理,我之前已经渲染过。

我想要实现的目标:

http://s17.postimg.org/7zblcb873/want.png

可以做什么: http://s14.postimg.org/9w4sajslt/possible_Do.png

我以这种方式创建纹理:

    SDL_Texture*texture=SDL_CreateTexture(win->renderer, SDL_PIXELFORMAT_RGBA8888, 
    SDL_TEXTUREACCESS_TARGET, w, h);   
    SDL_SetRenderTarget(win->renderer, texture);
    SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
    SDL_SetRenderDrawColor(win->renderer, 0x00, 0x00, 0x00, 0);
    SDL_RenderFillRect(win->renderer, NULL);
    SDL_RenderCopy(win->renderer,texture, NULL, NULL);
    SDL_SetRenderDrawColor(win->renderer, 0, 0, 0, 0);

    // here i copy the sprites to texture and then change the renderer to window

0 个答案:

没有答案