Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix examples/shaders/shaders_texture_outline.c help instructions #3278

Merged
merged 1 commit into from Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions examples/shaders/shaders_texture_outline.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,18 @@ int main(void)
InitWindow(screenWidth, screenHeight, "raylib [shaders] example - Apply an outline to a texture");

Texture2D texture = LoadTexture("resources/fudesumi.png");

Shader shdrOutline = LoadShader(0, TextFormat("resources/shaders/glsl%i/outline.fs", GLSL_VERSION));

float outlineSize = 2.0f;
float outlineColor[4] = { 1.0f, 0.0f, 0.0f, 1.0f }; // Normalized RED color
float outlineColor[4] = { 1.0f, 0.0f, 0.0f, 1.0f }; // Normalized RED color
float textureSize[2] = { (float)texture.width, (float)texture.height };

// Get shader locations
int outlineSizeLoc = GetShaderLocation(shdrOutline, "outlineSize");
int outlineColorLoc = GetShaderLocation(shdrOutline, "outlineColor");
int textureSizeLoc = GetShaderLocation(shdrOutline, "textureSize");

// Set shader values (they can be changed later)
SetShaderValue(shdrOutline, outlineSizeLoc, &outlineSize, SHADER_UNIFORM_FLOAT);
SetShaderValue(shdrOutline, outlineColorLoc, outlineColor, SHADER_UNIFORM_VEC4);
Expand All @@ -64,7 +64,7 @@ int main(void)
//----------------------------------------------------------------------------------
outlineSize += GetMouseWheelMove();
if (outlineSize < 1.0f) outlineSize = 1.0f;

SetShaderValue(shdrOutline, outlineSizeLoc, &outlineSize, SHADER_UNIFORM_FLOAT);
//----------------------------------------------------------------------------------

Expand All @@ -75,13 +75,13 @@ int main(void)
ClearBackground(RAYWHITE);

BeginShaderMode(shdrOutline);

DrawTexture(texture, GetScreenWidth()/2 - texture.width/2, -30, WHITE);

EndShaderMode();

DrawText("Shader-based\ntexture\noutline", 10, 10, 20, GRAY);

DrawText("Scroll mouse wheel to\nchange outline size", 10, 72, 20, GRAY);
DrawText(TextFormat("Outline size: %i px", (int)outlineSize), 10, 120, 20, MAROON);

DrawFPS(710, 10);
Expand All @@ -99,4 +99,4 @@ int main(void)
//--------------------------------------------------------------------------------------

return 0;
}
}
Binary file modified examples/shaders/shaders_texture_outline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading