From Jannik Heller, "I have added new functions Texture::generateAndAssignTextureObject mirroring the Texture::generateTextureObject functions.

I have left the Texture::generateTextureObject functions intact as I'm not sure if/how it's used outside the core OSG. If you feel that compatibility isn't important in that area feel free to drop it.

While testing the build with OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION=OFF I found a compile error in GlyphGeometry.cpp that was entirely unrelated to the changes I've made. The fix is included in the patch.

There is one thing left to fix and that is Texture2D::SubloadCallback:

        class OSG_EXPORT SubloadCallback : public Referenced
        {
            public:
                ....
                virtual TextureObject* generateTextureObject(const Texture2D& texture, State& state) const
                {
                    return osg::Texture::generateTextureObject(&texture, state.getContextID(), GL_TEXTURE_2D);
                }
                ...
         }"
         


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14879 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield
2015-06-01 10:50:44 +00:00
parent 44c406e167
commit 78a01ce2a5
12 changed files with 79 additions and 59 deletions

View File

@@ -315,7 +315,7 @@ void Texture2DArray::apply(State& state) const
else if (_subloadCallback.valid())
{
// generate texture (i.e. glGenTexture) and apply parameters
_textureObjectBuffer[contextID] = textureObject = generateTextureObject(this, contextID, GL_TEXTURE_2D_ARRAY_EXT);
textureObject = generateAndAssignTextureObject(contextID, GL_TEXTURE_2D_ARRAY_EXT);
textureObject->bind();
applyTexParameters(GL_TEXTURE_2D_ARRAY_EXT, state);
_subloadCallback->load(*this,state);
@@ -333,15 +333,13 @@ void Texture2DArray::apply(State& state) const
computeRequiredTextureDimensions(state,*_images[0],_textureWidth, _textureHeight, _numMipmapLevels);
// create texture object
textureObject = generateTextureObject(
this, contextID, GL_TEXTURE_2D_ARRAY_EXT,_numMipmapLevels, _internalFormat, _textureWidth, _textureHeight, textureDepth,0);
textureObject = generateAndAssignTextureObject(
contextID, GL_TEXTURE_2D_ARRAY_EXT,_numMipmapLevels, _internalFormat, _textureWidth, _textureHeight, textureDepth,0);
// bind texture
textureObject->bind();
applyTexParameters(GL_TEXTURE_2D_ARRAY_EXT, state);
_textureObjectBuffer[contextID] = textureObject;
// First we need to allocate the texture memory
int sourceFormat = _sourceFormat ? _sourceFormat : _internalFormat;
@@ -426,8 +424,8 @@ void Texture2DArray::apply(State& state) const
else if ( (_textureWidth > 0) && (_textureHeight > 0) && (_textureDepth > 0) && (_internalFormat!=0) )
{
// generate texture
_textureObjectBuffer[contextID] = textureObject = generateTextureObject(
this, contextID, GL_TEXTURE_2D_ARRAY_EXT,_numMipmapLevels,_internalFormat, _textureWidth, _textureHeight, _textureDepth,0);
textureObject = generateAndAssignTextureObject(
contextID, GL_TEXTURE_2D_ARRAY_EXT,_numMipmapLevels,_internalFormat, _textureWidth, _textureHeight, _textureDepth,0);
textureObject->bind();
applyTexParameters(GL_TEXTURE_2D_ARRAY_EXT,state);