Changeset 516668e in opengl-game


Ignore:
Timestamp:
Jul 19, 2017, 4:08:45 AM (8 years ago)
Author:
Dmitry Portnoy <dmp1488@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
644a2e4
Parents:
5272b6b
Message:

WIP for drawing a triangle

File:
1 edited

Legend:

Unmodified
Added
Removed
  • new-game.cpp

    r5272b6b r516668e  
    3131   glEnable(GL_DEPTH_TEST);
    3232   glDepthFunc(GL_LESS);
     33
     34   GLfloat points[] = {
     35      0.0f,  0.5f,  0.0f,
     36      0.5f, -0.5f,  0.0f,
     37     -0.5f, -0.5f,  0.0f,
     38   };
     39
     40   GLuint vbo = 0;
     41   glGenBuffers(1, &vbo);
     42   glBindBuffer(GL_ARRAY_BUFFER, vbo);
     43   glBufferData(GL_ARRAY_BUFFER, sizeof(points), points, GL_STATIC_DRAW);
     44
     45   GLuint vao=0;
     46   glGenVertexArrays(1, &vao);
     47   glBindVertexArray(vao);
     48   glEnableVertexAttribArray(0);
     49   glBindBuffer(GL_ARRAY_BUFFER, vbo);
     50   glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, NULL);
     51
    3352   glfwTerminate();
    3453   return 0;
Note: See TracChangeset for help on using the changeset viewer.