Three shall be the number thou shall count, and the number of the counting shall be three...
Apply skin to model in OpenGL
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.
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?
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?
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]
[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.
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.
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..
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..
[size="1"][[size="1"]TriangularPixels.com[size="1"]] [[size="1"]Rescue Squad[size="1"]] [[size="1"]Snowman Village[size="1"]] [[size="1"]Growth Spurt[size="1"]]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement