Hi Aurelien,

I am seeing you are using custom API for the textures. My case was pure
OpenGL (which I don;t think it makes any difference). I found the way to
reuse the texture I am creating and only installing new
Texture::TextureObject from my initial attempt. The "not implemented"
release is still present when app exits but no longer bugged with the
warnings in real-time. Thanks again for sharing. This email was more for
the archive if someone ends up in similar situation

Nick


On Thu, Oct 10, 2013 at 12:39 PM, Trajce Nikolov NICK <
trajce.nikolov.n...@gmail.com> wrote:

> thanks !
>
> Nick
>
>
> On Thu, Oct 10, 2013 at 12:13 PM, Aurelien Albert <
> aurelien.alb...@alyotech.fr> wrote:
>
>> Hi,
>>
>> Here it is :
>>
>>
>> Code:
>> #include <RenderBox/GLBoxWrappers/GLBoxOsgTexture.h>
>> #include <GLBox/Texture/Texture.h>
>> //
>> MyTexture::MyTexture()
>>         : osg::StateAttribute   ()
>>         , p_CustomerTexture             (NULL)
>> {
>> }
>> //
>> MyTexture::MyTexture(CustomerTexture* pCustomerTexture)
>>         : osg::StateAttribute   ()
>>         , p_CustomerTexture             (NULL)
>> {
>>         setCustomerTexture(pCustomerTexture);
>> }
>> //
>> MyTexture::MyTexture(const MyTexture& texture, const osg::CopyOp& copyop)
>>         : osg::StateAttribute   (texture, copyop)
>>         , p_CustomerTexture             (NULL)
>> {
>>         setCustomerTexture(texture.customerTexture());
>> }
>> //
>> osg::Object* MyTexture::cloneType() const
>> {
>>         return new MyTexture ();
>> }
>> //
>> osg::Object* MyTexture::clone(const osg::CopyOp& copyop) const
>> {
>>         return new MyTexture (*this, copyop);
>> }
>> //
>> bool MyTexture::isSameKindAs(const osg::Object* pObj) const
>> {
>>         return dynamic_cast<const MyTexture *>(pObj)!=NULL;
>> }
>> //
>> const char* MyTexture::libraryName() const
>> {
>>         return "MyLibrary";
>> }
>> //
>> const char* MyTexture::className() const
>> {
>>         return "MyTexture";
>> }
>> //
>> MyTexture::~Texture()
>> {
>> }
>> //
>> CustomerTexture* MyTexture::customerTexture() const
>> {
>>         return p_CustomerTexture;
>> }
>> //
>> void MyTexture::setCustomerTexture(CustomerTexture* pCustomerTexture)
>> {
>>         p_CustomerTexture = pCustomerTexture;
>> }
>> //
>> osg::StateAttribute::Type MyTexture::getType() const
>> {
>>         return osg::StateAttribute::TEXTURE;
>> }
>> //
>> bool MyTexture::isTextureAttribute() const
>> {
>>         return true;
>> }
>> //
>> int MyTexture::compare(const osg::StateAttribute& stateAttribute) const
>> {
>>         MyTexture  const* pOther = dynamic_cast<MyTexture
>>  const*>(&stateAttribute);
>>
>>         if (pOther != NULL)
>>         {
>>                 if (p_CustomerTexture == pOther->GLBoxTexture())
>>                 {
>>                         return 0;
>>                 }
>>
>>                 return 1;
>>         }
>>
>>         return -1;
>> }
>> //
>> bool MyTexture::getModeUsage(osg::StateAttribute::ModeUsage& modeUsage)
>> const
>> {
>>         if (p_CustomerTexture != NULL)
>>         {
>>                 modeUsage.usesTextureMode(p_CustomerTexture->target());
>>                 return true;
>>         }
>>
>>         return false;
>> }
>> //
>> void MyTexture::apply(osg::State& /*state*/) const
>> {
>>         if (p_CustomerTexture != NULL)
>>         {
>>                 // Execute a "glBind" using the pre-allocated customer
>> texure id
>>                 // Take care of mulitple context/sharing contexts....
>>                 p_CustomerTexture->bindYourCustomerTexture();
>>         }
>> }
>> //
>> void MyTexture::compileGLObjects(osg::State& /*state*/) const
>> {
>>         // Nothing to do : the OpenGL texture should be managed by the
>> "CustomerTexture" class
>> }
>> //
>> void MyTexture::resizeGLObjectBuffers(unsigned int /*maxSize*/)
>> {
>>         // Nothing to do : the OpenGL texture should be managed by the
>> "CustomerTexture" class
>> }
>> //
>> void MyTexture::releaseGLObjects(osg::State* /*pState*/) const
>> {
>>         // Nothing to do : the OpenGL texture should be managed by the
>> "CustomerTexture" class
>> }
>>
>>
>>
>>
>>
>> Cheers,
>> Aurelien
>>
>> ------------------
>> Read this topic online here:
>> http://forum.openscenegraph.org/viewtopic.php?p=56708#56708
>>
>>
>>
>>
>>
>> _______________________________________________
>> osg-users mailing list
>> osg-users@lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>
>
>
> --
> trajce nikolov nick
>



-- 
trajce nikolov nick
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to