Vertex buffer triangle
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -9,10 +9,9 @@ int main(void){
|
||||
return -1;
|
||||
}
|
||||
|
||||
//Main window
|
||||
//Main window creation
|
||||
GLFWwindow* window;
|
||||
|
||||
//Window creation
|
||||
window = glfwCreateWindow(640, 480, "OpenGl practice", NULL, NULL);
|
||||
if (!window){
|
||||
std::cout << "Window could not be created!" << std::endl;
|
||||
@@ -43,6 +42,11 @@ int main(void){
|
||||
glBindBuffer(GL_ARRAY_BUFFER, buffer); //binding the buffer
|
||||
glBufferData(GL_ARRAY_BUFFER, 6 * sizeof(float), positions, GL_STATIC_DRAW);
|
||||
|
||||
glEnableVertexAttribArray(0);
|
||||
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 2, 0);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0); //unbinding the buffer
|
||||
|
||||
//Main loop
|
||||
while (!glfwWindowShouldClose(window)){
|
||||
/* Render here */
|
||||
|
||||
Reference in New Issue
Block a user