且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

绘制到OpenGL ES帧缓冲区并在iPhone上从中获取UIImage

更新时间:2023-11-18 09:36:16

第一个问题是我正在为OpenGL ES 2.0创建EAGLContext,但是功能我使用的是OpenGL ES 1.1。解决方案是将常量设置为kEAGLRenderingAPIOpenGLES1

the first problem is that I was creating EAGLContext for OpenGL ES 2.0, but functions which I used were for OpenGL ES 1.1. The solution is to set constant to kEAGLRenderingAPIOpenGLES1

第二个 - 我没有设置模型和投影基质(如果我使用1.1)

the second - I did not set model and projection matricies (if I use 1.1)

glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrthof(-1.0f, 1.0f, -1.5f, 1.5f, -1.0f, 1.0f);
glMatrixMode(GL_MODELVIEW);

此后全部有效)