OpenGL ES 中 GLU 做矩阵转换的资料

2024-01-08 21:48
文章标签 es 转换 矩阵 资料 opengl glu

本文主要是介绍OpenGL ES 中 GLU 做矩阵转换的资料,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

OpenGL ES 中 GLU 做矩阵转换的资料

太阳火神的美丽人生 (http://blog.csdn.net/opengl_es)

本文遵循“署名-非商业用途-保持一致”创作公用协议

转载请保留此句:太阳火神的美丽人生 -  本博客专注于 敏捷开发及移动和物联设备研究:iOS、Android、Html5、Arduino、pcDuino否则,出自本博客的文章拒绝转载或再转载,谢谢合作。



还是有空再翻译,这些只是用过的知识备忘,其实我只是明白了之后,才找到了这些资料,没弄明白的时侯,并不知道这些资料这么有用。

也许用不了多久,记忆就会消退,当再次需要的时侯,耤由这些点滴的资料,便可唤起曾经的回忆,苦难总是在过去之后,便成为最美好的记忆。


摘自:开放图形库图形系统工具库(1.3版)The OpenGL Graphics System Utility Library (Version 1.3)

第 4 章 矩阵转换
Chapter 4 Matrix Manipulation


        GLU 库包含对矩阵创建和坐标投影(转换)的支持。矩阵函数创建矩阵并给当前的 OpenGL 矩阵乘以这个结果。他们用于设置投影和视图参数。

坐标投影函数用于将对象空间坐标转换到屏幕坐标或者反之亦然。这使得确定一个对象在窗口的哪里进行绘制成为可能。

The GLU library includes support for matrix creation and coordinate pro-jection (transformation). The matrix routines create matrices and multiply

the current OpenGL matrix by the result. They are used for setting projec-tion and viewing parameters. The coordinate projection routines are used

to transform object space coordinates into screen coordinates or vice-versa.This makes it possible to determine where in the window an object is being

drawn.


4.1 矩阵设置
4.1 Matrix Setup

以下函数创建投影和视图矩阵,并使用 glMultMatrix 把它们应用到当前的矩阵。使用这些函数,用户可以构建一个裁剪体积并设置一个视图参数秋渲染屏幕。

gluOrtho2D 和 gluPerspective 构建常规需要的投影矩阵。

void gluOrtho2D( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top );

设置一个二维的正交视图区域。参数确定了可视区域的边界框。

调用 gluOrtho2D(left, right, bottom, top) 等于调用 glOrtho(left, right, bottom, top, 1, 1) 。

The following routines create projection and viewing matrices and apply

them to the current matrix using glMultMatrix. With these routines, a

user can construct a clipping volume and set viewing parameters to render

a scene.

gluOrtho2D and gluPerspective build commonly-needed projection

matrices.

void gluOrtho2D( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top );

sets up a two dimensional orthographic viewing region. The pa-

rameters dene the bounding box of the region to be viewed. Call-

ing gluOrtho2D(left, right, bottom, top) is equivalent to calling

glOrtho(left, right, bottom, top, 1, 1).

void gluPerspective( GLdouble fovy, GLdouble aspect, GLdouble near, GLdouble far );


sets up a perspective viewing volume. fovy denes the eld-of-view angle

(in degrees) in the y direction. aspect is the aspect ratio used to determine

the eld-of-view in the x direction. It is the ratio of x (width) to y (height).

near and far dene the near and far clipping planes (as positive distances

from the eye point).

gluLookAt creates a commonly-used viewing matrix:

void gluLookAt( GLdouble eyex, GLdouble eyey,

GLdouble eyez, GLdouble centerx, GLdouble centery,

GLdouble centerz, GLdouble upx, GLdouble upy,

GLdouble upz );

The viewing matrix created is based on an eye point (eyex,eyey,eyez),

a reference point that represents the center of the scene (cen-

terx,centery,centerz), and an up vector (upx,upy,upz). The matrix is de-

signed to map the center of the scene to the negative Z axis, so that when

a typical projection matrix is used, the center of the scene will map to the

center of the viewport. Similarly, the projection of the up vector on the

viewing plane is mapped to the positive Y axis so that it will point upward

in the viewport. The up vector must not be parallel to the line-of-sight from

the eye to the center of the scene.

gluPickMatrix is designed to simplify selection by creating a matrix

that restricts drawing to a small region of the viewport. This is typically used

to determine which objects are being drawn near the cursor. First restrict

drawing to a small region around the cursor, then rerender the scene with

selection mode turned on. All objects that were being drawn near the cursor

will be selected and stored in the selection buer.

void gluPickMatrix( GLdouble x, GLdouble y,

GLdouble deltax, GLdouble deltay,

const GLint viewport[4] );

gluPickMatrix should be called just before applying a projection ma-

trix to the stack (eectively pre-multiplying the projection matrix by the

selection matrix). x and y specify the center of the selection bounding

box in pixel coordinates; deltax and deltay specify its width and height

in pixels. viewport should specify the current viewport's x, y, width, and

height. A convenient way to obtain this information is to call glGetInte-

gerv(GL VIEWPORT, viewport).


4.2 Coordinate Projection

Two routines are provided to project coordinates back and forth from ob-

ject space to screen space. gluProject projects from object space to screen

space, and gluUnProject does the reverse. gluUnProject4 should be

used instead of gluUnProject when a nonstandard glDepthRange is in

eect, or when a clip-space w coordinate other than 1 needs to be spec-

ied, as for vertices in the OpenGL glFeedbackBuer when data type

GL 4D COLOR TEXTURE is returned.

int gluProject( GLdouble objx, GLdouble objy,

GLdouble objz, const GLdouble modelMatrix[16],

const GLdouble projMatrix[16], const GLint viewport[4],

GLdouble *winx, GLdouble *winy, GLdouble *winz );

gluProject performs the projection with the given modelMatrix, pro-

jectionMatrix, and viewport. The format of these arguments is the same as

if they were obtained from glGetDoublev and glGetIntegerv. A return

value of GL TRUE indicates success, and GL FALSE indicates failure.

int gluUnProject( GLdouble winx, GLdouble winy,

GLdouble winz, const GLdouble modelMatrix[16],

const GLdouble projMatrix[16], const GLint viewport[4],

GLdouble *objx, GLdouble *objy, GLdouble *objz );

gluUnProject uses the given modelMatrix, projectionMatrix, and view-

port to perform the projection. A return value of GL TRUE indicates success,

and GL FALSE indicates failure.

int gluUnProject4( GLdouble winx, GLdouble winy,

GLdouble winz, GLdouble clipw,

const GLdouble modelMatrix[16],

const GLdouble projMatrix[16], const GLint viewport[4],

GLclampd near, GLclampd far, GLdouble *objx,

GLdouble *objy, GLdouble *objz, GLdouble *objw );

gluUnProject4 takes three additional parameters and returns one ad-

ditional parameter clipw is the clip-space w coordinate of the screen-space

vertex (e.g. the wc value computed by OpenGL); normally, clipw = 1. near

and far correspond to the current glDepthRange; normally, near = 0 and

far = 1. The object-space w value of the unprojected vertex is returned in

objw. Other parameters are the same as for gluUnProject.


这篇关于OpenGL ES 中 GLU 做矩阵转换的资料的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/584929

相关文章

hdu 4565 推倒公式+矩阵快速幂

题意 求下式的值: Sn=⌈ (a+b√)n⌉%m S_n = \lceil\ (a + \sqrt{b}) ^ n \rceil\% m 其中: 0<a,m<215 0< a, m < 2^{15} 0<b,n<231 0 < b, n < 2^{31} (a−1)2<b<a2 (a-1)^2< b < a^2 解析 令: An=(a+b√)n A_n = (a +

hdu 6198 dfs枚举找规律+矩阵乘法

number number number Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Problem Description We define a sequence  F : ⋅   F0=0,F1=1 ; ⋅   Fn=Fn

PDF 软件如何帮助您编辑、转换和保护文件。

如何找到最好的 PDF 编辑器。 无论您是在为您的企业寻找更高效的 PDF 解决方案,还是尝试组织和编辑主文档,PDF 编辑器都可以在一个地方提供您需要的所有工具。市面上有很多 PDF 编辑器 — 在决定哪个最适合您时,请考虑这些因素。 1. 确定您的 PDF 文档软件需求。 不同的 PDF 文档软件程序可以具有不同的功能,因此在决定哪个是最适合您的 PDF 软件之前,请花点时间评估您的

C# double[] 和Matlab数组MWArray[]转换

C# double[] 转换成MWArray[], 直接赋值就行             MWNumericArray[] ma = new MWNumericArray[4];             double[] dT = new double[] { 0 };             double[] dT1 = new double[] { 0,2 };

ElasticSearch的DSL查询⑤(ES数据聚合、DSL语法数据聚合、RestClient数据聚合)

目录 一、数据聚合 1.1 DSL实现聚合 1.1.1 Bucket聚合  1.1.2 带条件聚合 1.1.3 Metric聚合 1.1.4 总结 2.1 RestClient实现聚合 2.1.1 Bucket聚合 2.1.2 带条件聚合 2.2.3 Metric聚合 一、数据聚合 聚合(aggregations)可以让我们极其方便的实现对数据的统计、分析、运算。例如:

数据流与Bitmap之间相互转换

把获得的数据流转换成一副图片(Bitmap) 其原理就是把获得倒的数据流序列化到内存中,然后经过加工,在把数据从内存中反序列化出来就行了。 难点就是在如何实现加工。因为Bitmap有一个专有的格式,我们常称这个格式为数据头。加工的过程就是要把这个数据头与我们之前获得的数据流合并起来。(也就是要把这个头加入到我们之前获得的数据流的前面)      那么这个头是

线性代数|机器学习-P35距离矩阵和普鲁克问题

文章目录 1. 距离矩阵2. 正交普鲁克问题3. 实例说明 1. 距离矩阵 假设有三个点 x 1 , x 2 , x 3 x_1,x_2,x_3 x1​,x2​,x3​,三个点距离如下: ∣ ∣ x 1 − x 2 ∣ ∣ 2 = 1 , ∣ ∣ x 2 − x 3 ∣ ∣ 2 = 1 , ∣ ∣ x 1 − x 3 ∣ ∣ 2 = 6 \begin{equation} ||x

OPENGL顶点数组, glDrawArrays,glDrawElements

顶点数组, glDrawArrays,glDrawElements  前两天接触OpenGL ES的时候发现里面没有了熟悉的glBegin(), glEnd(),glVertex3f()函数,取而代之的是glDrawArrays()。有问题问google,终于找到答案:因为OpenGL ES是针对嵌入式设备这些对性能要求比较高的平台,因此把很多影响性能的函数都去掉了,上述的几个函数都被移除了。接

OpenGL ES学习总结:基础知识简介

什么是OpenGL ES? OpenGL ES (为OpenGL for Embedded System的缩写) 为适用于嵌入式系统的一个免费二维和三维图形库。 为桌面版本OpenGL 的一个子集。 OpenGL ES管道(Pipeline) OpenGL ES 1.x 的工序是固定的,称为Fix-Function Pipeline,可以想象一个带有很多控制开关的机器,尽管加工

OpenGL雾(fog)

使用fog步骤: 1. enable. glEnable(GL_FOG); // 使用雾气 2. 设置雾气颜色。glFogfv(GL_FOG_COLOR, fogColor); 3. 设置雾气的模式. glFogi(GL_FOG_MODE, GL_EXP); // 还可以选择GL_EXP2或GL_LINEAR 4. 设置雾的密度. glFogf(GL_FOG_DENSITY, 0