Browse Source

Update shaders_multi_sample2d.c

pull/5075/head
Ray 4 months ago
parent
commit
414235dd17
1 changed files with 8 additions and 6 deletions
  1. +8
    -6
      examples/shaders/shaders_multi_sample2d.c

+ 8
- 6
examples/shaders/shaders_multi_sample2d.c View File

@ -82,16 +82,18 @@ int main(void)
BeginShaderMode(shader);
// WARNING: Additional samplers are enabled for all draw calls in the batch,
// EndShaderMode() forces batch drawing and consequently resets active textures
// to let other sampler2D to be activated on consequent drawings (if required)
// WARNING: Additional textures (sampler2D) are enabled for ALL draw calls in the batch,
// but EndShaderMode() forces batch drawing and resets active textures, this way
// 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);
// We are drawing texRed using default sampler2D texture0 but
// an additional texture units is enabled for texBlue (sampler2D texture1)
// We are drawing texRed using default p">[sampler2D texture0] but
// an additional texture units is enabled for texBlue [sampler2D texture1]
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);

Loading…
Cancel
Save