opengl启动过程
GLuint _program = glCreateProgram(); //create shader program
GLuint vertShader, fragShader;//顶点着色器,片段着色器(像素着色器)
vertShader= glCreateShader(GL_VERTEX_SHADER);
glShaderSource(vertShader, 1, sourceVert, NULL);//载入顶点着色器代码到顶点着色器中
glCompileShader(vertShader); //编译这个着色器
fragShader= glCreateShader(GL_FRAGMENT_SHADER);
glShaderSource(fragShader, 1, sourceFrag, NULL);
glCompileShader(fragShader);
glAttachShader(_program, vertShader);
glAttachShader(_program, fragShader);
// Bind attribute locations.
// This needs to be done prior to linking.
glBindAttribLocation(_program, GLKVertexAttribPosition, "position");
glBindAttribLocation(_program, GLKVertexAttribColor, "color");
glBindAttribLocation(_program, GLKVertexAttribNormal, "a_normal");
glLinkProgram(_program );
// Get uniform locations.
uniforms[UNIFORM_MODELVIEWPROJECTION_MATRIX] = glGetUniformLocation(_program, "modelViewProjectionMatrix");
uniforms[UNIFORM_NORMAL_MATRIX] = glGetUniformLocation(_program, "normalMatrix");
uniforms[UNIFORM_COLOR_MATRIX] = glGetUniformLocation(_program, "colorMatrix");