Example #1
0
void Texture::draw (Pixmap& pixmap,int x,int y) {
    if (data->isManaged()) {
        gdx_cpp::Gdx::app->error(__FILE__ , "can't draw to a managed texture");
    }

    Gdx::gl->glBindTexture(GL_TEXTURE_2D, glHandle);
    Gdx::gl->glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, pixmap.getWidth(), pixmap.getHeight(), pixmap.getGLFormat(),
                             pixmap.getGLType(), (const unsigned char*) pixmap.getPixels());
}
Example #2
0
void TextureManager::loadTextures()
{
    for (auto pair : this->registeredTextures) {
        Texture::ptr& texture = pair.second;

        if (texture->getGlID() != 0) {
            continue;
        }

        Pixmap image;

        this->loader->loadImage(texture.get(), image);
        texture->setSize(image.getWidth(), image.getHeight());

        textureUtil.UploadTextureToHardware(image, *texture);
    }
}