Too many verts in Volatile Vertex buffer
by James Laker (BurNinG) · in Torque Game Engine · 05/14/2008 (2:01 am) · 2 replies
Generating stars in TGEA (v1.0.2) I used to have the following piece of rendering code:
Now in TGEA v1.7.0 using that same code I run into the following error:
When looking at the code it's because MAX_DYNAMIC_VERTS are defined as
16000 is just not going to cut it for me. Without increasing MAX_DYNAMIC_VERTS, my guess would be to use a Static Vertexbuffer - Am I right?
Looking at terrain/sky.h and terrain/sky.cpp I see this:
And in void Sky::loadVBPoints() I can see the VB points being loaded. But I can seem to find where and how it gets rendered.
Can someone please explain or help me out here?
PrimBuild::begin(GFXPointList, NumVertices);
for (int n = 0; n <= NumVertices; n++)
{
PrimBuild::color4f(StarCol[n].red, StarCol[n].green, StarCol[n].blue, StarCol[n].alpha);
PrimBuild::vertex3f(Stars[n].x, Stars[n].y, Stars[n].z);
}
PrimBuild::end();Now in TGEA v1.7.0 using that same code I run into the following error:
Cannot allocate that many verts in a volatile vertex buffer
When looking at the code it's because MAX_DYNAMIC_VERTS are defined as
#define MAX_DYNAMIC_VERTS (8192*2)
16000 is just not going to cut it for me. Without increasing MAX_DYNAMIC_VERTS, my guess would be to use a Static Vertexbuffer - Am I right?
Looking at terrain/sky.h and terrain/sky.cpp I see this:
GFXVertexBufferHandle<GFXVertexPCT> mSkyVB;
And in void Sky::loadVBPoints() I can see the VB points being loaded. But I can seem to find where and how it gets rendered.
Can someone please explain or help me out here?
#2
05/14/2008 (7:00 am)
I thought about that... But thats pretty much the same as increasing MAX_DYNAMIC_VERTS then, you're just coding around that :-P In the comments there it says its pretty expensive. I dunno how expensive, but I would rather like to know what the correct way is... and how to use the Vertex Buffer properly.
Associate Jeff Faust
Faust Logic, Inc.