OpenGL函数(1)

1. glViewPort

在OpenGL初始化完成之后,我们应该进行一些视图设置。首先是设定视见区域,即告诉OpenGL应把渲染之后的图形绘制在窗体的哪个部位。当视见区域是整个窗体时,OpenGL将把渲染结果绘制到整个窗口。我们调用glViewPort函数来决定视见区域:

procedure glViewPort(x:GLInt;y:GLInt;Width:GLSizei;Height:GLSizei);

其中,参数X,Y指定了视见区域的左下角在窗口中的位置,一般情况下为(0,0),Width和Height指定了视见区域的宽度和高度。注意OpenGL使用的窗口坐标和WindowsGDI使用的窗口坐标是不一样的.

 

2.glMatrixMode - 指定哪一个矩阵是当前矩阵

  void glMatrixMode(GLenum mode)
  参数
  mode 指定哪一个矩阵堆栈是下一个矩阵操作的目标,可选值: GL_MODELVIEW、GL_PROJECTION、GL_TEXTURE.
  说明
  glMatrixMode设置当前矩阵模式:
  GL_MODELVIEW,对模型视景矩阵堆栈应用随后的矩阵操作.
  GL_PROJECTION,对投影矩阵应用随后的矩阵操作.
  GL_TEXTURE,对纹理矩阵堆栈应用随后的矩阵操作.
  与glLoadIdentity()一同使用
  
3. glLoadIdentity()
该函数的功能是重置当前指定的矩阵为单位矩阵。
 
 
4. gluPickMatrix --define a picking region

   void gluPickMatrix(GLdouble x,
  GLdouble y,
  GLdouble width,
  GLdouble height,
  GLint viewport[4])
  PARAMETERS
  x, y
  Specify the center of a picking region in window coordinates.
  width, height
  Specify the width and height, respectively, of the picking region in window coordinates.
  viewport
  Specifies the current viewport (as from a glGetIntegerv call).
  DESCRIPTION
  gluPickMatrix creates a projection matrix that can be used to restrict drawing to a small region of the viewport. This is typically useful to determine what objects are being drawn near the cursor. Use gluPickMatrix to restrict drawing to a small region around the cursor. Then, enter selection mode (with glRenderMode and rerender the scene. All primitives that would have been drawn near the cursor are identified and stored in the selection buffer.
  The matrix created by gluPickMatrix is multiplied by the current matrix just as if glMultMatrix is called with the generated matrix. To effectively use the generated pick matrix for picking, first call glLoadIdentity to load an identity matrix onto the perspective matrix stack. Then call gluPickMatrix, and finally, call a command (such as gluPerspective) to multiply the perspective matrix by the pick matrix.

 

5.几何图形绘制

glutSolidsphere,glutwiresphere--绘制实心球体和线框球体
glutsolidCube,glutwireCube--绘制实心立方体和线框立方体
glutsolidCone,glutwireCone--绘制实心圆锥体和线框圆锥体
glutsolidTorus,glutwireTorus--绘制实心圆环和线框圆环
glutSolidDOdeCahedroll,glLltwiFeDOdechedfotl--绘制实心十二面体和线框十二面体
glutSolidOctahedron,glutWireOctahedron--绘制买心八面体和线框八面体
glutsolldTetrahedron,glutwireTetrahedron--绘制实心四面体和线框四面体
glutSollelcosahedron,glutwirelcosahedron--绘制实心二十面体和线框二十面体
glutsolidTeapot,glutwireTeapot--绘制实心茶壶和线框茶壶

 

 

你可能感兴趣的:(OpenGL)