/*----------------------------------------------------------------------------*/ bool Texture1d::reload() { if (fileName_) { // not a render texture GLsizei width, height, pixelSize; GLint format; GLenum srcDataFormat, srcDataType; void *srcData = loadRawData(fileName_, &width, &height, &pixelSize, &format, &srcDataFormat, &srcDataType); if (!srcData) return false; // (re) upload to texture object: bind(); // must ensure texture is bound for upload operation! // use SRGB if necessary: if (checkOptionMask(TEX_SRGB)) { if (format == GL_RGB) format = GL_SRGB; else if (format == GL_SRGB_ALPHA) format = GL_SRGB_ALPHA; } /*if (!proxy(format, width, height, checkOptionMask(TEX_MIPMAP))) { oogl::logEvent("Error: could not create texture %ux%u %s", width, height, oogl::getEnumString(format)); freeRawData(srcData); return false; }*/ image(0, format, width, srcDataFormat, srcDataType, srcData); freeRawData(srcData); if (checkOptionMask(TEX_MIPMAP)) generateMipmap(); } return true; }
GLTexture::~GLTexture() { freeRawData(); freeTexture(); }