How do I add a texture to a mesh when using the mesh API

How do I add a texture to a mesh when using the mesh API

chris_smith7
Not applicable
173 Views
2 Replies
Message 1 of 3

How do I add a texture to a mesh when using the mesh API

chris_smith7
Not applicable

[ FlexSim 18.2.2 ]

I have been unable to figure out how to add a texture to a mesh when using the mesh API. I assume adding a texture is possible as it is my understanding that the mesh API is used for drawing conveyor objects.

The mesh I am drawing is being drawn and shows the correct ambient and diffuse colors if I use fglDisable(GL_TEXTURE_2D). The example in the following question seems to use that to disable the texture rendering to display those colors:

https://answers.flexsim.com/questions/46673/how-to-use-mesh-api.html

I have tried using bindtexture, but it doesn't seem to display the provided texture. If anyone has any examples or tips on how to get the texture to show, then that would be appreciated.

0 Likes
Accepted solutions (1)
174 Views
2 Replies
Replies (2)
Message 2 of 3

philboboADSK
Autodesk
Autodesk
Accepted solution

Add texture coordinates to your vertices and then bind the texture before drawing the mesh:

14896-mesh-texture.png

mesh-with-texture.fsm



Phil BoBo
Sr. Manager, Software Development
Message 3 of 3

chris_smith7
Not applicable

@phil.bobo

Thanks for the quick response! That did the trick.

0 Likes