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

@@ -1101,8 +1101,8 @@ class OSG_EXPORT Texture : public osg::StateAttribute
void discardAllDeletedTextureObjects();
void flushDeletedTextureObjects(double currentTime, double& availableTime);
TextureObject* takeFromOrphans(Texture* texture);
TextureObject* takeOrGenerate(Texture* texture);
osg::ref_ptr<TextureObject> takeFromOrphans(Texture* texture);
osg::ref_ptr<TextureObject> takeOrGenerate(Texture* texture);
void moveToBack(TextureObject* to);
void addToBack(TextureObject* to);
void orphan(TextureObject* to);
@@ -1167,8 +1167,8 @@ class OSG_EXPORT Texture : public osg::StateAttribute
bool hasSpace(unsigned int size) const { return (_currTexturePoolSize+size)<=_maxTexturePoolSize; }
bool makeSpace(unsigned int size);
TextureObject* generateTextureObject(const Texture* texture, GLenum target);
TextureObject* generateTextureObject(const Texture* texture,
osg::ref_ptr<TextureObject> generateTextureObject(const Texture* texture, GLenum target);
osg::ref_ptr<TextureObject> generateTextureObject(const Texture* texture,
GLenum target,
GLint numMipmapLevels,
GLenum internalFormat,
@@ -1231,9 +1231,9 @@ class OSG_EXPORT Texture : public osg::StateAttribute
static osg::ref_ptr<Texture::TextureObjectManager>& getTextureObjectManager(unsigned int contextID);
static TextureObject* generateTextureObject(const Texture* texture, unsigned int contextID,GLenum target);
static osg::ref_ptr<TextureObject> generateTextureObject(const Texture* texture, unsigned int contextID,GLenum target);
static TextureObject* generateTextureObject(const Texture* texture,
static osg::ref_ptr<TextureObject> generateTextureObject(const Texture* texture,
unsigned int contextID,
GLenum target,
GLint numMipmapLevels,
@@ -1243,6 +1243,17 @@ class OSG_EXPORT Texture : public osg::StateAttribute
GLsizei depth,
GLint border);
TextureObject* generateAndAssignTextureObject(unsigned int contextID, GLenum target) const;
TextureObject* generateAndAssignTextureObject(unsigned int contextID,
GLenum target,
GLint numMipmapLevels,
GLenum internalFormat,
GLsizei width,
GLsizei height,
GLsizei depth,
GLint border) const;
static void deleteAllTextureObjects(unsigned int contextID);
static void discardAllTextureObjects(unsigned int contextID);
static void flushAllDeletedTextureObjects(unsigned int contextID);

View File

@@ -95,7 +95,7 @@ class OSG_EXPORT Texture2D : public Texture
virtual TextureObject* generateTextureObject(const Texture2D& texture, State& state) const
{
return osg::Texture::generateTextureObject(&texture, state.getContextID(), GL_TEXTURE_2D);
return osg::Texture::generateTextureObject(&texture, state.getContextID(), GL_TEXTURE_2D).release();
}
virtual void load(const Texture2D& texture,State& state) const = 0;