5

I am new to game programming and graphics programming. However, I eagerly wish to learn, so I have begun building a game engine with OpenGL. I have implemented all of the basic graphical features, and now I want to add texture support for my triangle meshes.

The only tutorials I can find for texture mapping is for a single polygon - how do I define a texture that wraps around the entire mesh?

I am loading the meshes from .3ds files using lib3ds (http://code.google.com/p/lib3ds/). Do .3ds file carry some texture coordinate data or something?

peterh
  • 11,875
  • 18
  • 85
  • 108
user434565
  • 909
  • 1
  • 10
  • 21

2 Answers2

2

Here's a page showing an example of reading out the texture coordinates:

http://newsgroups.derkeiler.com/Archive/Comp/comp.graphics.api.opengl/2005-07/msg00168.html

However, not all 3ds files contain texture information - see warning in:

http://www.groupsrv.com/computers/about186619.html

No one in particular
  • 2,682
  • 2
  • 17
  • 20
1

If your models are much more complex than cubes, you use a UV map to translate the 3-dimensional surface of your model into a flat image for texture mapping.

Looks like this thread on gamedev has an example of how to extract what 3DS calls "texels" as well as materials.

Ben Jackson
  • 90,079
  • 9
  • 98
  • 150