/* osgCompute - Copyright (C) 2008-2009 SVT Group
*                                                                     
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*                                                                     
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of 
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU Lesse General Public License for more details.
*
* The full license is in LICENSE file included with this distribution.
*/

#ifndef OSGCUDA_TEXTURE1D
#define OSGCUDA_TEXTURE1D 1

#include <osg/Texture1D>
#include <osgCuda/Texture>

namespace osgCuda
{
    /**
    */
    class LIBRARY_EXPORT Texture1D : public Texture, public osg::Texture1D
    {
    public:
        Texture1D();

        META_Texture( osgCuda, Texture1D )

        virtual bool init();

        virtual void apply(osg::State& state) const;
        virtual void releaseGLObjects(osg::State* state=0) const;

        virtual osg::Image* getImagePtr();
        virtual const osg::Image* getImagePtr() const;

        virtual void clear();
    protected:
        virtual ~Texture1D();
        void clearLocal();

        virtual bool initDimension();

		virtual void syncModifiedCounter( const osgCompute::Context& context ) const;
        virtual bool allocPBO( TextureStream& stream ) const;
        virtual void syncPBO( TextureStream& stream ) const;
        virtual void syncTexture( TextureStream& stream ) const;

        virtual osgCompute::BufferStream* newStream( const osgCompute::Context& context ) const;
    private:
        // copy constructor and operator should not be called
        Texture1D( const Texture1D& , const osg::CopyOp& ) {}
        Texture1D& operator=(const Texture1D&) { return (*this); }
    };
}


#endif //OSGCUDA_TEXTURE1D
