Great explanation, thanks.

So, in that example I don't think the texture code should be there. No texture is ever loaded.

Cory

Vincent Bourdier wrote:
Hi Cory,

Texture coordinates is a basic way to apply a texture on a geometry.
For each vertex, you give a 2D coordinate data to associate a vertex and a texture point. OpenGl will interpolate the texture pixel between each vertex, depending on theses coordinates.

The 2D texture coordinate have to be like this in your texture image:
[0,0]        [1,0]
  |------------|
  |            |
  |            |
  |            |
  |            |
  |------------|

[0,1]        [1,1]
  

In your example, with a single file of texture, you set the texture for each side.
For each texture you set in OSG, you can set a texCoordinateArray.
The index you set  pyramidGeometry->setTexCoordArray(0,texcoords); correspond to the texture index you set before, when setting the texture.

Have a look on Texture coordinate on the web, you'll find a lot of explanations.

Hope this will help you.

Regards,
   Vincent.

2009/1/21 Cory Riddell <[email protected]>
I'm working my way through some of the tutorials. Right now I'm on:
http://www.openscenegraph.org/projects/osg/wiki/Support/Tutorials/BasicGeometry

In the code on that page is this:

 osg::Vec2Array* texcoords = new osg::Vec2Array(5);
 (*texcoords)[0].set(0.00f,0.0f);
 (*texcoords)[1].set(0.25f,0.0f);
 (*texcoords)[2].set(0.50f,0.0f);
 (*texcoords)[3].set(0.75f,0.0f);
 (*texcoords)[4].set(0.50f,1.0f);
 pyramidGeometry->setTexCoordArray(0,texcoords);


Can somebody explain what this is doing?

Thanks,
cr
_______________________________________________
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
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to