opengl_learn

Step-by-step introduction to OpenGL
git clone https://0xdd.org/code/opengl_learn.git
Log | Files | Refs | README | LICENSE

ogl_arraybuffer_load.c (427B)


      1 /*
      2 2018 David DiPaola
      3 licensed under CC0 (public domain, see https://creativecommons.org/publicdomain/zero/1.0/)
      4 */
      5 
      6 #include <GL/glew.h>
      7 
      8 GLuint
      9 ogl_arraybuffer_load(const GLvoid * data, GLsizeiptr data_size) {
     10 	GLuint buffer_ID;
     11 	glGenBuffers(1, &buffer_ID);
     12 	glBindBuffer(GL_ARRAY_BUFFER, buffer_ID);
     13 	glBufferData(GL_ARRAY_BUFFER, data_size, data, GL_STATIC_DRAW);
     14 	glBindBuffer(GL_ARRAY_BUFFER, 0);
     15 
     16 	return buffer_ID;
     17 }
     18