Excessive?

Started by
7 comments, last by D_JildQuantum 20 years, 8 months ago
Just trying to render a scene of 4 pyramids, and i can get it to work, but isnt it a little excessive to have a vertex buffer for every object in the scene? is there some way i can put multiple objects in one vertex buffer? any tutorials that tell me how? Im willing to put in hard work to achieve "Almost" proffesional work... Thank you... p.s.: was gamedev down earlier? Quantum
Quantum
Advertisement
Is everyone just sick of me?!? should i just leave and never show my face again?

Quantum
Quantum
Impacient, aren''t we? Due to the fact of gamedev being down people figured it would be down for a while and didn''t bother checking back.

Anyway, yes, having a vertex buffer for every object is ''excessive'' (its inefficient). How you actually batch objects together into one vertex buffer is up to you though.
Sorry about being impatient... Do you have any suggestions?

Quantum
Quantum
You can easily put different objects into the same vertex buffer. Especially with static objects where you dont have to lock the buffer every frame if you put them into the same buffer then when rendering static objects if batched correctly you only have on vertex buffer switch for all the static objects. Although depending on how many static objects you have, you might want to

To do this all you would have to do is create a buffer big enough, then lock it and just fill it with objects end to end.

Of course you would need to store an object''s starting index in the buffer, render method, and how many vertexs it has outside the buffer in per object.

// Full Sail graduate with a passion for games// This post in no way indicates my being awake when writing it
My problem is, how do i write them end to end? something like this:
BYTE* pVerticeLock=0;		g_hr=g_pQuantumVertexBuffer->Lock(0, sizeof(CQVQuad), &pVerticeLock, 0);		if(FAILED(g_hr))			return false;		//Quad		CopyMemory(pVerticeLock, &CQVQuad, sizeof(CQVQuad));		//Triangle		CopyMemory(pVerticeLock, &CQVTriangle, sizeof(CQVTriangle));		//Terrain		CopyMemory(pVerticeLock, &CQVTerrain, sizeof(CQVTerrain));		//SkyBoxEast		CopyMemory(pVerticeLock, &CQVSkyBoxEast, sizeof(CQVSkyBoxEast));

wont work, because it keeps over riding it...

Quantum
Quantum
...umm Im going to help explain this but afterwards I suggest you do some homework on pointers and pointer math.

//Quad
CopyMemory(pVerticeLock, &CQVQuad, sizeof(CQVQuad));
pVerticeLock+=sizeof(CQVQuad);

//Triangle
CopyMemory(pVerticeLock, &CQVTriangle, sizeof(CQVTriangle));
pVerticeLock+=sizeof(CQVTriangle);

//Terrain
CopyMemory(pVerticeLock, &CQVTerrain, sizeof(CQVTerrain));
pVerticeLock+=sizeof(CQVTerrain);

//SkyBoxEast
CopyMemory(pVerticeLock, &CQVSkyBoxEast, sizeof(CQVSkyBoxEast));
// Full Sail graduate with a passion for games// This post in no way indicates my being awake when writing it
Oh ok. Sorry, i have had to teach myself online, and i have missed probably alot of concepts -.-

Quantum
Quantum
Thats fine, I taught myself vb and I know what its like to try to teach yourself something. Just pointers are very vital to a lot of game programming so I thought Id try and point you in the right direction... as apposed to your general thought of what people here think of you, most of us dont mind helping but sometimes people just seem to get over their head before they fully cover the basics.
// Full Sail graduate with a passion for games// This post in no way indicates my being awake when writing it

This topic is closed to new replies.

Advertisement