From 03eeb7f4e9e59d2daa9b2add7a21738a4d1f2b03 Mon Sep 17 00:00:00 2001 From: fgenesis Date: Wed, 25 Oct 2023 01:52:03 +0200 Subject: [PATCH] only update VBO if texcoords actually change --- BBGE/RenderGrid.cpp | 7 +++++-- BBGE/Texture.h | 9 +++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/BBGE/RenderGrid.cpp b/BBGE/RenderGrid.cpp index 5730192..8b62c6c 100644 --- a/BBGE/RenderGrid.cpp +++ b/BBGE/RenderGrid.cpp @@ -132,8 +132,11 @@ void RenderGrid::setDrawOrder(GridDrawOrder ord, bool force) void RenderGrid::setTexCoords(const TexCoordBox& tc) { - this->tc = tc; - needVBOUpdate = true; + if(this->tc != tc) + { + this->tc = tc; + needVBOUpdate = true; + } } diff --git a/BBGE/Texture.h b/BBGE/Texture.h index 6469af0..d478db7 100644 --- a/BBGE/Texture.h +++ b/BBGE/Texture.h @@ -31,6 +31,15 @@ struct TexCoordBox bool isStandard() const; void setStandard(); + + bool operator==(const TexCoordBox& o) const + { + return u1 == o.u1 && v1 == o.v1 && u2 == o.u2 && v2 == o.v2; + } + inline bool operator!=(const TexCoordBox& o) const + { + return !(*this == o); + } }; enum TextureLoadResult