OpenGL ES 2.0 和 glPushMatrix、glPopMatrix [英] OpenGL ES 2.0 and glPushMatrix, glPopMatrix

查看:26
本文介绍了OpenGL ES 2.0 和 glPushMatrix、glPopMatrix的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

OpenGL ES 2.0 是否仍然支持 glPushMatrix 和 glPopMatrix?我目前通过以下方式使用它们:

Does OpenGL ES 2.0 still support glPushMatrix and glPopMatrix? I'm currently using these in the following way:

glPushMatrix();
glTranslatef(xLoc, yLoc, 0);
[myTexturePointer drawAtPoint:CGPointZero];
glPopMatrix();

我之所以问,是因为我已经阅读了一些关于 2.0从规范中删除矩阵堆栈"的内容.由于我对 OpenGL 比较陌生,我不确定在哪里可以找到明确的答案.

I'm asking because I've read a few things about 2.0 "removing the matrix stack from the spec". Since I'm relatively new to OpenGL I'm not sure where to find a definitive answer.

推荐答案

不,OpenGL ES 2.0 使用可编程管道而不是早期版本中的固定功能管道.您不能使用立即模式命令(glVertex、glNormal 等)或矩阵堆栈.您应该实现自己的矩阵堆栈数据结构(无论如何这是更可取的,因为固定函数矩阵堆栈具有依赖于实现的深度)并将当前矩阵发送到着色器程序.

Nope, OpenGL ES 2.0 uses a programmable pipeline instead of the fixed function pipeline found in earlier versions. You can't use immediate mode commands (glVertex, glNormal, etc) or the matrix stack. You should implement your own matrix stack data structure instead (which is preferable anyway because the fixed function matrix stack had implementation dependent depth) and send the current matrix to shader programs.

要了解现代 OpenGL,请查看这些 Durian Software 的教程.它们基于 OpenGL 2.0,但概念将直接映射到 ES 2.0 规范.

For a good introduction to modern OpenGL check out these tutorials from Durian Software. They are based on OpenGL 2.0 but the concepts will map directly to the ES 2.0 spec.

这篇关于OpenGL ES 2.0 和 glPushMatrix、glPopMatrix的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆