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
OpenGL位图函数的更多相关文章
- 【计算机图形学】openGL常用函数
OpenGL常用函数 glAccum 操作累加缓冲区 glAddSwapHintRectWIN 定义一组被 SwapBuffers拷贝的三角形 glAlphaFunc允许设置alpha检测 ...
- opengl常用函数
glAccum 操作累加缓冲区 glAddSwapHintRectWIN 定义一组被 SwapBuffers拷贝的三角形 glAlphaFunc允许设置alpha检测功能 glAreTex ...
- 【OpenGL游戏开发之三】OpenGl核心函数库汇总
OpenGl核心函数库 glAccum 操作累加缓冲区 glAddSwapHintRectWIN 定义一组被SwapBuffers拷贝的三角形 glAlphaFunc允许设置alpha检测功能 glA ...
- openGL初学函数解释汇总
openGL初学函数解释汇总 1.GLUT工具包提供的函数 //GLUT工具包所提供的函数 glutInit(&argc, argv);//对GLUT进行初始化,这个函数必须在其它的GLUT使 ...
- # OpenGL常用函数详解(持续更新)
OpenGL常用函数详解(持续更新) 初始化 void glutInit(int* argc,char** argv)初始化GULT库,对应main函数的两个参数 void gultInitWindo ...
- OpenGL一些函数详解(二)
OpenGL ES顶点数据绘制技巧 在OpenGL中,绘制一个长方体,需要将每个顶点的坐标放在一个数组中.保存坐标时有一些技巧(由于字母下标不好表示,因此将下标表示为单引号,如A1将在后文中表示为A' ...
- OpenGL位图变形问题
因为初次接触OpenGL,图形学也后悔当初在学校没有认真学,隐约记得教授当时讲过图像变形的问题,而且我的bitmap也是2的N次方:16*16的,在网络上找到的大多都是一句话:“视口的纵横比一般和视景 ...
- OpenGL glMatrixMode() 函数解释与例子
概述 glMatrixMode() 用以指定当前要操作的矩阵,可选值有 GL_MODELVIEW(模型视图,默认值),GL_PROJECTION(投影),GL_TEXTURE(纹理),GL_COLOR ...
- OpenGL——二次曲面函数(球面-圆锥面-圆柱面)
代码: #include<iostream> #include <math.h> #include<Windows.h> #include <GL/glut. ...
随机推荐
- .NET程序下载获得的ContentLength=-1
你写的.NET(C#)下载程序是否会遇到过这样的问题?--ContentLength=-1. 例如,有如下代码: HttpWebRequest webRequest = (HttpWebRequest ...
- WPF实现Twitter按钮效果(转)
最近上网看到这个CSS3实现的Twitter按钮,感觉很漂亮,于是想用WPF来实现下. 实现这个效果,参考了CSS3 原文地址:http://www.html5tricks.com/css3-twit ...
- 几个开源ssg 技术方案
1. Nanoc 2. Middle Man App 3. Hexo 4. DocPad 5. Hugo 6. Jekyll 7. Octopress 8. Harp ...
- Rabbitmq交换器Exchange和消息队列
通常我们谈到队列服务, 会有三个概念: 发消息者.队列.收消息者,RabbitMQ 在这个基本概念之上, 多做了一层抽象, 在发消息者和 队列之间, 加入了交换器 (Exchange). 这样发消息者 ...
- 【转】VC 线程间通信的三种方式
原文网址:http://my.oschina.net/laopiao/blog/94728 1.使用全局变量(窗体不适用) 实现线程间通信的方法有很多,常用的主要是通过全局变量.自定义消息和 ...
- 【转】Linux 静态库与共享库的使用
原文网址:http://blog.csdn.net/heyabo/article/details/11688517 申明: 正如题如示,本篇讲的是Linux下是静态库与共享库,而Window下的动态链 ...
- 虚拟路由冗余协议VRRP
一.VRRP简介 虚拟路由冗余协议VRRP(Virtual Router Redundancy Protocol)通过把几台路由设备联合组成一台虚拟的路由设备,将虚拟路由设备的IP地址作为用户的默认网 ...
- jQuery的页面初始化操作写法
$(document).ready(function(){ alert("第一种方法."); }); $(function(){ alert("第二种方法.") ...
- RK3288 usb 摄像头旋转
系统:Android 5.1 下面实现了摄像头 180 度旋转,旋转角度只需修改 orientation. diff --git a/hardware/rockchip/camera/CameraHa ...
- git 修改本地分支名称和远程分支名称
branch-A 为旧分支名称 branch-B 为新分支名称 修改本地分支名称 $ git branch -m branch-A branch-B 删除远程分支 $ git push origin ...