Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


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

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

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

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

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

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