Problemas em C ++ / OpenGL VAO

#define GLEW_STATIC
#include <GL\glew.h>
#include <GLFW\glfw3.h>
#include <GL\glew.h>
#include <glm.hpp>
#include <iostream>
#include <fstream>
#include <string>

#define WIDTH 800
#define HEIGHT 600
#define TITLE "Dynamic"

GLFWwindow* window;
int vaoID;

float vertices[] = {-0.5f, 0.5f, 0, -0.5f, -0.5f, 0,    0.5f, 0.5f, 0,  0.5f, 0.5f, 0,  -0.5f, -0.5f,   0,  0.5f, -0.5f, 0};

void loadToVAO(float vertices[]);

void update() {
    loadToVAO(vertices);
    while (!glfwWindowShouldClose(window)) {
        glfwPollEvents();
        glClear(GL_COLOR_BUFFER_BIT);
        glClearColor(1, 0, 0, 1);
        glDrawArrays(GL_TRIANGLES, 0, 6);
        glfwSwapBuffers(window);
    }
}

int main() {
    if (!glfwInit())
        std::cout << "Couldn't initialize GLFW!" << std::endl;

    window = glfwCreateWindow(WIDTH, HEIGHT, TITLE, NULL, NULL);
    glfwMakeContextCurrent(window);
    glfwSwapInterval(1);

    if (GLEW_OK != glewInit())
        std::cout << "GLEW fucked up!" << std::endl;

    std::cout << "Your GL version: " << glGetString(GL_VERSION) << std::endl;
    glEnable(GL_CULL_FACE);
    glCullFace(GL_BACK);
    update();
}



void loadShaders() {

}

void loadToVAO(float vertices[]) {
    GLuint vboID;
    GLuint vaoID;
    glGenBuffers(1, &vboID);
    glBindBuffer(GL_ARRAY_BUFFER, vboID);
    glBufferData(GL_ARRAY_BUFFER, sizeof(vertices) * 8, vertices, GL_STATIC_DRAW);
    glGenVertexArrays(1, &vaoID);
    glBindVertexArray(vaoID);
    std::cout << vaoID << std::endl;
    glVertexAttribPointer(0, 3, GL_FLOAT, false, 0, 0);
    glEnableVertexAttribArray(0);
}

Este é o meu código para criar e renderizar um VAO que contém um VBO com as posições de vértice. Mas, infelizmente, não funciona. Desenha um triângulo em vez de um quad. Mas quando coloco o código da função loadToVAO na função update antes do loop while, ele funciona.

questionAnswers(1)

yourAnswerToTheQuestion