OpenGL ES 2.0 and glPushMatrix, glPopMatrix

て烟熏妆下的殇ゞ 提交于 2019-12-17 15:44:38

问题


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();

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.


回答1:


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.

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.



来源:https://stackoverflow.com/questions/2918232/opengl-es-2-0-and-glpushmatrix-glpopmatrix

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!