Blank screen while using glGenBuffers in openGL
问题 #include <stdio.h> #include <stdlib.h> #include <GL/glew.h> #include <GL/glut.h> void changeSize(int w, int h) { if(h == 0) h = 1; float ratio = w / h; glMatrixMode(GL_PROJECTION); glLoadIdentity(); glViewport(0, 0, w, h); gluPerspective(40,ratio,1.5,20); glMatrixMode(GL_MODELVIEW); } void renderScene(void) { glClear(GL_COLOR_BUFFER_BIT ); glLoadIdentity(); glTranslatef(0.0,0.0,-5.0); glDrawArrays(GL_TRIANGLES,0,3); glutSwapBuffers(); } void init() { GLfloat verts[] = { 0.0, 1.0, -1.0, -1.0,