# Whatis your typical Vertex Range?

This topic is 4118 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, Im currently coding a game engine and i've come to Object code.. Anyway becase Devcpp can't handle unlimited arrays ( The Memory runs into eachother (with big arrays) and causes the exe to crash ) i have had to set a Vertex Limit for each object. Im Not rrly sure what i should set the limit to be.... What would you say is the suggested Maximum Vertex Number? Its Really annoying That i have to set a limit, because this means the objects are runnign inneficiently because it uses the memory space no matter what :( anyone know how to get around this in Devcpp then that would be even better !! oh and finaly does anyone know any (or where to see these )algorthms to load in common 3D files like .x etc... (into opengl) im not really sure as to the structure of these files. My Code is working,but i have to define the Vertex.. and a game engine where you can't laod in a 3d file would be a bit boring :P Thanks, BEN

##### Share on other sites
so how big are these arrays that crash devc++?
if the elements are more than a 10 bytes you may want to create a array of pointers to elements.
Im not entirely sure what your asking in the rest of your question, mabey if you could provide some more detail.

##### Share on other sites
basicaly i have a class for vertex's
each vertex contains x,y,z co-ordinates

the object class coinaints vertec so ist a bit like

class OBject
{
public:
vertex[];
};

when i do that itusualy crashes if i load with vertex > than say 20. However if i do :

class OBject
{
public:
vertex[0xFFF];
};

then i can have ip to 0xFFF vertex and it wont crash.. but as you can see its inneficient, because the ememory is wasted really....

and i meant like opening the file and knowing where the different stuff is stored like Vertex data in each file etc... so i can load this into OpenGl with glvertex() etc..
-BEN

##### Share on other sites
in c++ arrays arnt automatically created unless you specify a starting size or resized, if you write to a uninitialized array you just writing to a random point in memory
this dosent seem to be correct c++ syntax so its still hard to understand, i also dont understand why your using hex in it

// a 20 element array
int a[20];

//a uninitialized array
int b[];
//same
int *b;

//this write to a random point in memeory and will crash your app
b[5]=45;

//so does this
a[25]=5555;

//this is fine
a[14]=4;

//this is how you do it
//create 60 element array
b= new int[60];
//now this is ok
b[59]=56;

//hex gets treated as a normal number
//4095 long array
int d[0xFFF];

##### Share on other sites
I used hex because writing 0xFFFF was easier than writing 65535 lol.
Yeah i know thats why i have used a massive array meaning thatonly 65535 vertexs can be lioaded. What i meant is, i was alking to my teacher about this and he sed theres a godo way to egtaround it, but he couldnt remember how to do it. He sed it was like destroyign and recreating the array each time or something liek that . Not Much help really :P.

-BEN

##### Share on other sites
He was probably talking about dynamically creating arrays, which is what Kaze was demostrating in the last portion of his code.

Basically, you get a pointer to whatever datatype you want:
int arraySize = 1000;int * someArray = NULL;

Then you set it to a block of memory using the new operator
someArray = new int[arraySize];

Now you can use the variable someArray just like you would any array, but you didn't have to hard code in the size.
Destroying the array is as simple as calling delete on the pointer.
delete someArray;

EDIT:: How do you use the quote tags? =/

##### Share on other sites
thanks.

Hmmm hwo would i use that with the classes though??
say i have these classes

class Vertex
{
public:
float x,y,z;
}

class OB
{
public:
Vertex Vertex[0xFF]
}

because the way he said it worked, is that when the end of the array si reached it destroys the array and recreates it with +1 size.

Thanks,
BEN

ps Don't Know :p

##### Share on other sites
I also use Devc++, and asked a similar question years ago to get no responce. I dynamically allocate, and get the same problem.

##### Share on other sites
yeah its a bit of a bitch, im not too btohered really im sure ill find a solution to the problem eventually but for now i just want to know what si the typuical range of vertex in models... but no one has answered that 1 yet :P although i would be happy to knwo how to do the destrucion and restruction of arrays though :P but mainly i justwanna know what a goo maximum value is

##### Share on other sites
Quote:
 Original post by BENOJyeah its a bit of a bitch, im not too btohered really im sure ill find a solution to the problem eventually but for now i just want to know what si the typuical range of vertex in models... but no one has answered that 1 yet :P although i would be happy to knwo how to do the destrucion and restruction of arrays though :P but mainly i justwanna know what a goo maximum value is

just a hint, spell check and proof reading might give you more relevant replies

1. 1
2. 2
Rutin
19
3. 3
4. 4
5. 5

• 15
• 13
• 9
• 12
• 10
• ### Forum Statistics

• Total Topics
631442
• Total Posts
3000089
×