What you're doiing is actually allocating the thing twice. Once
statically with the declaration
GLfloat vertexes[mTotVertexex][3]; //evaluates to static allocation
of vertexes[480000][3]
this memory (if you could allocate it statically) would not be used
by the rest of your program since you are reallocating it dynamically.
Remember: you can use a simple vector (1d) to store objects
(vertexes) with more than one coordinate.
To iterate through the vector and set/get axis coordinates
for(i=0;i<mTotVertexes;i+=3) {
x = vertexes[+0];
y = vertexes[i+1];
z = vertexes[i+2];
}
And finally (THIS IS REALLY IMPORTANT): Do not ever do this
vertexes[i] = (GLfloat*)calloc(3, sizeof(GLfloat));
don't ever iterate through an array and allocate memory for each
item. If you want to do this, you might as well use a linked list.
The whole purpose of using arrays/vbos is to get a continuous sector
in memory which can be easily copied back and forth with a single
memcpy. By dynamically allocating EACH vertex's coordinates, you're
incresing the probabilities of NOT having your data in a continuous
block. The end result is a delay between reads/writes of each vertex
while the gpu uses dma to search the address of the vertex before
copy ( i think).
Cheers,
Filipe
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Mac-opengl mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/mac-opengl/email@hidden