Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


One way list into glVertexPointer


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 WiredCat   Members   -  Reputation: 367

Like
0Likes
Like

Posted 24 January 2013 - 11:03 AM

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



Sponsor:

#2 RobTheBloke   Crossbones+   -  Reputation: 2349

Like
0Likes
Like

Posted 24 January 2013 - 11:16 AM

VertexDynArrayElement* data = getSomePtr();

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

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



#3 WiredCat   Members   -  Reputation: 367

Like
0Likes
Like

Posted 24 January 2013 - 11:36 AM

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



#4 Brother Bob   Moderators   -  Reputation: 8454

Like
1Likes
Like

Posted 24 January 2013 - 11:47 AM

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



#5 RobTheBloke   Crossbones+   -  Reputation: 2349

Like
0Likes
Like

Posted 24 January 2013 - 11:49 AM

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.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS