One way list into glVertexPointer

Started by
3 comments, last by RobTheBloke 11 years, 3 months ago

struct VertexDynArrayElement {
public:
t3dpoint p;
t3dpoint c;
float 	 a;
textpoint uv;

double VERTEX_R;
double VERTEX_G;
double VERTEX_B;



int VERTEX_Cr;
int VERTEX_Cg;
int VERTEX_Cb;

VertexDynArrayElement * next;
VertexDynArrayElement * prev;
bool blank;
VertexDynArrayElement() {
 prev = NULL;
 next = NULL;
 blank = true;
					 	}
};

i want to put this into glvertexpointer or is it any other way to speed up rendering instead of using glbegin glend.

Cheers :}

Advertisement

VertexDynArrayElement* data = getSomePtr();

glVertexPointer( 3, GL_FLOAT, sizeof(VertexDynArrayElement), &data->p );

You might want to investigate glVertexAttribPointer instead though....

well i do not understand how &data->p will tell glVertexPointer that next array element is in the 'next' variable

can you tell me more thing about how to use glVertexAttribPointer in this case? thank you

OpenGL can only use attributes stored linearly in memory and cannot read non-linear data structures.

Ahh, missed that bit! It won't. It's glBegin/glEnd for you....

linked lists do not make good data structures for OpenGL/D3D. You only really have the choice of:

Arrays,

Arrays,

or Arrays.

This topic is closed to new replies.

Advertisement