Hello,

I set a texture on a big plane with the following lines :


Code:

Image* image = osgDB::readImageFile("resources/textures/sable-jaune.bmp");
Texture2D* texture = new osg::Texture2D;
TexMat* tmat = new TexMat;
tmat->setMatrix(Matrix::scale(100,100,1));
if (image)
{
texture->setDataVariance(Object::DYNAMIC);
texture->setFilter(Texture::MIN_FILTER, Texture::LINEAR_MIPMAP_LINEAR);
texture->setFilter(Texture::MAG_FILTER, Texture::LINEAR);
texture->setWrap(Texture::WRAP_S, Texture::REPEAT);
texture->setWrap(Texture::WRAP_T, Texture::REPEAT);
texture->setImage(image);
}else
{
throw runtime_error("Impossible de charger la texture du seab bed.");
}
m_geode->getOrCreateStateSet()->setTextureAttributeAndModes(0, texture, 
StateAttribute::ON);
m_geode->getStateSet()->setTextureAttribute(0, tmat);
m_geode->getStateSet()->addUniform( new osg::Uniform( "uTextureMap", 0 ) );
m_geode->getStateSet()->setTextureMode(0,GL_TEXTURE_1D,osg::StateAttribute::OFF);
m_geode->getStateSet()->setTextureMode(0,GL_TEXTURE_2D,osg::StateAttribute::ON);
m_geode->getStateSet()->setTextureMode(0,GL_TEXTURE_3D,osg::StateAttribute::OFF)




When I execute my application, I can see my plane (m_geode) textured with 
"sable-jaune.bmp" repeated in bothes directions.
All is right !

Now, I enable my shaders programs, and my texture is scaled to the plane's size 
(not repeated).
Here is my vertex shader :

Code:

...
gl_TexCoord[0] = gl_MultiTexCoord0;
...




And my fragment shader contain :

Code:

uniform sampler2D uTextureMap;
...
vec4 textureColor = texture2D( uTextureMap, gl_TexCoord[0] );
final_color=f(textureColor);
gl_FragColor = final_color;




Why these shaders doesn't repeat my texture pattern ?


Cheers,

Adrien
Code:




------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=32430#32430





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to