82 |
if(!id) throw InvalidTexture(); |
if(!id) throw InvalidTexture(); |
83 |
glBindTexture(target, id); |
glBindTexture(target, id); |
84 |
} |
} |
85 |
|
void unbind(GLenum target = GL_TEXTURE_2D) { |
86 |
|
glBindTexture(target, 0); |
87 |
|
} |
88 |
/** Compare two Ids -- usual semantics. |
/** Compare two Ids -- usual semantics. |
89 |
*/ |
*/ |
90 |
bool operator==(const Id &t) const { return id == t.id; } |
bool operator==(const Id &t) const { return id == t.id; } |
260 |
} |
} |
261 |
void setGLPixelModes() { |
void setGLPixelModes() { |
262 |
glPixelStorei(GL_UNPACK_ALIGNMENT, 1); |
glPixelStorei(GL_UNPACK_ALIGNMENT, 1); |
263 |
|
glPixelStorei(GL_UNPACK_ROW_LENGTH, width); |
264 |
} |
} |
265 |
|
|
266 |
void *getPointer() { |
void *getPointer() { |
357 |
} |
} |
358 |
void reload() { |
void reload() { |
359 |
texid.bind(); |
texid.bind(); |
360 |
|
glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT); |
361 |
content->setGLPixelModes(); |
content->setGLPixelModes(); |
362 |
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); |
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); |
363 |
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); |
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); |
369 |
glEnable(GL_TEXTURE_2D); |
glEnable(GL_TEXTURE_2D); |
370 |
|
|
371 |
content->call_gluBuild2DMipmaps(); |
content->call_gluBuild2DMipmaps(); |
372 |
|
glPopClientAttrib(); |
373 |
|
texid.unbind(); |
374 |
|
|
375 |
} |
} |
376 |
int getWidth() { return content->getWidth(); } |
int getWidth() { return content->getWidth(); } |