![]() |
Maria GDK 5.0.0.810
Documentation of native code in develop branch
|
#include <StkSafeTextureBinding.h>
Public Member Functions | |
void | bind (GLuint texture, GLenum unit=0) |
void | restore () |
SafeTextureBinding - Utility class for safely binding OpenGL textures This class stores the current bindings and restores them on unbind
NOTE: This may not always be entirely correct since a texture handle can be reused. I.e you may get the follwing situation:
GLuint h; glGenTextures(1, &h); // h == 46 glBindTexture(GL_TEXTURE_2D, h); // now bound // ... use texture ... glDeleteTextures(1, &h); // h is marked for deletion, but still bound // ... at this point, GL_TEXTURE_BINDING_2D still returns 46! glGenTextures(1, &h); // h == 46 (driver reuses handle) glGetIntegerv(GL_TEXTURE_BINDING_2D, &curr_tex); // Returns 46
So use this class with a bit of caution!