October 21st, 2008, 09:18 AM
when you point this to your texture coordinates, what format does it expect them to be in? This is assuming im drawing with GL_TRIANGLES have set the stride to 0 and there are 2 elements to it.
Ive always thought it to be : x,y,x,y,x,y,x,y.... with the first 3 "x,y"'s being the first triangle and the second 3 the next.
Is this correct?
Im currently building a ms3d loader, and the file format stores its coordinates like this:
in the triangle array. Now im assuming that the s is x and t is y coordinates. this means if i want to use them in a vertex array i need to process them like this:
But it doesnt appear to be working. I dont know how many can read assembly but heres an extract from my parser ive built:
DestinationFilePointer = offset destfilebuffer to where im currently saving, this is correct, i have checked it manually with a calculator and a hex editor.
DestinationFileBuffer = Pointer to buffer which i later save to a file.
SourceFileBuffer = pointer to loaded ms3d file.
SourceFilePointer = offset from sourcefilebuffer to start of texcoords in source file. Currently pointedto start of triangle structure.
add eax,dword[DestinationFilePointer] ;eax= dest, ebx= src
mov ecx,dword[ebx] ;s
mov dword[eax+4],ecx ;t
mov ecx,dword[ebx+4] ;s
mov ecx,dword[ebx+16] ;t
mov ecx,dword[ebx+8] ;s
mov ecx,dword[ebx+20] ;t
Last edited by calpol2004; October 21st, 2008 at 09:27 AM.
December 21st, 2008, 11:56 AM
That is the right format. It would've been more helpful to post your code than this assembly, so we could see if you're calling it right. I'll take a wild guess and assume that your arrays aren't specified properly. Remember that the arrays have to have the same number of elements. There is a one to one correspondence between the array elements. So, for a cube, instead of just 8 vertices, you have 24 (6 sides * 4 vertices). Each vertex occurs 3 times in the vertex array because it is shared by 3 sides.