#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2004
    Posts
    258
    Rep Power
    55

    GlTexCoordPointer()


    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:

    float m_s[2]
    float m_t[2]

    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:

    m_s[0],m_t[0],m_s[1],m_t[1],m_s[2],m_t[2]

    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.

    Code:
            mov      dword[Counter],0
              TransferTriangleTex:
                       mov      eax,dword[Counter]
                       mov      ecx,70
                       mul      ecx
                       add      eax,44
                       mov      ebx,eax
                       add      ebx,dword[SourceFilePointer]
                       add      ebx,dword[SourceFileBuffer]
                       mov      eax,dword[DestinationFileBuffer]
                       add      eax,dword[DestinationFilePointer]  ;eax= dest, ebx= src
    
                       mov      ecx,dword[ebx]      ;s
                       mov      dword[eax],ecx
    
                       mov      ecx,dword[ebx+12]
                       mov      dword[eax+4],ecx     ;t
    
                       mov      ecx,dword[ebx+4]     ;s
                       mov      dword[eax+8],ecx
    
                       mov      ecx,dword[ebx+16]     ;t
                       mov      dword[eax+12],ecx
    
                       mov      ecx,dword[ebx+8]     ;s
                       mov      dword[eax+16],ecx
    
                       mov      ecx,dword[ebx+20]     ;t
                       mov      dword[eax+20],ecx
    
                       add      dword[DestinationFilePointer],24
              inc      dword[Counter]
              mov      eax,dword[Count]
              cmp      dword[Counter],eax
              jne      TransferTriangleTex
    Last edited by calpol2004; October 21st, 2008 at 09:27 AM.
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2008
    Posts
    1
    Rep Power
    0
    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.

IMN logo majestic logo threadwatch logo seochat tools logo