Jump to content

View more

Image of the Day

Boxes as reward for our ranking mode. ヾ(☆▽☆)
#indiedev #gamedev #gameart #screenshotsaturday https://t.co/ALF1InmM7K
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

One way list into glVertexPointer

4: Adsense

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   

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



#2 RobTheBloke   Members   

2552
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   

1405
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   

10275
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   Members   

2552
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.