dabeav
07-24-2002, 09:35 AM
Ok here is my issue.
I am working on a way to load my models from a .txt file into my program to render them. The problem is, I dont know how many models there will be, nor do i know how many verts apiece they will be when they are finished.
I would like to create a "for" loop to load my models into arrays, to be used by opengl to render with draw elements. Now obviously i can dynamicaly allocate arrays with the
int *Array = new int[NumberOfVerts]; Where the number of verts is the first thing read from the .txt file. So the not knowing how many verts to put into the array is solved. The problem is creating an unknown number of arrays themselves.
I would really like a way to dynamicaly create array names for the number of arrays needed. Something like this (obviously this dosnt work, or i would use it instead)....
for(int x=0; x<NumberOfArrays; x++)
{
int *Array(x) = new int[NumVerts];
}
so if x=4; i would wind up with
Array0;
Array1;
Array2;
Array3;
Anyone have ANY idea how one would so something like this. I have used sprintf before to do something similar with strings, but I dont think it will work with variables.........Thank you so much in advance.
I am working on a way to load my models from a .txt file into my program to render them. The problem is, I dont know how many models there will be, nor do i know how many verts apiece they will be when they are finished.
I would like to create a "for" loop to load my models into arrays, to be used by opengl to render with draw elements. Now obviously i can dynamicaly allocate arrays with the
int *Array = new int[NumberOfVerts]; Where the number of verts is the first thing read from the .txt file. So the not knowing how many verts to put into the array is solved. The problem is creating an unknown number of arrays themselves.
I would really like a way to dynamicaly create array names for the number of arrays needed. Something like this (obviously this dosnt work, or i would use it instead)....
for(int x=0; x<NumberOfArrays; x++)
{
int *Array(x) = new int[NumVerts];
}
so if x=4; i would wind up with
Array0;
Array1;
Array2;
Array3;
Anyone have ANY idea how one would so something like this. I have used sprintf before to do something similar with strings, but I dont think it will work with variables.........Thank you so much in advance.