Exemplo n.º 1
0
osg::Image* GlyphTexture::createImage()
{
    osg::ref_ptr<osg::Image> image = new osg::Image;
    image->allocateImage(getTextureWidth(), getTextureHeight(), 1, GL_ALPHA, GL_UNSIGNED_BYTE);
    memset(image->data(), 0, image->getTotalSizeInBytes());

    for(GlyphRefList::iterator itr = _glyphs.begin();
        itr != _glyphs.end();
        ++itr)
    {
        Glyph* glyph = itr->get();
        image->copySubImage(glyph->getTexturePositionX(), glyph->getTexturePositionY(), 0, glyph);
    }

    return image.release();
}
Exemplo n.º 2
0
void GlyphTexture::resizeGLObjectBuffers(unsigned int maxSize)
{
    osg::Texture2D::resizeGLObjectBuffers(maxSize);

    unsigned int initialSize = _glyphsToSubload.size();
    _glyphsToSubload.resize(maxSize);
    
    for(unsigned i=initialSize; i<_glyphsToSubload.size(); ++i)
    {
        for(GlyphRefList::iterator itr = _glyphs.begin();
            itr != _glyphs.end();
            ++itr)
        {
            _glyphsToSubload[i].push_back(itr->get());
        }
    }
}
Exemplo n.º 3
0
osg::Image* GlyphTexture::createImage()
{
    if (!_image)
    {
        _image = new osg::Image;
        _image->allocateImage(getTextureWidth(), getTextureHeight(), 1, OSGTEXT_GLYPH_FORMAT, GL_UNSIGNED_BYTE);
        memset(_image->data(), 0, _image->getTotalSizeInBytes());

        for(GlyphRefList::iterator itr = _glyphs.begin();
            itr != _glyphs.end();
            ++itr)
        {
            Glyph* glyph = itr->get();
            _image->copySubImage(glyph->getTexturePositionX(), glyph->getTexturePositionY(), 0, glyph);
        }
    }

    return _image.get();
}