From 0af5e9d66c6a5a186937bf19889ca427dd2dbfcc Mon Sep 17 00:00:00 2001 From: Jonas Kulla Date: Tue, 12 Aug 2014 19:42:31 +0200 Subject: [PATCH] gl-util.h: Add GL ID != operator and TEXFBO::clear TEXFBO::clear resets the struct into its state right after creation, nulling all IDs inside so they're invaid. --- src/gl-util.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/gl-util.h b/src/gl-util.h index 57a0b4e..f6c15c2 100644 --- a/src/gl-util.h +++ b/src/gl-util.h @@ -42,6 +42,10 @@ struct ID \ { \ return gl == o.gl; \ } \ + bool operator!=(const ID &o) const \ + { \ + return !(*this == o); \ + } \ }; /* 2D Texture */ @@ -236,6 +240,13 @@ struct TEXFBO FBO::del(obj.fbo); TEX::del(obj.tex); } + + static inline void clear(TEXFBO &obj) + { + obj.tex = TEX::ID(0); + obj.fbo = FBO::ID(0); + obj.width = obj.height = 0; + } }; #endif // GLUTIL_H