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.
This commit is contained in:
Jonas Kulla 2014-08-12 19:42:31 +02:00
parent 1767b200c7
commit 0af5e9d66c
1 changed files with 11 additions and 0 deletions

View File

@ -42,6 +42,10 @@ struct ID \
{ \ { \
return gl == o.gl; \ return gl == o.gl; \
} \ } \
bool operator!=(const ID &o) const \
{ \
return !(*this == o); \
} \
}; };
/* 2D Texture */ /* 2D Texture */
@ -236,6 +240,13 @@ struct TEXFBO
FBO::del(obj.fbo); FBO::del(obj.fbo);
TEX::del(obj.tex); 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 #endif // GLUTIL_H