Hi, I want to send a integer texture into the GLSL fragment shading codes, but when I check the texture data from the fragment code with ivec3 color=texture2D(texture1,0); I found the result is 0. The code is as following unsigned int imgdata[1]; imgdata[0]=2; img->setImage(1,1,1,GL_INTENSITY32UI_EXT,GL_INTENSITY,GL_UNSIGNED_INT,(unsigned char*)imgdata,osg::Image::USE_NEW_DELETE); osg::Texture2D *tex2d=new osg::Texture2D; tex2d->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::NEAREST); tex2d->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::NEAREST); tex2d->setWrap(osg::Texture2D::WRAP_R,osg::Texture2D::REPEAT); tex2d->setWrap(osg::Texture2D::WRAP_S,osg::Texture2D::REPEAT); tex2d->setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::REPEAT); tex2d->setImage(img); I have tried different type of parameters in setImage, for example img->setImage(1,1,1,GL_LUMINANCE,GL_LUMINANCE,GL_UNSIGNED_INT,(unsigned char*)imgdata,osg::Image::USE_NEW_DELETE); img->setImage(1,1,1,GL_RED,GL_RED,GL_UNSIGNED_INT,(unsigned char*)imgdata,osg::Image::USE_NEW_DELETE); but the result is still 0. However, the float texture works well, I don't know what's wrong with my integer texture.The float texture code is as following osg::Image* img = new osg::Image(); float imgdata[1]; imgdata[0]=2; img->setImage(1,1,1,GL_LUMINANCE32F_ARB,GL_LUMINANCE,GL_FLOAT,(unsigned char*)imgdata,osg::Image::USE_NEW_DELETE); ...
Thank you! Cheers, Ma ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59847#59847 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org