zoukankan      html  css  js  c++  java
  • OpenGL位图函数

    OpenGL位图函数

    1、OpenGL中glBitmap用于绘制一个二值阵列。

      

      When drawn, the bitmap is positioned relative to the current raster position, and framebuffer pixels corresponding to 1s in the bitmap are written using the current raster color or index. Frame-buffer pixels corresponding to zeros in the bitmap are not modified.

      glBitmap常用于绘制字体。

      下图是一个bitmap:

      

      使用下同的程序段可将图3.61中的位图案应用于帧缓冲中:

      

    2、glRasterPos*()用于指定当前屏幕位置。

    3、glPixelStorei(GL_UNPACK_ALIGNMENT, 1)。

      Specifies the alignment requirements for the start of each pixel row in memory. The allowable values are 1 (byte-alignment), 2 (rows aligned to even-numbered bytes), 4 (word alignment), and 8 (rows start on double-word boundaries).

    4、glDrawPixels。

        

      format:The format of the pixel data.

      type:The data type for pixels.可取以下的值:

        

      如果format为GL_RGB,同type指定每一个component的类型,如下:

      

    5、glReadPixels(xmin, ymin, width, height, dataFormat, dataTpye, array)

      dataFormat可取值为:GL_DEPTH_COMPONENT。

      Depth values are read from the depth buffer. Each component is converted to floating point such that the minimum depth value maps to 0.0 and the maximum value maps to 1.0. Each component is then multiplied by GL_DEPTH_SCALE, added to GL_DEPTH_BIAS, and finally clamped to the range [0,1].  

    6、glReadBuffer(GLenum mode)、glDrawBuffer(GLenum mode)。

      

      The default value is GL_FRONT for single-buffered contexts, and GL_BACK for double-buffered contexts.

      当双缓冲时,默认的draw-buffer是GL_BACK。

    7、glCopyPixels(xmin, ymin, width, height, pixelValues);

      pixelValues被赋予GL_COLOR、GL_DEPTH、GL_STENCIL。

      此函数将一块像素从源缓存复制到目标缓存。源缓存用glReadBuffer来选择,目标缓存用glDrawBuffer命令选择。

    8、源像素与目标像素可混合,通过以下2个方法设置混合方式。

      

      logicOp可被赋予多种符号常量,GL_AND、GL_OR、GL_XOR、GL_COPY_INVERTED、GL_INVERTED、GL_CLEAR。默认值为GL_COPY。

    参考:

    1、http://technet.microsoft.com/zh-cn/library/ms537014

    2、http://technet.microsoft.com/zh-cn/library/ms537240

    3、http://technet.microsoft.com/zh-cn/dd318840(v=vs.80).aspx

    4、http://msdn.microsoft.com/zh-cn/subscriptions/ms537041(v=vs.85).aspx

    5、http://technet.microsoft.com/zh-cn/library/ms537248

      

  • 相关阅读:
    2019暑假集训 windy数
    2019暑假集训 数字游戏
    2019暑假集训 周年纪念晚会
    2019暑假集训 加分二叉树
    0013-求圆柱体体积
    0012-求滑动距离
    0011-绝对值函数
    0010-温度转换
    0009-乘法问题
    0008-三位数倒序问题
  • 原文地址:https://www.cnblogs.com/tekkaman/p/3918245.html
Copyright © 2011-2022 走看看