首页 > 代码库 > [OpenGL]OpenGL库函数汇总
[OpenGL]OpenGL库函数汇总
OpenGL函数库相关的API有核心库(gl)、实用库(glu)、辅助库(aux)、实用工具库(glut)、窗口库(glx、agl、wgl)和扩展函数库等。从图可以看出,gl是核心,glu是对gl的部分封装。glx、agl、wgl 是针对不同窗口系统的函数。glut是为跨平台的OpenGL程序的工具包,比aux功能强大。扩展函数库是硬件厂商为实现硬件更新利用OpenGL的扩展机制开发的函数。
目前OpenGL的函数主要包含在3个库中:GL 函数库、GLU 函数库、GLUT 函数库
GL 库函数
颜色编辑 | glShadeModel,glColor,glColorPointer,glIndex,glIndexPointer,glColorTableEXT,glColorSubTableEXT |
绘制几何图形 | glVertex,glVertexPointer,glArrayElement,glBegin , glEnd,glEdgeFlag , glEdgeFlagv,glPointSize,glLineWidth,glLineStipple,glPolygonMode,glFrontFace,glPolygonStipple,glDrawElements,glRect |
坐标转换 | glTranslate,glRotate,glScale,glViewPoint,glFrustum,glOrtho,glClipPlane |
堆栈操作 | glLoadMatrix,glMultMatrix,glMatrixMode,glPushMatrix , glPopMatrix,glPushAttrib , glPopAttrib,glPushName , glPopName,glInitName ,glLoadName |
显示列表 | glNewList , glEndList,glCallList,glCallLists,glGenLists,glDeleteLists, |
使用光照和材质 | glNormal,glNormalPointer,glLight,glLightModel,glMaterial,glColorMaterial, |
像素操作 | glRasterPos,glBitmap,glReadPixels,glDrawPixels,glCopyPixels,glCopyTexImage1D,glCopyTexImage2D,glCopyTexSubImage1D,glCopyTexSubImage2D,glPixelZoom,glPixelStore,glPixelTransfer,glPixelMap |
纹理映射 | glTexImage1D,glTexImage2D,glTexParameter,glTexSubImage1D,glTexSubImage2D,glTexEnv,glTexCoord,glTexGen,glTexCoordPointer,glDeleteTextures, |
特效操作 | glBlendFunc,glHint,glFog |
帧缓存操作 | glClear,glClearAccum,glClearColor,glClearDepth,glClearIndex,glClearStencil,glDrawBuffer,glIndexMask,glColorMask,glDepthMask,glStencilMask,glAlphaFunc,glStencilFunc,glStencilOp,glDepthFunc,glDepthRange,glLogicOp,glAccum, |
曲线或曲面绘制 | glEvalCoord,glMap1,glMap2,glMapGrid,glEvalMesh,glEvalPoint, |
查询函数 | glGet,glGetClipPlane,glGetColorTableEXT,glGetColorTableParameterfvEXT , glGetColorTableParameterivEXT,glGetError,glGetLight,glGetMap,glGetMaterial,glGetPixelMap,glGetPointerv,glGetPolygonStipple,glGetString,glGetTexEnv,glGetTexImage,glGetTexLevelParameter,glGetTexParameter, |
GLU 库函数
包含有43个函数,函数名的前缀为glu。OpenGL提供了强大的但是为数不多的绘图命令,所有较复杂的绘图都必须从点、线、面开始。Glu 为了减轻繁重的编程工作,封装了OpenGL函数,Glu函数通过调用核心库的函数,为开发者提供相对简单的用法,实现一些较为复杂的操作。此函数由glu.dll来负责解释执行。OpenGL中的核心库和实用库可以在所有的OpenGL平台上运行。
绘制 NURBS 曲线和曲面 | gluNewNurbsRenderer,gluNurbsProperty,gluNurbsCallback,gluBeginCurve , gluEndCurve,gluNurbsCurve,gluDeleteNurbsRenderer,gluBeginSurface , gluEndSurface,gluNurbsSurface,gluBeginTrim , gluEndTrim,gluPwlCurve,gluBeginPolygon , gluEndPolygon,gluPickMatrix |
绘制二次几何物体 | gluNewQuadric,gluQuadricDrawStyle,gluQuadricNormals,gluQuadricOrientation,gluCylinder,gluSphere,gluDisk,gluPartialDisk,gluDeleteQuadric,gluQuadricTexture,gluQuadricCallback |
网格化 | gluNewTess,gluTessVertex,gluTessCallback,gluTessBeginPolygon , gluTessEndPolygon,gluTessBeginContour , gluTessBeginContour,gluTessProperty,gluNextContour,gluTessNormal,gluDeleteTess |
坐标转换 | gluOrtho2D,gluPerspective,gluLookAt,gluProject,gluUnProject |
多重映射 | gluBuild1DMipmaps,gluBuild2DMipmaps,gluScaleImage |
查询函数 | gluErrorString,gluGetNurbsProperty,gluGetString,gluGetTessProperty |
GLUT 库函数
包含大约30多个函数,函数名前缀为glut。glut是不依赖于窗口平台的OpenGL工具包,由Mark KLilgrad在SGI编写(现在在Nvidia),目的是隐藏不同窗口平台API的复杂度。 函数以glut开头,它们作为aux库功能更强的替代品,提供更为复杂的绘制功能,此函数由glut.dll来负责解释执行。由于glut中的窗口管理函数是不依赖于运行环境的,因此OpenGL中的工具库可以在X-Window, Windows NT, OS/2等系统下运行,特别适合于开发不需要复杂界面的OpenGL示例程序。对于有经验的程序员来说,一般先用glut理顺3D图形代码,然后再集成为完整的应用程序。
初始化和启动事件处理 | glutInit,glutInitWindowPosition,glutInitWindowSize,glutInitDisplayMode,glutMainLoop, |
窗口管理 | glutCreateWindow,glutCreateSubWindow,glutHideWindow,glutShowWindow,glutSetWindowTitle,glutPostRedisplay,glutSwapBuffers,glutFullScreen,glutPositionWindow,glutReshapeWindow,glutSetWindow,glutGetWindow,glutPopWindow,glutPushWindow,glutDestroyWindow,glutIconifyWindow,glutSetCursor, |
重叠层管理 | glutEstablishOverlay,glutUseLayer,glutRemoveOverlay,glutPostOverlayRedisplay,glutShowOverlay,glutHideOverlay, |
菜单管理 | glutCreateMenu,glutAddMenuEntry,glutAddSubMenu,glutAttachMenu,glutGetMenu,glutSetMenu,glutDestroyMenu,glutChangeToMenuEntry,glutChangeToSubMenu,glutRemoveMenuItem,glutDetachMenu, |
注册回调函数 | glutDisplayFunc,glutReshapeFunc,glutMouseFunc,glutMotionFunc,glutIdleFunc,glutVisibilityFunc,glutKeyboardFunc,glutSpecialFunc,glutOverlayDisplayFunc,glutPassiveMotionFunc,glutEntryFunc,glutSpaceballMotionFunc,glutSpaceballRotateFunc,glutSpaceballButtonFunc,glutButtonBoxFunc,glutDialsFunc,glutTableMotionFunc,glutTableButtonFunc,glutMenuStatusFunc,glutTimerFunc |
颜色索引映射表管理 | glutSetColor,glutGetColor,glutCopyColormap, |
状态检索 | glutGet,glutLayerGet,glutDeviceGet,glutGetModifiers,glutExtensionSupported, |
字体绘制 | glutBitmapCharacter,glutBitmapWidth,glutStrokeCharacter,glutStrokeWidth, |
几何图形绘制 | glutSolidSphere , glutWireSphere,glutSolidCube , glutWireCube,glutSolidCone , glutWireCone,glutSolidTorus , glutWireTorus,glutSolidDodecahedron , glutWireDodecahedron,glutSolidOctahedron , glutWireOctahedron,glutSolidTetrahedron , glutWireTetrahedron,glutSolieIcosahedron , glutWireIcosahedron,glutSolidTeapot , glutWireTeapot, |
OpenGL函数与范例解析手册
OpenGL学习总结