aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/shaders_custom_uniform.c12
-rw-r--r--examples/shaders_postprocessing.c12
-rw-r--r--examples/shaders_shapes_textures.c18
-rw-r--r--examples/textures_particles_trail_blending.c24
4 files changed, 36 insertions, 30 deletions
diff --git a/examples/shaders_custom_uniform.c b/examples/shaders_custom_uniform.c
index 74077143..516d5087 100644
--- a/examples/shaders_custom_uniform.c
+++ b/examples/shaders_custom_uniform.c
@@ -33,7 +33,7 @@ int main()
Camera camera = {{ 3.0f, 3.0f, 3.0f }, { 0.0f, 1.5f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f };
Model dwarf = LoadModel("resources/model/dwarf.obj"); // Load OBJ model
- Texture2D texture = LoadTexture("resources/model/dwarf_diffuse.png"); // Load model texture
+ Texture2D texture = LoadTexture("resources/model/dwarf_diffuse.png"); // Load model texture (diffuse map)
SetModelTexture(&dwarf, texture); // Bind texture to model
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
@@ -94,10 +94,12 @@ int main()
EndTextureMode(); // End drawing to texture (now we have a texture available for next passes)
- SetCustomShader(shader);
- // NOTE: Render texture must be y-flipped due to default OpenGL coordinates (left-bottom)
- DrawTextureRec(target.texture, (Rectangle){ 0, 0, target.texture.width, -target.texture.height }, (Vector2){ 0, 0 }, WHITE);
- SetDefaultShader();
+ BeginShaderMode(shader);
+
+ // NOTE: Render texture must be y-flipped due to default OpenGL coordinates (left-bottom)
+ DrawTextureRec(target.texture, (Rectangle){ 0, 0, target.texture.width, -target.texture.height }, (Vector2){ 0, 0 }, WHITE);
+
+ EndShaderMode();
DrawText("(c) Dwarf 3D model by David Moreno", screenWidth - 200, screenHeight - 20, 10, GRAY);
diff --git a/examples/shaders_postprocessing.c b/examples/shaders_postprocessing.c
index e9fafe15..5e8b5a80 100644
--- a/examples/shaders_postprocessing.c
+++ b/examples/shaders_postprocessing.c
@@ -33,7 +33,7 @@ int main()
Camera camera = {{ 3.0f, 3.0f, 3.0f }, { 0.0f, 1.5f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f };
Model dwarf = LoadModel("resources/model/dwarf.obj"); // Load OBJ model
- Texture2D texture = LoadTexture("resources/model/dwarf_diffuse.png"); // Load model texture
+ Texture2D texture = LoadTexture("resources/model/dwarf_diffuse.png"); // Load model texture (diffuse map)
SetModelTexture(&dwarf, texture); // Bind texture to model
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
@@ -80,10 +80,12 @@ int main()
EndTextureMode(); // End drawing to texture (now we have a texture available for next passes)
- SetCustomShader(shader);
- // NOTE: Render texture must be y-flipped due to default OpenGL coordinates (left-bottom)
- DrawTextureRec(target.texture, (Rectangle){ 0, 0, target.texture.width, -target.texture.height }, (Vector2){ 0, 0 }, WHITE);
- SetDefaultShader();
+ BeginShaderMode(shader);
+
+ // NOTE: Render texture must be y-flipped due to default OpenGL coordinates (left-bottom)
+ DrawTextureRec(target.texture, (Rectangle){ 0, 0, target.texture.width, -target.texture.height }, (Vector2){ 0, 0 }, WHITE);
+
+ EndShaderMode();
DrawText("(c) Dwarf 3D model by David Moreno", screenWidth - 200, screenHeight - 20, 10, DARKGRAY);
diff --git a/examples/shaders_shapes_textures.c b/examples/shaders_shapes_textures.c
index 1b1142fa..0a14469f 100644
--- a/examples/shaders_shapes_textures.c
+++ b/examples/shaders_shapes_textures.c
@@ -65,16 +65,16 @@ int main()
// Activate our custom shader to be applied on next shapes/textures drawings
- SetCustomShader(shader);
+ BeginShaderMode(shader);
- DrawText("USING CUSTOM SHADER", 190, 40, 10, RED);
+ DrawText("USING CUSTOM SHADER", 190, 40, 10, RED);
- DrawRectangle(250 - 60, 90, 120, 60, RED);
- DrawRectangleGradient(250 - 90, 170, 180, 130, MAROON, GOLD);
- DrawRectangleLines(250 - 40, 320, 80, 60, ORANGE);
+ DrawRectangle(250 - 60, 90, 120, 60, RED);
+ DrawRectangleGradient(250 - 90, 170, 180, 130, MAROON, GOLD);
+ DrawRectangleLines(250 - 40, 320, 80, 60, ORANGE);
// Activate our default shader for next drawings
- SetDefaultShader();
+ EndShaderMode();
DrawText("USING DEFAULT SHADER", 370, 40, 10, RED);
@@ -89,12 +89,12 @@ int main()
DrawPoly((Vector2){430, 320}, 6, 80, 0, BROWN);
// Activate our custom shader to be applied on next shapes/textures drawings
- SetCustomShader(shader);
+ BeginShaderMode(shader);
- DrawTexture(sonic, 380, -10, WHITE); // Using custom shader
+ DrawTexture(sonic, 380, -10, WHITE); // Using custom shader
// Activate our default shader for next drawings
- SetDefaultShader();
+ EndShaderMode();
EndDrawing();
//----------------------------------------------------------------------------------
diff --git a/examples/textures_particles_trail_blending.c b/examples/textures_particles_trail_blending.c
index 76cd0423..0b47c790 100644
--- a/examples/textures_particles_trail_blending.c
+++ b/examples/textures_particles_trail_blending.c
@@ -102,20 +102,22 @@ int main()
ClearBackground(DARKGRAY);
- SetBlendMode(blending);
+ BeginBlendMode(blending);
- // Draw active particles
- for (int i = 0; i < MAX_PARTICLES; i++)
- {
- if (mouseTail[i].active) DrawTexturePro(smoke, (Rectangle){ 0, 0, smoke.width, smoke.height },
- (Rectangle){ mouseTail[i].position.x, mouseTail[i].position.y, smoke.width*mouseTail[i].size, smoke.height*mouseTail[i].size },
- (Vector2){ smoke.width*mouseTail[i].size/2, smoke.height*mouseTail[i].size/2 }, mouseTail[i].rotation,
- Fade(mouseTail[i].color, mouseTail[i].alpha));
- }
+ // Draw active particles
+ for (int i = 0; i < MAX_PARTICLES; i++)
+ {
+ if (mouseTail[i].active) DrawTexturePro(smoke, (Rectangle){ 0, 0, smoke.width, smoke.height },
+ (Rectangle){ mouseTail[i].position.x, mouseTail[i].position.y, smoke.width*mouseTail[i].size, smoke.height*mouseTail[i].size },
+ (Vector2){ smoke.width*mouseTail[i].size/2, smoke.height*mouseTail[i].size/2 }, mouseTail[i].rotation,
+ Fade(mouseTail[i].color, mouseTail[i].alpha));
+ }
+
+ EndBlendMode();
- DrawText("PRESS SPACE to CHANGE BLENDING MODE", 180, 20, 20, RAYWHITE);
+ DrawText("PRESS SPACE to CHANGE BLENDING MODE", 180, 20, 20, BLACK);
- if (blending == BLEND_ALPHA) DrawText("ALPHA BLENDING", 290, screenHeight - 40, 20, RAYWHITE);
+ if (blending == BLEND_ALPHA) DrawText("ALPHA BLENDING", 290, screenHeight - 40, 20, BLACK);
else DrawText("ADDITIVE BLENDING", 280, screenHeight - 40, 20, RAYWHITE);
EndDrawing();