diff --git a/examples/Makefile b/examples/Makefile
index ecd4344a6..0e4e4ab97 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -411,7 +411,8 @@ TEXTURES = \
textures/textures_background_scrolling \
textures/textures_sprite_button \
textures/textures_sprite_explosion \
- textures/textures_bunnymark
+ textures/textures_bunnymark \
+ textures/textures_blend_modes
TEXT = \
text/text_raylib_fonts \
diff --git a/examples/README.md b/examples/README.md
index c516dbc22..8aba19af7 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -72,25 +72,26 @@ Examples using raylib text functionality, including sprite fonts loading/generat
Examples using raylib textures functionality, including image/textures loading/generation and drawing, provided by raylib [textures](../src/textures.c) module.
-| ## | example | image | developer | new |
-|----|----------|--------|:----------:|:---:|
-| 48 | [textures_logo_raylib](textures/textures_logo_raylib.c) |
| ray | |
-| 49 | [textures_rectangle](textures/textures_rectangle.c) |
| ray | |
-| 50 | [textures_srcrec_dstrec](textures/textures_srcrec_dstrec.c) |
| ray | |
-| 51 | [textures_image_drawing](textures/textures_image_drawing.c) |
| ray | |
-| 52 | [textures_image_generation](textures/textures_image_generation.c) |
| ray | |
-| 53 | [textures_image_loading](textures/textures_image_loading.c) |
| ray | |
-| 54 | [textures_image_processing](textures/textures_image_processing.c) |
| ray | |
-| 55 | [textures_image_text](textures/textures_image_text.c) |
| ray | ⭐️ |
-| 56 | [textures_to_image](textures/textures_to_image.c) |
| ray | |
-| 57 | [textures_raw_data](textures/textures_raw_data.c) |
| ray | |
-| 58 | [textures_particles_blending](textures/textures_particles_blending.c) |
| ray | |
-| 59 | [textures_npatch_drawing](textures/textures_npatch_drawing.c) |
| [Jorge A. Gomes](https://github.com/overdev) | |
-| 60 | [textures_background_scrolling](textures/textures_background_scrolling.c) |
| ray | ⭐️ |
-| 61 | [textures_sprite_button](textures/textures_sprite_button.c) |
| ray | ⭐️ |
-| 62 | [textures_sprite_explosion](textures/textures_sprite_explosion.c) |
| ray | ⭐️ |
-| 63 | [textures_bunnymark](textures/textures_bunnymark.c) |
| ray | ⭐️ |
-| 64 | [textures_mouse_painting](textures/textures_mouse_painting.c) |
| [Chris Dill](https://github.com/MysteriousSpace) | ⭐️ |
+| ## | example | image | developer | new |
+|----|---------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------|:------------------------------------------------:|:---:|
+| 48 | [textures_logo_raylib](textures/textures_logo_raylib.c) |
| ray | |
+| 49 | [textures_rectangle](textures/textures_rectangle.c) |
| ray | |
+| 50 | [textures_srcrec_dstrec](textures/textures_srcrec_dstrec.c) |
| ray | |
+| 51 | [textures_image_drawing](textures/textures_image_drawing.c) |
| ray | |
+| 52 | [textures_image_generation](textures/textures_image_generation.c) |
| ray | |
+| 53 | [textures_image_loading](textures/textures_image_loading.c) |
| ray | |
+| 54 | [textures_image_processing](textures/textures_image_processing.c) |
| ray | |
+| 55 | [textures_image_text](textures/textures_image_text.c) |
| ray | ⭐️ |
+| 56 | [textures_to_image](textures/textures_to_image.c) |
| ray | |
+| 57 | [textures_raw_data](textures/textures_raw_data.c) |
| ray | |
+| 58 | [textures_particles_blending](textures/textures_particles_blending.c) |
| ray | |
+| 59 | [textures_npatch_drawing](textures/textures_npatch_drawing.c) |
| [Jorge A. Gomes](https://github.com/overdev) | |
+| 60 | [textures_background_scrolling](textures/textures_background_scrolling.c) |
| ray | ⭐️ |
+| 61 | [textures_sprite_button](textures/textures_sprite_button.c) |
| ray | ⭐️ |
+| 62 | [textures_sprite_explosion](textures/textures_sprite_explosion.c) |
| ray | ⭐️ |
+| 63 | [textures_bunnymark](textures/textures_bunnymark.c) |
| ray | ⭐️ |
+| 64 | [textures_mouse_painting](textures/textures_mouse_painting.c) |
| [Chris Dill](https://github.com/MysteriousSpace) | ⭐️ |
+| 65 | [textures_blend_modes](textures/textures_blend_modes.c) |
| [Karlo Licudine](https://github.com/accidentalrebel) | ⭐️ |
### category: models
@@ -98,24 +99,24 @@ Examples using raylib models functionality, including models loading/generation
| ## | example | image | developer | new |
|----|----------|--------|:----------:|:---:|
-| 65 | [models_animation](models/models_animation.c) |
| [culacant](https://github.com/culacant) | ⭐️ |
-| 66 | [models_billboard](models/models_billboard.c) |
| ray | |
-| 67 | [models_box_collisions](models/models_box_collisions.c) |
| ray | |
-| 68 | [models_cubicmap](models/models_cubicmap.c) |
| ray | |
-| 69 | [models_first_person_maze](models/models_first_person_maze.c) |
| ray | ⭐️ |
-| 70 | [models_geometric_shapes](models/models_geometric_shapes.c) |
| ray | |
-| 71 | [models_material_pbr](models/models_material_pbr.c) |
| ray | |
-| 72 | [models_mesh_generation](models/models_mesh_generation.c) |
| ray | |
-| 73 | [models_mesh_picking](models/models_mesh_picking.c) |
| [Joel Davis](https://github.com/joeld42) | |
-| 74 | [models_loading](models/models_loading.c) |
| ray | |
-| 75 | [models_orthographic_projection](models/models_orthographic_projection.c) |
| [Max Danielsson](https://github.com/autious) | |
-| 76 | *TODO* | *TODO* | *TODO* | |
+| 66 | [models_animation](models/models_animation.c) |
| [culacant](https://github.com/culacant) | ⭐️ |
+| 67 | [models_billboard](models/models_billboard.c) |
| ray | |
+| 68 | [models_box_collisions](models/models_box_collisions.c) |
| ray | |
+| 69 | [models_cubicmap](models/models_cubicmap.c) |
| ray | |
+| 70 | [models_first_person_maze](models/models_first_person_maze.c) |
| ray | ⭐️ |
+| 71 | [models_geometric_shapes](models/models_geometric_shapes.c) |
| ray | |
+| 72 | [models_material_pbr](models/models_material_pbr.c) |
| ray | |
+| 73 | [models_mesh_generation](models/models_mesh_generation.c) |
| ray | |
+| 74 | [models_mesh_picking](models/models_mesh_picking.c) |
| [Joel Davis](https://github.com/joeld42) | |
+| 75 | [models_loading](models/models_loading.c) |
| ray | |
+| 76 | [models_orthographic_projection](models/models_orthographic_projection.c) |
| [Max Danielsson](https://github.com/autious) | |
| 77 | *TODO* | *TODO* | *TODO* | |
-| 78 | [models_solar_system_rlgl](models/models_rlgl_solar_system.c) |
| ray | ⭐️ |
-| 79 | [models_yaw_pitch_roll](models/models_yaw_pitch_roll.c) |
| [Berni](https://github.com/Berni8k) | |
-| 80 | [models_waving_cubes](models/models_waving_cubes.c) |
| [codecat](https://github.com/codecat) | ⭐️ |
-| 81 | [models_heightmap](models/models_heightmap.c) |
| ray | |
-| 82 | [models_skybox](models/models_skybox.c) |
| ray | |
+| 78 | *TODO* | *TODO* | *TODO* | |
+| 79 | [models_solar_system_rlgl](models/models_rlgl_solar_system.c) |
| ray | ⭐️ |
+| 80 | [models_yaw_pitch_roll](models/models_yaw_pitch_roll.c) |
| [Berni](https://github.com/Berni8k) | |
+| 81 | [models_waving_cubes](models/models_waving_cubes.c) |
| [codecat](https://github.com/codecat) | ⭐️ |
+| 82 | [models_heightmap](models/models_heightmap.c) |
| ray | |
+| 83 | [models_skybox](models/models_skybox.c) |
| ray | |
### category: shaders
@@ -123,19 +124,19 @@ Examples using raylib shaders functionality, including shaders loading, paramete
| ## | example | image | developer | new |
|----|----------|--------|:----------:|:---:|
-| 83 | [shaders_basic_lighting](shaders/shaders_basic_lighting.c) |
| [Chris Camacho](https://github.com/codifies) | ⭐️ |
-| 84 | [shaders_model_shader](shaders/shaders_model_shader.c) |
| ray | |
-| 85 | [shaders_shapes_textures](shaders/shaders_shapes_textures.c) |
| ray | |
-| 86 | [shaders_custom_uniform](shaders/shaders_custom_uniform.c) |
| ray | |
-| 87 | [shaders_postprocessing](shaders/shaders_postprocessing.c) |
| ray | |
-| 88 | [shaders_palette_switch](shaders/shaders_palette_switch.c) |
| [Marco Lizza](https://github.com/MarcoLizza) | |
-| 89 | [shaders_raymarching](shaders/shaders_raymarching.c) |
| Shader by Iñigo Quilez | ⭐️ |
-| 90 | [shaders_texture_drawing](shaders/shaders_texture_drawing.c) |
| Michał Ciesielski | ⭐️ |
-| 91 | [shaders_texture_waves](shaders/shaders_texture_waves.c) |
| [Anata](https://github.com/anatagawa) | ⭐️ |
-| 92 | [shaders_julia_set](shaders/shaders_julia_set.c) |
| [eggmund](https://github.com/eggmund) | ⭐️ |
-| 93 | [shaders_eratosthenes](shaders/shaders_eratosthenes.c) |
| [ProfJski](https://github.com/ProfJski) | ⭐️ |
-| 94 | [shaders_fog](shaders/shaders_fog.c) |
| [Chris Camacho](https://github.com/codifies) | ⭐️ |
-| 95 | [shaders_simple_mask](shaders/shaders_simple_mask.c) |
| [Chris Camacho](https://github.com/codifies) | ⭐️ |
+| 84 | [shaders_basic_lighting](shaders/shaders_basic_lighting.c) |
| [Chris Camacho](https://github.com/codifies) | ⭐️ |
+| 85 | [shaders_model_shader](shaders/shaders_model_shader.c) |
| ray | |
+| 86 | [shaders_shapes_textures](shaders/shaders_shapes_textures.c) |
| ray | |
+| 87 | [shaders_custom_uniform](shaders/shaders_custom_uniform.c) |
| ray | |
+| 88 | [shaders_postprocessing](shaders/shaders_postprocessing.c) |
| ray | |
+| 89 | [shaders_palette_switch](shaders/shaders_palette_switch.c) |
| [Marco Lizza](https://github.com/MarcoLizza) | |
+| 90 | [shaders_raymarching](shaders/shaders_raymarching.c) |
| Shader by Iñigo Quilez | ⭐️ |
+| 91 | [shaders_texture_drawing](shaders/shaders_texture_drawing.c) |
| Michał Ciesielski | ⭐️ |
+| 92 | [shaders_texture_waves](shaders/shaders_texture_waves.c) |
| [Anata](https://github.com/anatagawa) | ⭐️ |
+| 93 | [shaders_julia_set](shaders/shaders_julia_set.c) |
| [eggmund](https://github.com/eggmund) | ⭐️ |
+| 94 | [shaders_eratosthenes](shaders/shaders_eratosthenes.c) |
| [ProfJski](https://github.com/ProfJski) | ⭐️ |
+| 95 | [shaders_fog](shaders/shaders_fog.c) |
| [Chris Camacho](https://github.com/codifies) | ⭐️ |
+| 96 | [shaders_simple_mask](shaders/shaders_simple_mask.c) |
| [Chris Camacho](https://github.com/codifies) | ⭐️ |
### category: audio
@@ -143,11 +144,11 @@ Examples using raylib audio functionality, including sound/music loading and pla
| ## | example | image | developer | new |
|----|----------|--------|:----------:|:---:|
-| 96 | [audio_module_playing](audio/audio_module_playing.c) |
| ray | |
-| 97 | [audio_music_stream](audio/audio_music_stream.c) |
| ray | |
-| 98 | [audio_raw_stream](audio/audio_raw_stream.c) |
| ray | |
-| 99 | [audio_sound_loading](audio/audio_sound_loading.c) |
| ray | |
-| 100 | [audio_multichannel_sound](audio/audio_multichannel_sound.c) |
| [Chris Camacho](https://github.com/codifies) | ⭐️ |
+| 97 | [audio_module_playing](audio/audio_module_playing.c) |
| ray | |
+| 98 | [audio_music_stream](audio/audio_music_stream.c) |
| ray | |
+| 99 | [audio_raw_stream](audio/audio_raw_stream.c) |
| ray | |
+| 10 | [audio_sound_loading](audio/audio_sound_loading.c) |
| ray | |
+| 101 | [audio_multichannel_sound](audio/audio_multichannel_sound.c) |
| [Chris Camacho](https://github.com/codifies) | ⭐️ |
### category: physics
@@ -155,11 +156,11 @@ Examples showing physics functionality with raylib. This functionality is provid
| ## | example | image | developer | new |
|----|----------|--------|:----------:|:---:|
-| 101 | [physics_demo](physics/physics_demo.c) |
| [Victor Fisac](https://github.com/victorfisac) | |
-| 102 | [physics_friction](physics/physics_friction.c) |
| [Victor Fisac](https://github.com/victorfisac) | |
-| 103 | [physics_movement](physics/physics_movement.c) |
| [Victor Fisac](https://github.com/victorfisac) | |
-| 104 | [physics_restitution](physics/physics_restitution.c) |
| [Victor Fisac](https://github.com/victorfisac) | |
-| 105 | [physics_shatter](physics/physics_shatter.c) |
| [Victor Fisac](https://github.com/victorfisac) | |
+| 102 | [physics_demo](physics/physics_demo.c) |
| [Victor Fisac](https://github.com/victorfisac) | |
+| 103 | [physics_friction](physics/physics_friction.c) |
| [Victor Fisac](https://github.com/victorfisac) | |
+| 104 | [physics_movement](physics/physics_movement.c) |
| [Victor Fisac](https://github.com/victorfisac) | |
+| 105 | [physics_restitution](physics/physics_restitution.c) |
| [Victor Fisac](https://github.com/victorfisac) | |
+| 106 | [physics_shatter](physics/physics_shatter.c) |
| [Victor Fisac](https://github.com/victorfisac) | |
### category: network
@@ -169,13 +170,13 @@ Examples showing raylib network functionality. This functionality is provided by
| ## | example | image | developer | new |
|----|----------|--------|:----------:|:---:|
-| 106 | [network_ping_pong](network/network_ping_pong.c) | | [Jak Barnes](https://github.com/syphonx) | |
-| 107 | [network_resolve_host](network/network_resolve_host.c) | | [Jak Barnes](https://github.com/syphonx) | |
-| 108 | [network_tcp_client](network/network_tcp_client.c) | | [Jak Barnes](https://github.com/syphonx) | |
-| 109 | [network_tcp_server](network/network_tcp_server.c) | | [Jak Barnes](https://github.com/syphonx) | |
-| 110 | [network_test](network/network_test.c) | | [Jak Barnes](https://github.com/syphonx) | |
-| 111 | [network_udp_client](network/network_udp_client.c) | | [Jak Barnes](https://github.com/syphonx) | |
-| 112 | [network_udp_server](network/network_udp_server.c) | | [Jak Barnes](https://github.com/syphonx) | |
+| 107 | [network_ping_pong](network/network_ping_pong.c) | | [Jak Barnes](https://github.com/syphonx) | |
+| 108 | [network_resolve_host](network/network_resolve_host.c) | | [Jak Barnes](https://github.com/syphonx) | |
+| 109 | [network_tcp_client](network/network_tcp_client.c) | | [Jak Barnes](https://github.com/syphonx) | |
+| 110 | [network_tcp_server](network/network_tcp_server.c) | | [Jak Barnes](https://github.com/syphonx) | |
+| 111 | [network_test](network/network_test.c) | | [Jak Barnes](https://github.com/syphonx) | |
+| 112 | [network_udp_client](network/network_udp_client.c) | | [Jak Barnes](https://github.com/syphonx) | |
+| 113 | [network_udp_server](network/network_udp_server.c) | | [Jak Barnes](https://github.com/syphonx) | |
### category: others
@@ -183,9 +184,9 @@ Examples showing raylib misc functionality that does not fit in other categories
| ## | example | image | developer | new |
|----|----------|--------|:----------:|:---:|
-| 113 | [raudio_standalone](others/raudio_standalone.c) | | ray | |
-| 114 | [rlgl_standalone](others/rlgl_standalone.c) | | ray | |
-| 115 | [easings_testbed](others/easings_testbed.c) | | [Juan Miguel López](https://github.com/flashback-fx) | |
+| 114 | [raudio_standalone](others/raudio_standalone.c) | | ray | |
+| 115 | [rlgl_standalone](others/rlgl_standalone.c) | | ray | |
+| 116 | [easings_testbed](others/easings_testbed.c) | | [Juan Miguel López](https://github.com/flashback-fx) | |
As always contributions are welcome, feel free to send new examples! Here it is an [examples template](examples_template.c) to start with!
diff --git a/examples/textures/textures_blend_modes.c b/examples/textures/textures_blend_modes.c
new file mode 100644
index 000000000..bb19f56c5
--- /dev/null
+++ b/examples/textures/textures_blend_modes.c
@@ -0,0 +1,100 @@
+/*******************************************************************************************
+*
+* raylib [textures] example - blend modes
+*
+* NOTE: Images are loaded in CPU memory (RAM); textures are loaded in GPU memory (VRAM)
+*
+* This example has been created using raylib 3.0 (www.raylib.com)
+* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
+*
+* Copyright (c) 2020 Karlo Licudine (@accidentalrebel)
+*
+********************************************************************************************/
+
+#include "raylib.h"
+
+int main(void)
+{
+ // Initialization
+ //--------------------------------------------------------------------------------------
+ const int screenWidth = 800;
+ const int screenHeight = 450;
+
+ InitWindow(screenWidth, screenHeight, "raylib [textures] example - blend modes");
+
+ // NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
+ Image bgImage = LoadImage("resources/cyberpunk_street_background.png"); // Loaded in CPU memory (RAM)
+ Texture2D bgTexture = LoadTextureFromImage(bgImage); // Image converted to texture, GPU memory (VRAM)
+
+ Image fgImage = LoadImage("resources/cyberpunk_street_foreground.png"); // Loaded in CPU memory (RAM)
+ Texture2D fgTexture = LoadTextureFromImage(fgImage); // Image converted to texture, GPU memory (VRAM)
+
+ // Once image has been converted to texture and uploaded to VRAM, it can be unloaded from RAM
+ UnloadImage(bgImage);
+ UnloadImage(fgImage);
+
+ const int blendCountMax = 4;
+ BlendMode blendMode = 0;
+
+ // Main game loop
+ while (!WindowShouldClose()) // Detect window close button or ESC key
+ {
+ // Update
+ //----------------------------------------------------------------------------------
+ int key = GetKeyPressed();
+ if ((key >= 32) && (key <= 126))
+ {
+ if ( blendMode >= blendCountMax - 1 )
+ blendMode = 0;
+ else
+ blendMode++;
+ }
+
+ // Draw
+ //----------------------------------------------------------------------------------
+ BeginDrawing();
+
+ ClearBackground(RAYWHITE);
+
+ BeginBlendMode(BLEND_ALPHA);
+ DrawTexture(bgTexture, screenWidth/2 - bgTexture.width/2, screenHeight/2 - bgTexture.height/2, WHITE);
+
+ // Apply the blend mode and then draw the foreground texture
+ BeginBlendMode(blendMode);
+ DrawTexture(fgTexture, screenWidth/2 - fgTexture.width/2, screenHeight/2 - fgTexture.height/2, WHITE);
+
+ EndBlendMode();
+
+ // Draw the texts
+ DrawText("Press any key to change blend modes.", 310, 350, 10, GRAY);
+ switch ( blendMode )
+ {
+ case BLEND_ALPHA:
+ DrawText("Current: BLEND_ALPHA", (screenWidth / 2) - 60, 370, 10, GRAY);
+ break;
+ case BLEND_ADDITIVE:
+ DrawText("Current: BLEND_ADDITIVE", (screenWidth / 2) - 60, 370, 10, GRAY);
+ break;
+ case BLEND_MULTIPLIED:
+ DrawText("Current: BLEND_MULTIPLIED", (screenWidth / 2) - 60, 370, 10, GRAY);
+ break;
+ case BLEND_ADD_COLORS:
+ DrawText("Current: BLEND_ADD_COLORS", (screenWidth / 2) - 60, 370, 10, GRAY);
+ break;
+ }
+ DrawText("(c) Cyberpunk Street Environment by Luis Zuno (@ansimuz)", screenWidth - 330, screenHeight - 20, 10, GRAY);
+
+ EndDrawing();
+ //----------------------------------------------------------------------------------
+ }
+
+ // De-Initialization
+ //--------------------------------------------------------------------------------------
+ UnloadTexture(fgTexture); // Unload foreground texture
+ UnloadTexture(bgTexture); // Unload background texture
+
+ CloseWindow(); // Close window and OpenGL context
+ //--------------------------------------------------------------------------------------
+
+ return 0;
+}
diff --git a/examples/textures/textures_blend_modes.png b/examples/textures/textures_blend_modes.png
new file mode 100644
index 000000000..3010ace7a
Binary files /dev/null and b/examples/textures/textures_blend_modes.png differ