首页 OPENGLES中几个重要函数详细说明

OPENGLES中几个重要函数详细说明

举报
开通vip

OPENGLES中几个重要函数详细说明OPENGLES中几个重要函数详细说明 OPENGL ES中几个重要函数详细说明 时间: 2010-04-30 14:47 点击: 2012 次 函数名:glVertexPointer void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer) Parameters size Specifies the number of coordinates per vertex. Must be 2, 3, ...

OPENGLES中几个重要函数详细说明
OPENGLES中几个重要函数详细说明 OPENGL ES中几个重要函数详细说明 时间: 2010-04-30 14:47 点击: 2012 次 函数名:glVertexPointer void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer) Parameters size Specifies the number of coordinates per vertex. Must be 2, 3, or 4. The initial value is 4. type Specifies the 函数名:glVertexPointer void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer) Parameters size Specifies the number of coordinates per vertex. Must be 2, 3, or 4. The initial value is 4. type Specifies the data type of each vertex coordinate in the array. Symbolic constants GL_BYTE, GL_SHORT, and GL_FIXED, are accepted. However, the initial value is GL FLOAT. The common profile accepts the symbolic constant GL FLOAT as well. stride Specifies the byte offset between consecutive vertices. If stride is 0, the vertices are understood to be tightly packed in the array. The initial value is 0. pointer Specifies a pointer to the first coordinate of the first vertex in the array. The initial value is 0. 参数: size:指定了每个顶点对应的坐标个数,只能是2,3,4中的一个,默认值是4 type:指定了数组中每个顶点坐标的数据类 型,可取常量:GL_BYTE, GL_SHORT,GL_FIXED,GL_FLOAT; stride:指定了连续顶点间的字节排列方式,如果为0,数组中的顶点就会被认为是按照紧凑 方式排列的,默认值为0 pointer:制订了数组中第一个顶点的首地址,默认值为0,对于我们的android,大家可以不 用去管什么地址的,一般给一个IntBuffer就可以了。 Description glVertexPointer specifies the location and data of an array of vertex coordinates to use when rendering. size specifies the number of coordinates per vertex and type the data type of the coordinates. stride specifies the byte stride from one vertex to the next allowing vertices and attributes to be packed into a single array or stored in separate arrays. (Single-array storage may be more efficient on some implementations.) When a vertex array is specified, size, type, stride, and pointer are saved as client-side state. If the vertex array is enabled, it is used when glDrawArrays, or glDrawElements is called. To enable and disable the vertex array, call glEnableClientState and glDisableClientState with the argument GL VERTEX ARRAY. The vertex array is initially disabled and isn’t accessed when glDrawArrays or glDrawElements is called. Use glDrawArrays to construct a sequence of primitives (all of the same type) from prespecified vertex and vertex attribute arrays. Use glDrawElements to construct a sequence of primitives by indexing vertices and vertex attributes. If the vertex array is enabled, it is used when glDrawArrays, or glDrawElements is called. To enable and disable the vertex array, call glEnableClientState and glDisableClientState with the argument GL_VERTEX ARRAY. The vertex array is initially disabled and isn’t accessed when glDrawArrays or glDrawElements is called. Use glDrawArrays to construct a sequence of primitives (all of the same type) from prespecified vertex and vertex attribute arrays. Use glDrawElements to construct a sequence of primitives by indexing vertices and vertex attributes 描述: 当开始render的时候,glVertexPointer 用一个数组指定了每个顶点的坐标, size指定了每个顶点的坐标个数 type指定了每个坐标的数据类型,(和尚注:注意,这里不同的数据类型含义不同,如果选择 GL_FIXED,那么0x10000表示单位长度,如果选择 GL_FLOAT那么1.0f表示单位度。) stride指定了一个顶点和下一个顶点间数据的排列方式,是"单一数组"还是"分散数 组", 单一数组的存储方式通常是更具效率的。当一个顶点数组被指定以后, size,type,stride,pointer被存储成client- side. 当glDrawArrays或者glDrawElements被调用的时候,如果顶点数组 处于可用状态, 就 会被使用;可以使用glEnableClientState或者glDisableClientState来激活或者禁用一个顶 点数组,顶点数组默认是 不可用并且是不可被glDrawArrays、glDrawElements两个函数 使用的。 使用glDrawArrays函数可以根据顶点数组构建一个原始构图序列 使用glDrawElements可以根据序列化的顶点集合来创建相同的序列 Notes glVertexPointer is typically implemented on the client side Errors GL_INVALID_VALUE is generated if size is not 2, 3, or 4. GL_INVALID_ENUM is generated if type is is not an accepted value. GL_INVALID_VALUE is generated if stride is negative. 错误: GL_INVALID_VALUE size 不是 2, 3, 4中的一个的时候 GL_INVALID_ENUM type 不是一个允许的值. GL_INVALID_VALUE stride是错误的 函数名:glDrawArrays – 从数组提供原始数据 void glDrawArrays(GLenum mode, GLint first, GLsizei count) Parameters mode Specifies what kind of primitives to render. Symbolic constants GL_POINTS, GL_LINE_STRIP, GL_LINE_LOOP, GL_LINES, GL_TRIANGLE_STRIP,GL_TRIANGLE_FAN, and GL_TRIANGLES are accepted. first Specifies the starting index in the enabled arrays. count Specifies the number of indices to be rendered. 参数: mode 指定要提供的原始图形的样式,比如:GL_POINTS, GL_LINE_STRIP, GL_LINE_LOOP, GL_LINES, GL_TRIANGLE_STRIP,GL_TRIANGLE_FAN, GL_TRIANGLES first 指定了被激活的数组的索引起始点,通常为0 count 取几个数,和first配合使用 Description glDrawArrays specifies multiple geometric primitives with very few subroutine calls. You can prespecify separate arrays of vertices, normals, colors, and texture coordinates and use them to construct a sequence of primitives with a single call to glDrawArrays. When glDrawArrays is called, it uses sequential elements from each enabled array to construct a sequence of geometric primitives, beginning with element first. mode specifies what kind of primitives are constructed, and how the array elements construct those primitives. If GL_VERTEX_ARRAY is not enabled, no geometric primitives are generated. Vertex attributes that are modified by glDrawArrays have an unspecified value after glDrawArrays returns. For example, if GL_COLOR_ARRAY is enabled, the value of the current color is undefined after glDrawArrays executes. Attributes that aren’t modified remain well defined. 描述: glDrawArrays 提供了多种基本几何样式的绘制,你可以对各种数组,比如说顶 点、颜色、材质的坐标进行分割(和尚注:通过first和count参数),并且使 出来的坐标来构造一个显示队列。 用这些分割 当glDrawArrays 被调用的时候,它会从first参数开始,按照mode指定的样 式,按照顺序使用被激活的数组中的每个元素去构造一个由基本几何单元构成 的队列,如果 GL_VERTEX_ARRAY没有处于激活状态,不会有任何几何单元被创 建。 在glDrawArrays 被返回后,被这个函数编辑的顶点的属性将成为一个不确定的 值,例如:glDrawArrays 函数被调用以后,当前颜色将会变成一个未定义的 值。 没有被函数引用的顶点属性会保留与原本的属性。(和尚注:很绕口,关于这一 小段的 翻译 阿房宫赋翻译下载德汉翻译pdf阿房宫赋翻译下载阿房宫赋翻译下载翻译理论.doc ,我反复修改了很多遍,意思其实很简单,如果一个顶点数组被 glDrawArrays使用,那么使用后这些顶点决定的那个几何图形的属性,比如颜 色,就会丢失,不会影响到下一个glDrawArrays 的绘制,因此当你要重新用 glDrawArrays 绘制一个顶点集合的话,就要重新用glColor4f来设定颜色) Errors GL_INVALID_ENUM is generated if mode is not an accepted value. GL_INVALID_VALUE is generated if count is negative. 错误: GL_INVALID_ENUM mode不是一个被允许的值 GL_INVALID_VALUE count不合法 函数名:glTranslatef, glTranslatex – multiply the current matrix by a translation matrix C Specification void glTranslatef(GLfloat x, GLfloat y, GLfloat z) void glTranslatex(GLfixed x, GLfixed y, GLfixed z) 名称: glTranslatef, glTranslatex 在一个副本(和尚:不知道翻译成副本合适不合 适)模型上确定一个基于某个增量的新原点(和尚注:自己明白,要想写出合适的 译 文真的好难 ) 函数名:glVertexPointer void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer) Parameters size Specifies the number of coordinates per vertex. Must be 2, 3, or 4. The initial value is 4. type Specifies the void glTranslatef(GLfloat x, GLfloat y, GLfloat z) void glTranslatex(GLfixed x, GLfixed y, GLfixed z) Parameters x, y, z Specify the x, y, and z coordinates of a translation vector. 参数: x,y,z指定了一个基于某个方向的x,y,z坐标 Description glTranslate produces a translation by (x, y, z). The current matrix (see glMatrixMode) is multiplied by this translation matrix, with the product replacing the current matrix, as if glMultMatrix were called with the following matrix for its argument: 1 0 0 x 0 1 0 y 0 0 1 z 0 0 0 1 If the matrix mode is either GL_MODELVIEW or GL_PROJECTION, all objects drawn after a call to glTranslate are translated. Use glPushMatrix and glPopMatrix to save and restore the untranslated coordinate system. 描述: glTranslate 根据x,y,z生成了一个副本模型,当前模型是一个基于此模型的 增量模型,glMultMatrix 被调用的时候用以下模型来做参数: 1 0 0 x 0 1 0 y 0 0 1 z 0 0 0 1 如果模型模式是either GL_MODELVIEW 或者 GL_PROJECTION,所有的对象都会在glTranslate 被调用以后绘制 使用glPushMatrix 和 glPopMatrix来保存和恢复未被副本化的坐标系统 (和尚注:每一个层都是基于自己的坐标系统的,关于x,y,z的含义,参看以下说明: OpenGL屏幕中 心的坐标值是X和Y轴上的0.0f点。 中心左面的坐标值是负值,右面是正值。 移向屏幕顶端是正值,移向屏幕底端是负值。 移入屏幕深处是负值,移出屏幕则是正值。 )。 函数名:glClear – clear buffers to preset values C Specification void glClear(GLbitfield mask) 名称 glClear – 为重设数据清空缓冲区 void glClear(GLbitfield mask) Parameters mask Bitwise OR of masks that indicate the buffers to be cleared. Valid masks are GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT, and GL_STEN CIL_BUFFER_BIT. 参数: 掩码: 用OR连接起来的掩码,这些掩码决定了哪些缓冲区将被清除,可用的掩码有: GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT GL_STENCIL_BUFFER_BIT Description glClear sets the bitplane area of the window to values previously sel ected by gl- ClearColor, glClearDepth, and glClearStencil. The pixel ownership test, the scissor test, dithering, and the color buffer masks affect the operation of glClear. The scissor box bounds the cleared r egion. Alpha function, blend function, logical operation, stenciling, texture mapp ing, and depthbuffering are ignored by glClear. glClear takes a single argument that is the bitwise OR of several val ues indicating which buffer is to be cleared. The values are as follows: GL COLOR BUFFER BIT Indicates the color buffer. GL DEPTH BUFFER BIT Indicates the depth buffer. GL STENCIL BUFFER BIT Indicates the stencil buffer. The value to which each buffer is cleared depends on the setting of t he clear value for that buffer. 描述: glClear把窗口的bitplane区域的值设置成 您设置的ClearColor, glClearDepth, glClearStencil ownership测试、切图测试、抖动、颜色缓冲掩码受glClear的影响(空白区域 的盒子跳动)Alpha通道函数,混合函数,逻辑操作, 模板 个人简介word模板免费下载关于员工迟到处罚通告模板康奈尔office模板下载康奈尔 笔记本 模板 下载软件方案模板免费下载 操 作,纹理材质操作, 深度缓冲区操作将被glClear忽略。 glClear的参数用几个OR连接3个可选项来制定要清楚哪些缓冲区 关于可选项的说明: GL COLOR BUFFER BIT 颜色缓冲区 GL DEPTH BUFFER BIT 深度缓冲区 GL STENCIL BUFFER BIT 模板缓冲区 函数名:glMatrixMode – specify which matrix is the current matrix C Specification void glMatrixMode(GLenum mode) 名称 glMatrixMode – 选择当前模型 Parameters mode Specifies which matrix stack is the target for subsequent matrix operations. Three values are accepted: GL_MODELVIEW, GL_PROJECTION, and GL_TEXTURE. The initial value is GL_MODELVIEW. 参数: mode 指定随后的模型操作的目标是哪一个模型堆栈,可选以下三个值 GL_MODELVIEW GL_PROJECTION GL_TEXTURE 默认值是 GL_MODELVIEW Description glMatrixMode sets the current matrix mode. mode can assume one of four values: GL MODELVIEW Applies subsequent matrix operations to the modelview matrix stack. GL PROJECTION Applies subsequent matrix operations to the projection matrix stack. GL TEXTURE Applies subsequent matrix operations to the texture matrix stack. 描述: glMatrixMode 函数设定当前的模型模式,mode可以选择三个中的一个: GL_MODELVIEW 把随后的模型操作应用到 modelview的模型堆栈上 GL_PROJECTION 把随后的模型操作应用到projection 的模型堆栈上 GL_TEXTURE 把随后的模型操作应用到texture 的模型堆栈上 Errors GL_INVALID_ENUM is generated if mode is not an accepted value. 错误: GL_INVALID_ENUM mode选择了一个错误的值 See Also glLoadMatrix, glPushMatrix 参看: glLoadMatrix, glPushMatrix函数
本文档为【OPENGLES中几个重要函数详细说明】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_682974
暂无简介~
格式:doc
大小:37KB
软件:Word
页数:0
分类:高中语文
上传时间:2017-09-27
浏览量:20