diff --git a/examples/shaders/shaders_custom_uniform.c b/examples/shaders/shaders_custom_uniform.c index 32fbab92..f898ac78 100644 --- a/examples/shaders/shaders_custom_uniform.c +++ b/examples/shaders/shaders_custom_uniform.c @@ -83,19 +83,21 @@ int main() ClearBackground(RAYWHITE); - BeginTextureMode(target); // Enable drawing to texture + BeginTextureMode(target); // Enable drawing to texture + + ClearBackground(RAYWHITE); // Clear texture background - BeginMode3D(camera); + BeginMode3D(camera); // Begin 3d mode drawing DrawModel(model, position, 0.5f, WHITE); // Draw 3d model with texture DrawGrid(10, 1.0f); // Draw a grid - EndMode3D(); + EndMode3D(); // End 3d mode drawing, returns to orthographic 2d mode DrawText("TEXT DRAWN IN RENDER TEXTURE", 200, 10, 30, RED); - EndTextureMode(); // End drawing to texture (now we have a texture available for next passes) + EndTextureMode(); // End drawing to texture (now we have a texture available for next passes) BeginShaderMode(shader); @@ -104,6 +106,7 @@ int main() EndShaderMode(); + // Draw some 2d text over drawn texture DrawText("(c) Barracks 3D model by Alberto Cano", screenWidth - 220, screenHeight - 20, 10, GRAY); DrawFPS(10, 10); diff --git a/examples/shaders/shaders_postprocessing.c b/examples/shaders/shaders_postprocessing.c index d3f78fd6..f8483563 100644 --- a/examples/shaders/shaders_postprocessing.c +++ b/examples/shaders/shaders_postprocessing.c @@ -128,17 +128,19 @@ int main() ClearBackground(RAYWHITE); - BeginTextureMode(target); // Enable drawing to texture + BeginTextureMode(target); // Enable drawing to texture - BeginMode3D(camera); + ClearBackground(RAYWHITE); // Clear texture background + + BeginMode3D(camera); // Begin 3d mode drawing DrawModel(model, position, 0.1f, WHITE); // Draw 3d model with texture DrawGrid(10, 1.0f); // Draw a grid - EndMode3D(); + EndMode3D(); // End 3d mode drawing, returns to orthographic 2d mode - EndTextureMode(); // End drawing to texture (now we have a texture available for next passes) + EndTextureMode(); // End drawing to texture (now we have a texture available for next passes) // Render previously generated texture using selected postpro shader BeginShaderMode(shaders[currentShader]); @@ -148,6 +150,7 @@ int main() EndShaderMode(); + // Draw 2d shapes and text over drawn texture DrawRectangle(0, 9, 580, 30, Fade(LIGHTGRAY, 0.7f)); DrawText("(c) Church 3D model by Alberto Cano", screenWidth - 200, screenHeight - 20, 10, GRAY); diff --git a/games/wave_collector/screens/screen_gameplay.c b/games/wave_collector/screens/screen_gameplay.c index 6d82d72e..1835c222 100644 --- a/games/wave_collector/screens/screen_gameplay.c +++ b/games/wave_collector/screens/screen_gameplay.c @@ -430,8 +430,8 @@ void DrawGameplayScreen(void) else { // Draw wave using render target - ClearBackground(BLANK); BeginTextureMode(waveTarget); + ClearBackground(BLANK); DrawSamplesMap(samples, totalSamples, currentSample, (Rectangle){ 0, 0, waveTarget.texture.width, waveTarget.texture.height }, MAROON); EndTextureMode(); diff --git a/src/core.c b/src/core.c index 0c04aecd..35646aa1 100644 --- a/src/core.c +++ b/src/core.c @@ -1173,10 +1173,6 @@ void BeginTextureMode(RenderTexture2D target) rlEnableRenderTexture(target.id); // Enable render target - // Some projects need the buffer to not be empited when drawing to - // the render texture. - //rlClearScreenBuffers(); // Clear render texture buffers - // Set viewport to framebuffer size rlViewport(0, 0, target.texture.width, target.texture.height);