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. ...
随机推荐
- counting elements--codility
lesson 4: counting elements 1. FrogRiverOne 2. PermCheck 3. MissingInteger 4. MaxCounters lesson 4: ...
- Linux服务器运维安全策略经验分享
http://jxtm.jzu.cn/?p=3692 大家好,我是南非蚂蚁,今天跟大家分享的主题是:线上Linux服务器运维安全策略经验.安全是IT行业一个老生常谈的话题了,从之前的“棱镜门”事件中折 ...
- JVM内存管理之GC简介
为何要了解GC策略与原理? 原因在上一章其实已经有所触及,就是因为在平时的工作和研究当中,不可避免的会遇到内存溢出与内存泄露的问题.如果对GC策略与原理不了解的情况下碰到了前面所说的问题 ...
- 基于EFCore的数据Cache实现
.NetCore 内置缓存加入到EFCore操作中,数据更新或者查询时自动更新缓存.github地址 2019-04-27 初步完成逻辑代码编写,尚未经过测试,诸多细节有待完善. 2019-04-28 ...
- redisTemplate 方法
ClassPathXmlApplicationContext appCtx = new ClassPathXmlApplicationContext("spring-redis.xml&qu ...
- 基于python的测试框架behave----context
使用behave时,每一步对应的方法都需要参数context,那么context是什么,为什么都需要传这个对象? 在所有用例中的context都是behave.runner.Context类的一个实例 ...
- ESXI5-WIN2008R2安装域控以及额外域笔记
每次安装域控都要找教程,每次都没法一次性搞定.写个笔记吧...主要是给自己看的.写的比较含糊.不清楚的可以直接QQ本人. 1.安装WIN2008R2,192.168.188.10 2.上载SLICET ...
- c# 关键字学习
partial class Test { public string str; public void get() { } } partial class Test { public int i; p ...
- node中的favicon.icon请求
var http=require("http"); var server=http.createServer(); server.on("request", c ...
- dede_CMS模板的基础安装
今天来给大家讲一讲dede_CMS的基础使用方法 那么什么是CMS呢 cms (content manage system 内容管理系统): 比如 新闻/电子商务/电影网/公司宣传网站/软件/文章) ...