diff options
| author | raysan5 <raysan5@gmail.com> | 2016-03-30 20:09:16 +0200 |
|---|---|---|
| committer | raysan5 <raysan5@gmail.com> | 2016-03-30 20:09:16 +0200 |
| commit | 66b096d97848eb096a043781f1f305e7189f2a00 (patch) | |
| tree | cf87fdd3f4bc46dc93dcaa2f189a5d1dd1e3f32b /src/core.c | |
| parent | 1136d4222f81524c10b2319b325fcf1282bc6ec1 (diff) | |
| download | raylib-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.c | 22 |
1 files changed, 21 insertions, 1 deletions
@@ -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) { |
