Drawing into OpenGL ES framebuffer and getting UIImage from it on iPhone

后端 未结 1 756
日久生厌
日久生厌 2021-02-06 18:37

I\'m trying to do offscreen rendering of some primitives in OpenGL ES on iOS. The code is as follows:

// context and neccesary buffers
@interface RendererGL
{
           


        
相关标签:
1条回答
  • 2021-02-06 19:01

    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

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

    after this all works)

    0 讨论(0)
提交回复
热议问题