Quote Originally Posted by m_power_hax View Post
I tried sizeVertices*sizeof(GLfloat) and it worked (well it looks like it).

glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeVertices*sizeof(GLfloat)*2, 0, GL_STATIC_DRAW_ARB);
glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sizeVertices*sizeof(GLfloat), g_vertices); // copy vertices starting from 0 offest
glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, sizeVertices*sizeof(GLfloat), sizeVertices*sizeof(GLfloat), g_colors); // copy colours after normals
Yes, sizeVertices*sizeof(GLfloat) is exactly the size of the memory allocated with new statement.

didnt switch to vector since i don't know how they will work with Opengl.
std::vector has an internal array that could be passed to OpenGL:

Code:
// GLfloat *g_vertices=NULL;
std::vector<GLfloat> g_vertices;

...
		// g_vertices = new GLfloat [arraySize];
                                g_vertices.resize(arraySize, GLfloat(0.0)); // resize with initialisation
...
// glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sizeVertices*sizeof(GLfloat), g_vertices);   
glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, g_vertices.size()*sizeof(GLfloat),  &g_vertices[0]);
...