Sign in to follow this  
Followers 0
WiredCat

One way list into glVertexPointer

4 posts in this topic

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 :}

0

Share this post


Link to post
Share on other sites

VertexDynArrayElement* data = getSomePtr();

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

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

0

Share this post


Link to post
Share on other sites

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

0

Share this post


Link to post
Share on other sites

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

1

Share this post


Link to post
Share on other sites

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.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0