Added method allowing external OpenGL rendering on-top of raylib

This commit is contained in:
Scott Mudge 2020-04-22 17:33:09 -04:00
parent 4c0f359eb2
commit 2e4c07c9c4
2 changed files with 12 additions and 2 deletions

View File

@ -1263,7 +1263,7 @@ void BeginDrawing(void)
} }
// End canvas drawing and swap buffers (double buffering) // End canvas drawing and swap buffers (double buffering)
void EndDrawing(void) void EndDrawingEx(void(*fn)())
{ {
#if defined(PLATFORM_RPI) && defined(SUPPORT_MOUSE_CURSOR_RPI) #if defined(PLATFORM_RPI) && defined(SUPPORT_MOUSE_CURSOR_RPI)
// On RPI native mode we have no system mouse cursor, so, // On RPI native mode we have no system mouse cursor, so,
@ -1273,6 +1273,9 @@ void EndDrawing(void)
rlglDraw(); // Draw Buffers (Only OpenGL 3+ and ES2) rlglDraw(); // Draw Buffers (Only OpenGL 3+ and ES2)
if (fn != NULL)
fn();
#if defined(SUPPORT_GIF_RECORDING) #if defined(SUPPORT_GIF_RECORDING)
#define GIF_RECORD_FRAMERATE 10 #define GIF_RECORD_FRAMERATE 10
@ -1324,6 +1327,12 @@ void EndDrawing(void)
} }
} }
// End canvas drawing and swap buffers (double buffering)
void EndDrawing()
{
return EndDrawingEx(NULL);
}
// Initialize 2D mode with custom camera (2D) // Initialize 2D mode with custom camera (2D)
void BeginMode2D(Camera2D camera) void BeginMode2D(Camera2D camera)
{ {

View File

@ -909,7 +909,8 @@ RLAPI void DisableCursor(void); // Disables cu
// Drawing-related functions // Drawing-related functions
RLAPI void ClearBackground(Color color); // Set background color (framebuffer clear color) RLAPI void ClearBackground(Color color); // Set background color (framebuffer clear color)
RLAPI void BeginDrawing(void); // Setup canvas (framebuffer) to start drawing RLAPI void BeginDrawing(void); // Setup canvas (framebuffer) to start drawing
RLAPI void EndDrawing(void); // End canvas drawing and swap buffers (double buffering) RLAPI void EndDrawingEx(void(*fn)()); // End canvas drawing and swap buffers (double buffering). This method adds a spot for additional rendering on-top of Raylib render.
RLAPI void EndDrawing(); // End canvas drawing and swap buffers (double buffering)
RLAPI void BeginMode2D(Camera2D camera); // Initialize 2D mode with custom camera (2D) RLAPI void BeginMode2D(Camera2D camera); // Initialize 2D mode with custom camera (2D)
RLAPI void EndMode2D(void); // Ends 2D mode with custom camera RLAPI void EndMode2D(void); // Ends 2D mode with custom camera
RLAPI void BeginMode3D(Camera3D camera); // Initializes 3D mode with custom camera (3D) RLAPI void BeginMode3D(Camera3D camera); // Initializes 3D mode with custom camera (3D)