Hi Sajjadul,

For an osg::Texture to create all the OpenGL texture objects you need to
call the Texture::apply(State&) method from the appropriate graphics
thread.  The OSG will normally call this automatically for you.  With you
mixing CUDA and OSG you'll probably need to manage this yourself.  I
haven't played with CUDA so can't comment on the specifics of this.

Robert.


On 14 January 2014 22:46, Sajjadul Islam <[email protected]> wrote:

> Hi,
>
> I am creating an empty texture object as follows:
>
>
> Code:
>
>     osg::ref_ptr< osgCuda::Texture2D > trgTexture = new osgCuda::Texture2D;
>     trgTexture->setName( "Target Texture" );
>     trgTexture->addIdentifier( "TRG_BUFFER" );
>     // Note: GL_RGBA8 Bit format is not yet supported by CUDA, use
> GL_RGBA8UI_EXT instead.
>     // GL_RGBA8UI_EXT requires the additional work of scaling the fragment
> shader
>     // output from 0-1 to 0-255.
>     trgTexture->setInternalFormat( GL_RGBA32F_ARB );
>     trgTexture->setSourceFormat( GL_RGBA );
>     trgTexture->setSourceType( GL_FLOAT );
>     // in case you choose a texture size which is not a multiple of the
> alignment restriction CUDA
>     // will allocate more memory to fulfill the alignemnt requirements. To
> get the
>     // actual pitch (bytes of a single row) call
> osgCompute::Memory::getPitch()
>     trgTexture->setTextureWidth( srcImage->s());
>     trgTexture->setTextureHeight( srcImage->t() );
>
>
>
>
> Source image's width and height is assigned, but not the image data
> itself, because there is no data yet. So the texture is empty. Is there any
> way to make sure that the texture is complete or not ?
>
> One more thing  - is there any way within osg to initialize the texture
> with the zero value ?
>
> Cheers,
> Sajjadul
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=57879#57879
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to