wrong texture coords on md2

i have loaded an md2 file, but when i texture it, the texture doest fit at all to the model, i converted the model skin from pcx to bmp, but i havnt changed the size.
any ideas?

Are you using the raw texture coordinates from the file or normalized texture coordinates? Also, I know most md2 skins are of dimensions that are not powers of 2. So that may be the problem if you are not using gluBuild2DMipmaps or your own image resizing code.

[This message has been edited by DFrey (edited 12-19-2000).]

scale the coords to fit in the range 0-1

texcoord.u = u datafrom file/ skin width
texcoord.v = v datafrom file/ skin height

Something else to watch out for is that BMP
and TGA are typically upside-down, wheras
PCX may or may not be stored right-side-up.

so it might be
texcoord.u = 1 - u datafrom file/ skin width

or

texcoord.v = 1 - v datafrom file/ skin height

im afaraid its not working.
i already normalized the texturecoords, and i have tried turning the pic upside down, but it doesnt work. he model works in the nvidia bump-mapping demo, it is the drfreak model, so it should work for me too, doesnt it? any ideas?

1- What is you card?
2- Do you send your vertex in 3d obect space? or you are doing your transformation by yourself and send 2d coor?

Floyd

Again, are you certain that the texture dimensions are powers of 2? You did not say they were. Note: this is not important if you are using gluBuild2DMipmaps (since it automatically resizes to powers of 2).

i have a geforce, trans are done by opengl, im using mipmaps.
btw- floyd, is this name refers to the legendery pink floyd?

yes, it refers to that music! :slight_smile:

For you question, I dont know. I got problem with texture coor but it was with 2d poly.

Floyd

Has texture matrix been altered any? How about a screen shot, of the texture and of the texture applied to the model? Might give some of us a better clue.

floyd, im a fanatic admierer of the pink floyd, good name.
i dont know how to put pictures in the post, but the texture matrix doesnt altered.

I don’t know if you have solved your problem or not, but you might want to take a look at this site : http://www.jawed.com/jawmd2/ There is source code there for an MD2 viewer, maybe you could compare your code to it and see if you have done something wrong.

Nate Miller http://nate.scuzzy.net

well, i looked at the code, the only diffrence i see, is that i use bmp and pcx, but i didnt resize the texture, andi use mip-mapping, and i tried the 1- trick.

once again, problem solved, a simple code bug. .