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

This commit is contained in:
Asdqwe 2023-08-30 17:42:01 -03:00 committed by GitHub
parent fefe8fcda9
commit 3d0d54e070
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 9 deletions

View File

@ -37,18 +37,18 @@ int main(void)
InitWindow(screenWidth, screenHeight, "raylib [shaders] example - Apply an outline to a texture"); InitWindow(screenWidth, screenHeight, "raylib [shaders] example - Apply an outline to a texture");
Texture2D texture = LoadTexture("resources/fudesumi.png"); Texture2D texture = LoadTexture("resources/fudesumi.png");
Shader shdrOutline = LoadShader(0, TextFormat("resources/shaders/glsl%i/outline.fs", GLSL_VERSION)); Shader shdrOutline = LoadShader(0, TextFormat("resources/shaders/glsl%i/outline.fs", GLSL_VERSION));
float outlineSize = 2.0f; 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 }; float textureSize[2] = { (float)texture.width, (float)texture.height };
// Get shader locations // Get shader locations
int outlineSizeLoc = GetShaderLocation(shdrOutline, "outlineSize"); int outlineSizeLoc = GetShaderLocation(shdrOutline, "outlineSize");
int outlineColorLoc = GetShaderLocation(shdrOutline, "outlineColor"); int outlineColorLoc = GetShaderLocation(shdrOutline, "outlineColor");
int textureSizeLoc = GetShaderLocation(shdrOutline, "textureSize"); int textureSizeLoc = GetShaderLocation(shdrOutline, "textureSize");
// Set shader values (they can be changed later) // Set shader values (they can be changed later)
SetShaderValue(shdrOutline, outlineSizeLoc, &outlineSize, SHADER_UNIFORM_FLOAT); SetShaderValue(shdrOutline, outlineSizeLoc, &outlineSize, SHADER_UNIFORM_FLOAT);
SetShaderValue(shdrOutline, outlineColorLoc, outlineColor, SHADER_UNIFORM_VEC4); SetShaderValue(shdrOutline, outlineColorLoc, outlineColor, SHADER_UNIFORM_VEC4);
@ -64,7 +64,7 @@ int main(void)
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
outlineSize += GetMouseWheelMove(); outlineSize += GetMouseWheelMove();
if (outlineSize < 1.0f) outlineSize = 1.0f; if (outlineSize < 1.0f) outlineSize = 1.0f;
SetShaderValue(shdrOutline, outlineSizeLoc, &outlineSize, SHADER_UNIFORM_FLOAT); SetShaderValue(shdrOutline, outlineSizeLoc, &outlineSize, SHADER_UNIFORM_FLOAT);
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
@ -75,13 +75,13 @@ int main(void)
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE);
BeginShaderMode(shdrOutline); BeginShaderMode(shdrOutline);
DrawTexture(texture, GetScreenWidth()/2 - texture.width/2, -30, WHITE); DrawTexture(texture, GetScreenWidth()/2 - texture.width/2, -30, WHITE);
EndShaderMode(); EndShaderMode();
DrawText("Shader-based\ntexture\noutline", 10, 10, 20, GRAY); 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); DrawText(TextFormat("Outline size: %i px", (int)outlineSize), 10, 120, 20, MAROON);
DrawFPS(710, 10); DrawFPS(710, 10);
@ -99,4 +99,4 @@ int main(void)
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
return 0; return 0;
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 258 KiB

After

Width:  |  Height:  |  Size: 258 KiB