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

  

OpenGL位图函数的更多相关文章

  1. 【计算机图形学】openGL常用函数

    OpenGL常用函数   glAccum 操作累加缓冲区   glAddSwapHintRectWIN 定义一组被 SwapBuffers拷贝的三角形   glAlphaFunc允许设置alpha检测 ...

  2. opengl常用函数

    glAccum 操作累加缓冲区   glAddSwapHintRectWIN 定义一组被 SwapBuffers拷贝的三角形   glAlphaFunc允许设置alpha检测功能   glAreTex ...

  3. 【OpenGL游戏开发之三】OpenGl核心函数库汇总

    OpenGl核心函数库 glAccum 操作累加缓冲区 glAddSwapHintRectWIN 定义一组被SwapBuffers拷贝的三角形 glAlphaFunc允许设置alpha检测功能 glA ...

  4. openGL初学函数解释汇总

    openGL初学函数解释汇总 1.GLUT工具包提供的函数 //GLUT工具包所提供的函数 glutInit(&argc, argv);//对GLUT进行初始化,这个函数必须在其它的GLUT使 ...

  5. # OpenGL常用函数详解(持续更新)

    OpenGL常用函数详解(持续更新) 初始化 void glutInit(int* argc,char** argv)初始化GULT库,对应main函数的两个参数 void gultInitWindo ...

  6. OpenGL一些函数详解(二)

    OpenGL ES顶点数据绘制技巧 在OpenGL中,绘制一个长方体,需要将每个顶点的坐标放在一个数组中.保存坐标时有一些技巧(由于字母下标不好表示,因此将下标表示为单引号,如A1将在后文中表示为A' ...

  7. OpenGL位图变形问题

    因为初次接触OpenGL,图形学也后悔当初在学校没有认真学,隐约记得教授当时讲过图像变形的问题,而且我的bitmap也是2的N次方:16*16的,在网络上找到的大多都是一句话:“视口的纵横比一般和视景 ...

  8. OpenGL glMatrixMode() 函数解释与例子

    概述 glMatrixMode() 用以指定当前要操作的矩阵,可选值有 GL_MODELVIEW(模型视图,默认值),GL_PROJECTION(投影),GL_TEXTURE(纹理),GL_COLOR ...

  9. OpenGL——二次曲面函数(球面-圆锥面-圆柱面)

    代码: #include<iostream> #include <math.h> #include<Windows.h> #include <GL/glut. ...

随机推荐

  1. 笔记:FastAdmin 之 jQuery 选择器 $("[name$='[]']", form) 学习

    笔记:FastAdmin 之 jQuery 选择器 $("[name$='[]']", form) 学习 $("[name$='[]']", form)这个是什 ...

  2. 基于Video4Linux的视频采集模块开发(转)

    Linux系统中,摄像头驱动程序安装好后,为了进行视频采集必须加入Video4Linux模块,从而可以通过Video4Linux模块提供的编程接口(API)从摄像头设备中获取图像帧.下面具体研究基于V ...

  3. js中去掉字符串中的某个指定字符

    假设一个data里面的数据是[tian,12],现在去掉[],代码如下 data=data.replace("[",""); data=data.replace ...

  4. qt在动态库里面加载widget的例子

    testDll和testExe项目 备注:windows下dll内不需要new QApplication, linux和mac下面需要在动态库里面new QApplication testdll.h ...

  5. js 日期正则 转载

    天秤水的Blog 博客园 博问 闪存 首页 新随笔 联系 管理 订阅 随笔- 70  文章- 0  评论- 74    最强日期正则表达式   一.简单的日期判断(YYYY/MM/DD):  ^\d{ ...

  6. python查找字符串 函数find() 用法

    sStr1 = 'abcdefg' sStr2 = 'cde' print sStr1.find(sStr2) 输出 2意思是在sStr1字符里的第2位置找到了包含cde字符的字段

  7. POJ 2674 Linear world(弹性碰撞)

    Linear world Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 4426   Accepted: 1006 Desc ...

  8. [转]SQLite 经验集

    SQLite 的默认时间 转自:http://www.cnblogs.com/pennant/archive/2011/08/11/2134897.html select strftime('%Y-% ...

  9. 003:MySQL账号创建授权以及Workbench

    目录 一. 权限管理 1."用户 + IP"的概念 2. 用户权限管理 3. 基本操作 4. 撤销权限 5.授权和创建用户 二. MySQL模拟角色 三. Workbench与Ut ...

  10. Window性能监视器

    Microsoft Web Application Stress Tool 微软的分布式网站性能压力测试工具 Window性能监视器 1.监测IIS连接数量 从“开始”菜单上选择“运行”. 在“打开” ...