Hi all;
I was just wondering if there was a way to submit your vertices and polys to OGL if they’re held in something other than an array of type GLfloat?
So normally you would do something like this;
Code: Select all
typedef struct {
GLfloat x;
GLfloat y;
GLfloat z;
} Vertex3D;
And then create an array of these however long you need,
Code: Select all
Vertex3D[] vertices = new Vertex3D[6];
Populate it with your point data and then submit this to ogl like so;
Code: Select all
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, vertices);
In this way of submission the vertices array appears in memory as an array of 36 GLfloats, which is why you can get away with doing it this way. But what would happen if I made Vertex3D into a class instead of a typedef, so that I could reuse that class for vectors and would therefore have methods like normalise on the class itself. Is there a way to submit to ogl with the data held this way, so that the vertex/vector class has x y and z properties on it?
Please can we avoid the obligatory “why do you want to do that” questions.