Advertisement

Apply skin to model in OpenGL

Started by September 29, 2002 11:12 AM
5 comments, last by klems 22 years, 1 month ago
How do you apply a skin to a model in OpenGL? Perhaps this should be in the OpenGL forum, but I thought it was a pretty basic question so I posted it here instead.

Three shall be the number thou shall count, and the number of the counting shall be three...

A skin is basicly texture information for every polygon. When you render your model, you specify a texture, then for each vertex you also give a texture location.

So you would need to get the texture location information from your model file. Are you using models you created yourself, or are you importing a certain filetype?
Advertisement
I''m using Milkshape 3D to create models, but I guess I''ll come up with my own file format for the models, and convert from ms3d files.



Three shall be the number thou shall count, and the number of the counting shall be three...

(sorry, double-clicked the 'post' buttojn by mistake)

[edited by - Valderman on September 29, 2002 12:21:50 PM]
THen the texture information should allready be inside the format. You might want to look up on how to load it into memory.

As for using it: before you render a patch of vertices, look up the Texture ID in the model structure, and bind that texture ID in OpenGL. Then, when you render your vertices from the Model structure, you will notice you got (at least) 5 values: X, Y and Z for the vertex location, and (usually) U and T. U and T are texture coordinates, and can be set with... errr... gl_TexCoord2f(float, float) if I''m not mistaken.
OK, thanks. I''ll go read up on the MS3D format right away!
Advertisement
Loading milkshape models is surprisingly easy to do and contains all the info you need (I hacked together a basic loader in a couple of days last week) - look for the s and t values in the file spec, it saves texture coords as u, v and w values.

Note that it outputs a poly soup though, i''m planning on coverting to a custom format with tri strips saved instead when i get the time..

This topic is closed to new replies.

Advertisement