Adding vertices to buffer

Started by
2 comments, last by the incredible smoker 5 years, 10 months ago

Hi, i am using DirectX9 to make a game.

I am trying to combine the vertex buffers i have.

 

Is there some way possible that i can add vertices, and later some more vertices ?

Vertex*vertex = new Vertex[ size ];

then later i have the same code again.

Vertex*vertex = new Vertex[ size ];

Then finally i like to add all that to the vertexbuffer, how do i align all those vertices without the need to copy ?

thanks

 

 

S T O P C R I M E !

Visual Pro 2005 C++ DX9 Cubase VST 3.70 Working on : LevelContainer class & LevelEditor

Advertisement
On 6/15/2018 at 6:07 PM, the incredible smoker said:

I am trying to combine the vertex buffers i have.

The common way to do this is to make a new buffer, that is the size of both buffers, and the pass the content into the new buffer. Then when you are done, you delete the old buffer.

 

This is also how lists and other dynamic data structures work.

Thanks for the reply`s.

I like to avoid copying, its one way that will work, only a bit slower for loading.

Calculating in advance the buffer size looks like the best way, only it is not so flexible when making games.

Storing all creation settings while counting the buffersize would also be not the best method.

 

At what point does it become useless ?

in the render function you have to type ( offset + frame ); so the offset + is extra.

When rendering 100 objects it has to calculate offset + a 100 times, it will become slower then occasional vertexbuffer swap.

I,m not sure about all this, i have to get some GPU analizer software.

S T O P C R I M E !

Visual Pro 2005 C++ DX9 Cubase VST 3.70 Working on : LevelContainer class & LevelEditor

This topic is closed to new replies.

Advertisement