Results 1 to 4 of 4

Thread: dynamic arrays of Vertices?!?!?!

  1. #1

    dynamic arrays of Vertices?!?!?!

    I want to create a VertexBuffer with a Size which is defined at runtime, so I have to use a dynamic array of vertices! After filling my array of Vertices with the correct Data, I have to move it to the VertexBuffer.
    But when i render the Vertices, then I see that they are all wrong.
    So i think my way of moving a dynamic array of vertices to a vertexbuffer is wrong...
    Does someone know how to move it correctly

    I'm thankful for every answer...
    The 1.Rule of FightClub is: Don't talk about C++
    <br />*HATE*

  2. #2

    dynamic arrays of Vertices?!?!?!

    [pascal]type
    TMyVertices = packed record
    pos, norm: TD3DVector;
    end;
    TVerticesArray = array of TMyVertices;

    const
    MyFVF = (D3DFVF_XYZ or D3DFVF_NORMAL);

    function VertexBufferGenerator(Device: IDirect3DDevice9; const vertices: TVerticesArray): IDirect3DVertexBuffer9;
    var
    i: Integer;
    Data: Pointer;
    begin
    i:= High(vertices)*SizeOf(TMyVertices);
    Device.CreateVertexBuffer(i, D3DUSAGE_WRITEONLY, MyFVF, D3DPOOL_MANAGED, Result, nil);
    Result.Lock(0, 0, Data, D3DLOCK_NOSYSLOCK);
    try
    Move(vertices[0], Data^, i);
    finally
    Result.Unlock;
    end;
    end;[/pascal]
    There are only 10 types of people in this world; those who understand binary and those who don't.

  3. #3

    dynamic arrays of Vertices?!?!?!

    Hey Clootie,
    I don't know if I'm half asleep again(i've got insomnia the last days)
    so I didn't realized DX9 coming out , but I thought it wouldn't be out!
    So how do code with :
    Quote Originally Posted by Clootie
    [pascal]Device: IDirect3DDevice9;[/pascal]
    ??
    But thanks for your help I think I'm able to implement this dynamic vertex_array in my game,although i use a IDirect3DDevice8
    The 1.Rule of FightClub is: Don't talk about C++
    <br />*HATE*

  4. #4

    dynamic arrays of Vertices?!?!?!

    Device: IDirect3DDevice9;
    ??
    It's a joke, but DX9 is coming!
    There are only 10 types of people in this world; those who understand binary and those who don't.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •