Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

programering

GL_float vertex struct (buffer)

This topic is 5362 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Why not for a GL_float vertex buffer create a struct, like this: struct vertex { GL_float x; GL_float y; GL_float z; }; struct vertex *buffer; // buffer[12]; GL_float *get_vertex(short index) { struct vertex *temp = buffer + index; return &temp->x; } Instead of: GL_float vertex1[3] = {5,3,9}; GL_float vertex2[3] = {8,1,4}; GL_float vertex3[3] = {6,2,7}; Or I suppose I could do: GL_float vertex_buffer[12][3]; // 12 being the number of vertex for example GL_float *vertex_buffer[3]; // wouldn''t be right Or just a simple GL_float *pointer to the vertex position buffer: GL_float *vertex_buffer; GL_float *get_vertex(short index) { return vertex_buffer[index*3]; // return vertex_buffer + index*3; } One will have to pass a GL_float *pointer that points at 3 x, y and z GL_float vertex positions, am I right? What do you guys think about this? What do you prefer to use? ------------------------------- Anton Karlsson Klingis Entertainment Games with silly humor Aleph One (Marathon Open Source) | My Homepage Packa bajs med winzip! Just dreaming wont make you (more) skilled in game programming/development.

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!