mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-17 08:48:14 +00: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:
22
src/core.c
22
src/core.c
@@ -545,7 +545,7 @@ void BeginDrawing(void)
|
||||
|
||||
if (IsPosproShaderEnabled()) rlEnablePostproFBO();
|
||||
|
||||
rlClearScreenBuffers();
|
||||
rlClearScreenBuffers(); // Clear current framebuffers
|
||||
|
||||
rlLoadIdentity(); // Reset current matrix (MODELVIEW)
|
||||
|
||||
@@ -656,6 +656,26 @@ void End3dMode(void)
|
||||
rlDisableDepthTest(); // Disable DEPTH_TEST for 2D
|
||||
}
|
||||
|
||||
// Initializes render texture for drawing
|
||||
void BeginTextureMode(RenderTexture2D target)
|
||||
{
|
||||
rlglDraw(); // Draw Buffers (Only OpenGL 3+ and ES2)
|
||||
|
||||
rlEnableRenderTexture(target.id);
|
||||
|
||||
rlClearScreenBuffers(); // Clear render texture buffers
|
||||
|
||||
rlLoadIdentity(); // Reset current matrix (MODELVIEW)
|
||||
}
|
||||
|
||||
// Ends drawing to render texture
|
||||
void EndTextureMode(void)
|
||||
{
|
||||
rlglDraw(); // Draw Buffers (Only OpenGL 3+ and ES2)
|
||||
|
||||
rlDisableRenderTexture();
|
||||
}
|
||||
|
||||
// Set target FPS for the game
|
||||
void SetTargetFPS(int fps)
|
||||
{
|
||||
|
Reference in New Issue
Block a user