Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Vertex
- {
- public:
- Vertex(void);
- ~Vertex(void);
- GLfloat x;
- GLfloat y;
- GLfloat z;
- GLfloat r;
- GLfloat g;
- GLfloat b;
- GLfloat nx;
- GLfloat ny;
- GLfloat nz;
- Vertex getCoords();
- Vertex crossProd(Vertex& b);
- void normalize();
- Vertex operator-(Vertex& b);
- Vertex& operator+=(const Vertex& b);
- bool operator==(const Vertex& b) const;
- };
- glGenBuffers(2, buffers);
- glBindBuffer(GL_ARRAY_BUFFER, buffers[0]);
- glBufferData(GL_ARRAY_BUFFER, fVertices.size()*sizeof(Vertex), &(fVertices[0].x), GL_STATIC_DRAW);
- glVertexPointer(3, GL_UNSIGNED_BYTE, sizeof(Vertex), BUFFER_OFFSET(0));
- glColorPointer(3, GL_FLOAT, sizeof(Vertex), BUFFER_OFFSET(6*sizeof(GL_FLOAT)));
- glNormalPointer( GL_FLOAT, sizeof(Vertex), BUFFER_OFFSET(3*sizeof(GL_FLOAT)));
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffers[2]);
- glBufferData(GL_ELEMENT_ARRAY_BUFFER, fIndices.size()*sizeof(GLushort), &fIndices[0], GL_STATIC_DRAW);
- glIndexPointer(GL_UNSIGNED_SHORT, 0, BUFFER_OFFSET(0));
- GLfloat *test = &(fVertices[0]).x;
- GLfloat *test2 = &(fVertices[0]).y;
- test + sizeof(GLfloat) != test2;
- test + sizeof(GLfloat) != test2;
- T *p = ...;
- &p[1] == p + 1;
Add Comment
Please, Sign In to add comment