raylib
raylib copied to clipboard
[rlgl] Preserve texture on mode switching
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 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.
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.
@Destructor17 This change broke the batching system, reverted.