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. BW建模开发入门

    本文档主要指导具体操作步骤,一些技术名称和描述可能在各步骤中不对应,可以忽略 一.模型建立 1.建立信息区和信息对象目录 1)进入BW工作台 2)创建信息区 输入技术名称和描述 3)创建特性和关键值的 ...

  2. mui 拨打电话

    function callPhone() { let btnArray = ['拨打', '取消']; let Phone = "10086"; mui.confirm('是否拨打 ...

  3. php mysql apache字符集(二) (转)

    1 MYSQL中的字符集概念  Mysql的字符集里有两个概念,一个是"Character set(字符集)",另一个是"Collations".1.1 Col ...

  4. Java API 操作Redis

    针对Redis的Java客户端有很多种,具体查看官网信息:https://redis.io/clients#java 本次测试使用Jedis API,Jedis使用方便,其api方法名称与redis命 ...

  5. Python学习笔记第一讲

    1.pycharm快捷键 撤销与反撤销:Ctrl + z,Ctrl + Shift + z 缩进.不缩进:Tab.Shift + tab 运行:Shift + F10 取消注释,行注释:Ctrl + ...

  6. linux下踢出已登录用户

    通过xshell登录到linux,看到如下所示,有3个用户,但是前面两个不知在哪登录的了,那就踢出吧. 先确认一下自己是哪个 顺便注意一下“whoami”和“who am i”的不同 然后踢出前面两个 ...

  7. ActiveMQ入门之四--ActiveMQ持久化方式

    消息持久性对于可靠消息传递来说应该是一种比较好的方法,有了消息持久化,即使发送者和接受者不是同时在线或者消息中心在发送者发送消息后宕机了,在消息中心重新启动后仍然可以将消息发送出去,如果把这种持久化和 ...

  8. python文本挖掘模版

    import xlrd import jieba import sys import importlib import os #python内置的包,用于进行文件目录操作,我们将会用到os.listd ...

  9. Win10 TensorFlow(gpu)安装详解

    Win10 TensorFlow(gpu)安装详解 写在前面:TensorFlow是谷歌基于DistBelief进行研发的第二代人工智能学习系统,其命名来源于本身的运行原理.Tensor(张量)意味着 ...

  10. python 将html实体转回去

    参考资料: http://www.360doc.com/content/17/0620/16/44530822_664927373.shtml https://blog.csdn.net/guzhou ...