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

查看:86
本文介绍了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的良好介绍,请查看以下

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天全站免登陆