Update shaders_multi_sample2d.c

This commit is contained in:
Ray
2025-07-30 16:06:43 +02:00
parent 138010c1eb
commit 414235dd17

View File

@@ -82,16 +82,18 @@ int main(void)
BeginShaderMode(shader); BeginShaderMode(shader);
// WARNING: Additional samplers are enabled for all draw calls in the batch, // WARNING: Additional textures (sampler2D) are enabled for ALL draw calls in the batch,
// EndShaderMode() forces batch drawing and consequently resets active textures // but EndShaderMode() forces batch drawing and resets active textures, this way
// to let other sampler2D to be activated on consequent drawings (if required) // other textures (sampler2D) can be activated on consequent drawings (if required)
// The downside of this approach is that SetShaderValue() must be called inside the loop,
// to be set again after every EndShaderMode() reset
SetShaderValueTexture(shader, texBlueLoc, texBlue); SetShaderValueTexture(shader, texBlueLoc, texBlue);
// We are drawing texRed using default sampler2D texture0 but // We are drawing texRed using default [sampler2D texture0] but
// an additional texture units is enabled for texBlue (sampler2D texture1) // an additional texture units is enabled for texBlue [sampler2D texture1]
DrawTexture(texRed, 0, 0, WHITE); DrawTexture(texRed, 0, 0, WHITE);
EndShaderMode(); EndShaderMode(); // Texture sampler2D is reseted, needs to be set again for next frame
DrawText("Use KEY_LEFT/KEY_RIGHT to move texture mixing in shader!", 80, GetScreenHeight() - 40, 20, RAYWHITE); DrawText("Use KEY_LEFT/KEY_RIGHT to move texture mixing in shader!", 80, GetScreenHeight() - 40, 20, RAYWHITE);