Using Arrays
I have declared a multi dimentional array to hold the vertacie data from an ASE file. The loader works but i have to declar the array that holds the vertacies to be of size 950 as i dion''t know the required size. I can store the size in a variable but not use this to change the length of the array because the array needs a constant. Please help
int numvertexes = 0;
Vertaices[numvertexes][3]
Because a value of a constant cannot be changed i have to use an integer but this causes an error. The value of numvertexes is read from the ASE file later. But i cannot use this value to change the size of the vertacie array!!!
Steve
in c++
typedef VERTEX float[3];
VERTEX *Vertaices;
Vertaices = new VERTEX[ any number ];
when youre finished use
delete []Vertaices;
http://members.xoom.com/myBollux
typedef VERTEX float[3];
VERTEX *Vertaices;
Vertaices = new VERTEX[ any number ];
when youre finished use
delete []Vertaices;
http://members.xoom.com/myBollux
Maybe linked lists will help solve your problem. Just look for articles here on gamedev!
Works fine thanks alot
only prob could U please explain the c++ syntax to me because i am not to hot in C++
only prob could U please explain the c++ syntax to me because i am not to hot in C++
February 22, 2001 04:09 PM
First he declared a variable typed called VERTEX consisting of three floating point numbers.
typedef VERTEX float[3];
Then he creates a pointer variable of type (VERTEX).
VERTEX *Vertaices;
Next he points the pointer to the first element in the array of vertices. The NEW keyword is used to grab memory from the heap. Delete free the memory back to your operating system when you are done.
Vertaices = new VERTEX[ any number ];
delete []Vertaices;
typedef VERTEX float[3];
Then he creates a pointer variable of type (VERTEX).
VERTEX *Vertaices;
Next he points the pointer to the first element in the array of vertices. The NEW keyword is used to grab memory from the heap. Delete free the memory back to your operating system when you are done.
Vertaices = new VERTEX[ any number ];
delete []Vertaices;
First he declared a variable typed called VERTEX consisting of three floating point numbers.
typedef VERTEX float[3];
Then he creates a pointer variable of type (VERTEX).
VERTEX *Vertaices;
Next he points the pointer to the first element in the array of vertices. The NEW keyword is used to grab memory from the heap. Delete free the memory back to your operating system when you are done.
Vertaices = new VERTEX[ any number ];
delete []Vertaices;
typedef VERTEX float[3];
Then he creates a pointer variable of type (VERTEX).
VERTEX *Vertaices;
Next he points the pointer to the first element in the array of vertices. The NEW keyword is used to grab memory from the heap. Delete free the memory back to your operating system when you are done.
Vertaices = new VERTEX[ any number ];
delete []Vertaices;
No signature files!!! =)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement