mirror of
https://github.com/raysan5/raylib.git
synced 2025-12-25 10:22:33 -05:00
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:
@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user