I have a pretty nasty problem in my terrainengine.
It calculates the whole terrain on the start and then splits it up into chunks.
This is working fine, but only if I dont create more then around 60 chunks.
Each chunk has 256*256 vertices each and 255*255*6 indices.
As soon as i try to create more, i get a "std::bad_alloc" error. After a little research I found that its probably me, requesting to much memory.
Building the vertex/index array is done like the following:
[source lang="cpp"]VertexPosNormalTexColor *vertices;unsigned long* indices;vertices = new VertexPosNormalTexColor[chunkVnum];indices = new unsigned long[chunkInum];[/source]
I think that I have to release the memory, after creating the Vertex/Indexlist, right? (howto? just "delete vertices;" ?)
But I still need this lists to draw them (dont I?), to make things follow the terrain, and I would like to do some dynamic terraindeformstuff later.
How to solve this?
Thanks a lot, just request if you need to see some more of the code or something
Edited by gnomgrol, 21 June 2012 - 04:21 AM.