glVertexPointer Problem

Posts: 23
Joined: 2007.12
Post: #1
I am trying to create a Structured Object to hold the info for the pointer but can't seem to get it to work right here is the structure

struct vec3D { GLfloat x,y,z; }; typedef struct vec3D the3DVector;
struct triAngle { the3DVector point[3]; GLint type; }theObj[Array Number];

When I take out ( GLint type ) it works but when i try to use it it doesn't work am i missing something or can this type of struture not work?
Posts: 5,143
Joined: 2002.04
Post: #2
that structure can't work because there's not the same distance between each vertex.
Posts: 23
Joined: 2007.12
Post: #3
I was hoping I was wrong about that because I only wanted to point to the Points of the object an not the Points & type (i.e obj[0]->point,obj[1]->point an so on)
is there any way I can create a Obj that has 3Points An a Data Type?
Posts: 469
Joined: 2002.10
Post: #4
You can stick the type in a union within the struct. This way, as long as your vector size is wider, you can skip that part of the struct by drawing indices instead. However, it's a big fat waste of gpu memory and you're better off tightly packing your verts anyway.

I recommend just keeping a pointer to the offset of your vertex data in your triangle or object struct.

15.4" MacBook Pro revA
Posts: 23
Joined: 2007.12
Post: #5
Thanks for the Tips & advice but fortunately I have found a new & Better way to create a object with a data type thanks for the help
Thread Closed 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  VBO + glVertexPointer + NSMutableArray... brush 7 7,961 Jun 15, 2008 01:45 AM
Last Post: mcMike