Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1501003
  • 博文数量: 218
  • 博客积分: 6394
  • 博客等级: 准将
  • 技术积分: 2563
  • 用 户 组: 普通用户
  • 注册时间: 2008-02-08 15:33
个人简介

持之以恒

文章分类

全部博文(218)

文章存档

2013年(8)

2012年(2)

2011年(21)

2010年(55)

2009年(116)

2008年(16)

分类: 嵌入式

2011-11-18 22:38:13

OpenGL ES学习笔记

Viewport:the size and resoution of the final image

View frustum:how much the image we see

3D-2D projection:

(1)    Parallel projection

(2)    perspective projection

projection plane:where the light is registered to the final image.The part view frustum will projection to.

Clipping plane: any thing outside the view frustum will be cut.

Normalized Device space:

After the projection, It can transform to the pixel coordinates in the framebuffer(in the view port) but need to be transfrom to the normalized device space first

Model-View matrix:

(1)    move rotate and scale the point of our triangles around(Model part)

(2)    specify the position and orientation of our camera(View part)

Projection matrix

Projection and view frustum

Texture matrix

 

The Rendering Pipeline

(1)    Model-View

(2)    Projection

(3)    Clipping

(4)    Apply to the viewport

(5)    Texture and Blending

OpenGL functions:

Defining the view port: all use portion or all of the screen

void glViewport(GLint x, GLint y, GLsizei width, GLsizei height)

Projection Matrix:

void glMatrixMode(GLenum 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.

glOrtho describes a transformation that produces a parallel projection.

Typically, the matrix mode is GL_PROJECTION, and (left, bottom, -near) and (right, top, -near) specify the points on the near clipping plane that are mapped to the lower left and upper right corners of the window, respectively, assuming that the eye is located at (0, 0, 0).

glLoadIdentity replaces the current matrix with the identity matrix.

NIO buffer of OPENGL

glEnableClientState , glDisableClientState - enable or disable client-side capability

GL_COLOR_ARRAY

If enabled, the color array is enabled for writing and used during rendering when glDrawArrays, or glDrawElements is called. See glColorPointer.

GL_NORMAL_ARRAY

If enabled, the normal array is enabled for writing and used during rendering when glDrawArrays, or glDrawElements is called. See glNormalPointer.

GL_TEXTURE_COORD_ARRAY

If enabled, the texture coordinate array is enabled for writing and used during rendering when glDrawArrays, or glDrawElements is called. See glTexCoordPointer.

GL_VERTEX_ARRAY

If enabled, the vertex array is enabled for writing and used during rendering when glDrawArrays, or glDrawElements is called. See glVertexPointer

void glVertexPointer(GLint size,

    GLenum type,

    GLsizei stride,

    const GLvoid * pointer)

glVertexPointer - define an array of vertex coordinates

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.

Texture Mappingrender the bitmaps to opengles

Texture Coordinates:s/tThe left will be set to (0,0) and the right will be set to (1,1) for all the images
void glGenTextures(GLsizei n, GLuint * textures)

glGenTextures returns n texture names in textures. There is no guarantee that the names form a contiguous set of integers. However, it is guaranteed that none of the returned names was in use immediately before the call to glGenTextures

void glBindTexture(GLenum target, GLuint texture)

GL_TEXTURE_MIN_FILTER

The texture minifying function is used whenever the pixel being textured maps to an area greater than one texture element. There are six defined minifying functions. Two of them use the nearest one or nearest four texture elements to compute the texture value. The other four use mipmaps.

GL_TEXTURE_MAG_FILTER

Not forget to recycle a bitmap once it has been unbound

Indexed Vertices:

Alpha Blending

void glBlendFunc(GLenum sfactor, GLenum dfactor)

Pixels can be drawn using a function that blends the incoming (source) values with the values that are already in the color buffer (the destination values). Use glEnable and glDisable with argument GL_BLEND to enable and disable blending. Blending is initially disabled.

glBlendFunc defines the operation of blending when it is enabled. sfactor specifies which of nine methods is used to scale the source color components. dfactor specifies which of eight methods is used to scale the destination color components. The eleven possible methods are described in the following table. Each method defines four scale factors, one each for red, green, blue, and alpha.

The Vetex color

Texel color

Model-View Matrix

Model space: the coordinate system within which we define the positions of our model’s verticles

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,

glScale produces a nonuniform scaling along the x, y, and z axes. The three parameters indicate the desired scale factor along each of the three axes.

angle

Specifies the angle of rotation, in degrees.

x, y, z

Specify the x, y, and z coordinates of a vector, respectively.

Performance

:FPS

 

阅读(1202) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~