aboutsummaryrefslogtreecommitdiff
path: root/src/core.c
diff options
context:
space:
mode:
authorraysan5 <raysan5@gmail.com>2016-03-30 20:09:16 +0200
committerraysan5 <raysan5@gmail.com>2016-03-30 20:09:16 +0200
commit66b096d97848eb096a043781f1f305e7189f2a00 (patch)
treecf87fdd3f4bc46dc93dcaa2f189a5d1dd1e3f32b /src/core.c
parent1136d4222f81524c10b2319b325fcf1282bc6ec1 (diff)
downloadraylib-66b096d97848eb096a043781f1f305e7189f2a00.tar.gz
raylib-66b096d97848eb096a043781f1f305e7189f2a00.zip
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.
Diffstat (limited to 'src/core.c')
-rw-r--r--src/core.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/core.c b/src/core.c
index 5150389c..5a794376 100644
--- a/src/core.c
+++ b/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)
{