//----------------------------------------------------------------------------// void OpenGLESTexture::loadFromMemory(const void* buffer, const Sizef& buffer_size, PixelFormat pixel_format) { if (!isPixelFormatSupported(pixel_format)) CEGUI_THROW(InvalidRequestException( "Data was supplied in an unsupported pixel format.")); initPixelFormatFields(pixel_format); setTextureSize_impl(buffer_size); // store size of original data we are loading d_dataSize = buffer_size; // update scale values updateCachedScaleValues(); // save old texture binding GLuint old_tex; glGetIntegerv(GL_TEXTURE_BINDING_2D, reinterpret_cast<GLint*>(&old_tex)); // do the real work of getting the data into the texture glBindTexture(GL_TEXTURE_2D, d_ogltexture); if (d_isCompressed) loadCompressedTextureBuffer(buffer_size, buffer); else loadUncompressedTextureBuffer(buffer_size, buffer); // restore previous texture binding. glBindTexture(GL_TEXTURE_2D, old_tex); }
//----------------------------------------------------------------------------// void OpenGLESTexture::setTextureSize(const Sizef& sz) { initPixelFormatFields(PF_RGBA); setTextureSize_impl(sz); d_dataSize = d_size; updateCachedScaleValues(); }
//----------------------------------------------------------------------------// OpenGLESTexture::OpenGLESTexture(OpenGLESRenderer& owner, const String& name) : d_size(0, 0), d_grabBuffer(0), d_dataSize(0, 0), d_texelScaling(0, 0), d_owner(owner), d_name(name) { initPixelFormatFields(PF_RGBA); generateOpenGLESTexture(); }
//----------------------------------------------------------------------------// OpenGLESTexture::OpenGLESTexture(OpenGLESRenderer& owner, const String& name, GLuint tex, const Sizef& size) : d_ogltexture(tex), d_size(size), d_grabBuffer(0), d_dataSize(size), d_owner(owner), d_name(name) { initPixelFormatFields(PF_RGBA); updateCachedScaleValues(); }
//----------------------------------------------------------------------------// OpenGLESTexture::OpenGLESTexture(OpenGLESRenderer& owner, const String& name, const String& filename, const String& resourceGroup) : d_size(0, 0), d_grabBuffer(0), d_dataSize(0, 0), d_owner(owner), d_name(name) { initPixelFormatFields(PF_RGBA); generateOpenGLESTexture(); loadFromFile(filename, resourceGroup); }
//----------------------------------------------------------------------------// void OpenGLESTexture::loadFromMemory(const void* buffer, const Sizef& buffer_size, PixelFormat pixel_format) { if (!isPixelFormatSupported(pixel_format)) CEGUI_THROW(InvalidRequestException( "Data was supplied in an unsupported pixel format.")); initPixelFormatFields(pixel_format); setTextureSize_impl(buffer_size); // store size of original data we are loading d_dataSize = buffer_size; updateCachedScaleValues(); blitFromMemory(buffer, Rectf(Vector2f(0, 0), buffer_size)); }