本文共 1484 字,大约阅读时间需要 4 分钟。
???OpenGL??????????????????????????????????????????????????
static GLint vertices[] = { 25, 25, 100, 325, 175, 25, 175, 325, 250, 25, 325, 325 }; ???????????????????OpenGL????glutPostRedisplay()?glutReshapeFunc?????????????????????
??????OpenGL???????glGetString(GL_VERSION)??????????OpenGL?????????????????????
?????????????????
glClearColor(0.0, 0.0, 0.0, 0.0); // ??????glClear(GL_COLOR_BUFFER_BIT); // ???????glViewport(); // ????glDrawArrays(GL_TRIANGLES, 0, 6); // ?????glFlush(); // ?????
??????Nurbs????????????
gluBegin(GL_NURBS);gluCurve(GLU_PATH, 0, 100, 1, &points, 0);gluEnd();
?3D??????????????????????????????????????
glTranslatef(1, 0, 0); // ??glRotatef(45, 1, 1, 0); // ??glScalef(1.5, 1.5, 1); // ??
?????????????????????????
GLfloat colors[4] = {1.0, 0.0, 0.0, 1.0};glColor(GLINKER, colors); ??????????
glPolygonMode(GL_TRIANGLE_FAN, GL_FILL);
???????????????????
GLfloat lightPos[4] = {5.0, 5.0, 5.0, 1.0};GLfloat ambientLight[4] = {0.2, 0.2, 0.2, 1.0};glLight( GL_LIGHT_SOURCE, lightPos );glLightMod( GL_LIGHT_AMBIENT, ambientLight ); ????????????????
glutInitDisplayMode(GLUT_DOUBLE);// ??????glutCreateWindow("OpenGL Window"); ?????????
void display(){ glutPostRedisplay();}int main(){ glutInit(); glutCreateWindow("OpenGL Window"); glutDisplay(); glutMainLoop(); return 0;} ?????????????????OpenGL????????????????3D???????????????????
转载地址:http://ozpfk.baihongyu.com/