Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Teknofreek

CreateVertexBuffer question

This topic is 5811 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Let's say I have something like this:
    
struct MyVertex
{
    float x, y, z;
    D3DXCOLOR diffuse;
    float u, v;
}

// Init D3D and all that jazz


nVerts       = 1000;
MyVertex*  pMyModel;
pMyModel   = new MyVertex[ nVerts ];

// Assign something to pMyModel


    
Can I then create my vertex buffer by saying something like this: pD3DDevice->CreateVertexBuffer( sizeof(pMyModel), ... ); All of the books, tutorials, etc seem to define the size of the buffer more like this: pD3DDevice->CreateVertexBuffer( sizeof(MyVertex) * nVerts, ... ); Is that just to spell out what you need to give it, or is there some potential difference in the two? -John [edited by - Teknofreek on August 18, 2002 4:16:18 PM]

Share this post


Link to post
Share on other sites
Advertisement
sizeof(pMyModel) will return 4, so your vertex buffer will be a total of 4 bytes long. you need to do it the other way.

fragmo

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!