[Solved] Why can I have an OpenGL shader class, but not a VAO class?


The problem has nothing to do with the VAO, but with the VBO. Since you pass a pointer to the constructor:

void GSMesh::build(GLfloat *arrFVertex, GSShader *shader, int _intNumVertex)
{
    glBufferData(GL_ARRAY_BUFFER, sizeof(arrFVertex), arrFVertex, GL_STATIC_DRAW);
}

sizeof(arrFVertex) = sizeof(GLfloat*) which is the size of the pointer, not the size of the array pointed to. The correct code will look like this:

glBufferData(GL_ARRAY_BUFFER,
             sizeof(GLfloat) * _intNumVertex * 3, arrFVertex,
             GL_STATIC_DRAW);

In general I have to add, that this is not the way how questions should be asked on SO. It would have been good if you would have included at least the relevant parts of the code in your question.

2

solved Why can I have an OpenGL shader class, but not a VAO class?