PDA

View Full Version : Structure Problem

Leyder Dylan
10-16-2001, 08:19 AM
Hi,

I've this structure :

VECTOR 3D vPolygone[4];

My problem is that with this structure, I've only one polygone.

I would like to make another structure for calling
more that one polygone.

Ex :

Polygone[0].vPolygone[4]; // Polygone 1
Polygone[1].vPolygone[4]; // Polygone 2
Polygone[2].vPolygone[4]; // Polygone 3

etc ...

T2k
10-16-2001, 10:25 PM
there is only one problem before it will work like you shows it here: what is the syntax behind this :

VECTOR 3D vPolygone[4];

(structs/classes dont allow spaces in name)
you want to do something like(c++ style, non indexed arrays):

struct VECTOR3D{
float x,y,z/*,w*/;//i never use w for vectors
};

struct POLY{
VECTOR3D v1,v2,v3
};

//then using em as:
POLY polyarray[2<<31/*size http://www.opengl.org/discussion_boards/ubb/rolleyes.gif*/];
//accessing: polyarray[a].v1.x and so on
//or without poly:
VECTOR3D vectorarray[2<<31];
//accessing: vectorarray[a].x ...

or without structs/classes:
float vectorarray[2<<31][3];
//accessing via vectorarray[a][0 for x ...];

all this code dont let u define at runtime the ammount of data, for this you have to use pointers !

[This message has been edited by T2k (edited 10-17-2001).]

[This message has been edited by T2k (edited 10-17-2001).]

Leyder Dylan
10-17-2001, 07:11 AM
Hi,

It's OK, I've found.

struct Polygone
{
VECTOR3D vPolygone[4];
};

Polygone Pol[1];

Now, it's works.

688578