raylib icon indicating copy to clipboard operation
raylib copied to clipboard

[rlgl] Preserve texture on mode switching

Open Destructor17 opened this issue 1 year ago • 1 comments

rlBegin resets texture to default when drawing mode switches. This PR makes rlBegin preserve texture. Since many routines expect texture to be default if not explicitly specified, rlEnd now resets texture to default.

Fixes https://github.com/raysan5/raylib/issues/4347

Destructor17 avatar Oct 04 '24 17:10 Destructor17

@Destructor17 I can't remember now but I'm sure there was a reason why texture reseting was not done on rlEnd(), I think it was related to batch buffer filling in the middle of drawing before reaching rlEnd() but not sure. I prefer to avoid this change for now but we can keep the PR open for further investigation and testing.

raysan5 avatar Oct 06 '24 13:10 raysan5

I've been reviewing this change and I'm merging it but I'm still not fully convinced it won't break in some unexpected situation. I think it was done that way for some reason but it was so long ago that I can't remember now. Anyway, merging it.

raysan5 avatar Feb 25 '25 11:02 raysan5

@Destructor17 This change broke the batching system, reverted.

raysan5 avatar Mar 21 '25 16:03 raysan5