Jump to content
  • Advertisement
Sign in to follow this  
CodaKiller

Why can't I create this vertex buffer?

This topic is 3591 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

I need to create a buffer that I can map for reading and writing but it won't let me create it like this:
		// Create the Vertex buffer.
		D3D10_BUFFER_DESC Buffer_Desc;
		D3D10_SUBRESOURCE_DATA InitData;
		Buffer_Desc.Usage = 0;//What should go here?
		Buffer_Desc.ByteWidth = sizeof( E_VERTEX ) * num[0];
		Buffer_Desc.BindFlags = D3D10_BIND_VERTEX_BUFFER;
		Buffer_Desc.CPUAccessFlags = D3D10_CPU_ACCESS_READ | D3D10_CPU_ACCESS_WRITE;
		Buffer_Desc.MiscFlags = 0;
		InitData.pSysMem = vertices;
		g_d3dDevice->CreateBuffer( &Buffer_Desc, &InitData, &VertexBuffer );



What am I doing wrong? Also does creating a vertex buffer that can be mapped make it run any slower when it's not being mapped? [Edited by - CodaKiller on December 21, 2008 2:04:19 AM]

Share this post


Link to post
Share on other sites
Advertisement
Seems like I can't read from a vertex buffer like that so I have a better fix for this, I'm going to save a copy of the data in memory, I'll have a UpdateBuffers command in my mesh class that updates them to the copies in memory and releases the old ones.

Share this post


Link to post
Share on other sites
A Staging Buffer cannot be bound as a Vertex Buffer.

Try passing the DEBUG flag to CreateDevice, and looking at the output window in VS. You should be getting a detailed error message with why the method call failed.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!