Added support for render to texture (use RenderTexture2D)

Now it's possible to render to texture, old postprocessing system will
be removed on next raylib version.
This commit is contained in:
raysan5
2016-03-30 20:09:16 +02:00
parent 1136d4222f
commit 66b096d978
8 changed files with 210 additions and 13 deletions

View File

@ -389,6 +389,14 @@ Texture2D LoadTextureFromImage(Image image)
return texture;
}
// Load a texture to be used for rendering
RenderTexture2D LoadRenderTexture(int width, int height)
{
RenderTexture2D target = rlglLoadRenderTexture(width, height);
return target;
}
// Unload image from CPU memory (RAM)
void UnloadImage(Image image)
{
@ -409,6 +417,17 @@ void UnloadTexture(Texture2D texture)
}
}
// Unload render texture from GPU memory
void UnloadRenderTexture(RenderTexture2D target)
{
if (target.id != 0)
{
rlDeleteRenderTextures(target);
TraceLog(INFO, "[FBO ID %i] Unloaded render texture data from VRAM (GPU)", target.id);
}
}
// Get pixel data from image in the form of Color struct array
Color *GetImageData(Image image)
{