I am trying to load a VAO in OpenGL, but when running it doesn't draw. When I use the code in my function directly into my main loop it runs fine but whenever I try to load the VAO via my function it doesn't work. I already narrowed it down to something going wrong when passing the values to the function, because when I directly use the float array it does work. I have the values defined as a static float array in my main function, and I'm loading it like this:
GLuint RenderLoader::load(float vertices[])
{
GLuint VertexArrayID;
glGenVertexArrays(1, &VertexArrayID);
glBindVertexArray(VertexArrayID);
GLuint vertexbuffer;
glGenBuffers(1, &vertexbuffer);
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);
return VertexArrayID;
}