Ejemplo n.º 1
0
//----------------------------------------------------------------------------//
void OpenGL3Texture::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."));

    initInternalPixelFormatFields(pixel_format);
    setTextureSize_impl(buffer_size);

    // store size of original data we are loading
    d_dataSize = buffer_size;
    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);
}
Ejemplo n.º 2
0
//----------------------------------------------------------------------------//
void OpenGLTexture::initialise(GLuint tex, const Sizef& size) 
{
    d_ogltexture = tex;
    d_size = size;
    d_dataSize = size;
    initInternalPixelFormatFields(PF_RGBA);
    updateCachedScaleValues();
}
Ejemplo n.º 3
0
//----------------------------------------------------------------------------//
void OpenGL3Texture::setTextureSize(const Sizef& sz)
{
    initInternalPixelFormatFields(PF_RGBA);

    setTextureSize_impl(sz);

    d_dataSize = d_size;
    updateCachedScaleValues();
}
Ejemplo n.º 4
0
//----------------------------------------------------------------------------//
OpenGL3Texture::OpenGL3Texture(OpenGL3Renderer& 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)
{
    initInternalPixelFormatFields(PF_RGBA);
    generateOpenGLTexture();
}
Ejemplo n.º 5
0
//----------------------------------------------------------------------------//
OpenGL3Texture::OpenGL3Texture(OpenGL3Renderer& 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)
{
    initInternalPixelFormatFields(PF_RGBA);
    updateCachedScaleValues();
}
Ejemplo n.º 6
0
//----------------------------------------------------------------------------//
OpenGL3Texture::OpenGL3Texture(OpenGL3Renderer& 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)
{
    initInternalPixelFormatFields(PF_RGBA);
    generateOpenGLTexture();
    loadFromFile(filename, resourceGroup);
}
Ejemplo n.º 7
0
//----------------------------------------------------------------------------//
void OpenGLTexture::loadFromMemory(const void* buffer, const Sizef& buffer_size,
                    PixelFormat pixel_format)
{
    if (!isPixelFormatSupported(pixel_format))
        throw InvalidRequestException(
            "Data was supplied in an unsupported pixel format.");

    initInternalPixelFormatFields(pixel_format);
    setTextureSize_impl(buffer_size);

    // store size of original data we are loading
    d_dataSize = buffer_size;
    updateCachedScaleValues();

    blitFromMemory(buffer, Rectf(glm::vec2(0, 0), buffer_size));
}
Ejemplo n.º 8
0
//----------------------------------------------------------------------------//
void OpenGLTexture::initialise(const String& filename, const String& resourceGroup)
{
    initInternalPixelFormatFields(PF_RGBA);
    generateOpenGLTexture();
    loadFromFile(filename, resourceGroup);
}
Ejemplo n.º 9
0
//----------------------------------------------------------------------------//
void OpenGLTexture::initialise() 
{
    initInternalPixelFormatFields(PF_RGBA);
    generateOpenGLTexture();
}
Ejemplo n.º 10
0
//----------------------------------------------------------------------------//
void OpenGLTexture::initialise(const Sizef& size)
{
    initInternalPixelFormatFields(PF_RGBA);
    generateOpenGLTexture();
    setTextureSize(size);
}