glGenBuffers(3, g_vbos); for (i = SPR_PLAYER; i < SPR_END; i++) { float x1 = spr_rect[i].x / s_x; float y1 = spr_rect[i].y / s_y; float x2 = x1 + spr_rect[i].w / s_x; float y2 = y1 + spr_rect[i].h / s_y; GLfloat vbo_data[] = { 0.0f, 0.0f, x1, y1, 1.0f, 0.0f, x2, y1, 0.0f, 1.0f, x1, y2, 1.0f, 0.0f, x2, y1, 1.0f, 1.0f, x2, y2, 0.0f, 1.0f, x1, y2 }; glBindBuffer(GL_ARRAY_BUFFER, g_vbos[i - SPR_PLAYER]); glBufferData(GL_ARRAY_BUFFER, sizeof(vbo_data), vbo_data, GL_STATIC_DRAW); attrib = glGetAttribLocation(g_progs[PROG_PAL], "position"); glVertexAttribPointer(attrib, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(GLfloat), 0); glEnableVertexAttribArray(attrib); attrib = glGetAttribLocation(g_progs[PROG_PAL], "tex_coord"); glVertexAttribPointer(attrib, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(GLfloat), (void*)(2 * sizeof(GLfloat))); glEnableVertexAttribArray(attrib); }