The Best Method ?

Hello !!!

What is the best method between to set a table of vertex ?

  1. With structure : class Vertex{
    GLfloat x,y,z;
    Vertex *pTab_Vertex;


  1. With a simple table :
    GLfloat *pTab_All_Vertex;


This is hardly an advanced question, and the answer is that OpenGL doesn’t care the slightest bit.

However, you might find your code easier to read if you have a vertex struct instead of just a bunch of floats.

GL doesn’t know or care.

However, it’s been my experience that some GL drivers perform better when each “stride” argument is a power of two (and ideally naturally aligned), so you might do well to pad your vertex struct with an unused float:

struct vert {
float x, y, z, _;

or put 4 byte of other data there:

struct vert {
float x, y, z;
short tu, tv;