Saving OpenGL (GLKView) as overlay to video pixelbuffer in iOS

234 views Asked by At

I have a GLKView that presents movable model with texture on it. And I need to blend it into same-time-captured video.

To blend other part of UI in to the video I use GPUImage framework. So, when I tried the same approach with GLKView - use GPUImageUIElement to blend GLKView in to video. And I got error GL ERROR: 0x0502 in line:

glDrawElements(GL_TRIANGLES, sizeof(shapeTriangles)/sizeof(shapeTriangles[0]), GL_UNSIGNED_BYTE, 0);

in my CADisplayLink target procedure:

- (void)render:(CADisplayLink*)displayLink 
{    
    glClear(GL_COLOR_BUFFER_BIT);

    glBufferData(GL_ARRAY_BUFFER, sizeShapeVertices, NULL, GL_DYNAMIC_DRAW);
    glBufferSubData(GL_ARRAY_BUFFER, 0, sizeShapeVertices, shapeVertices);

    [_baseEffect prepareToDraw];

    glDrawElements(GL_TRIANGLES, sizeof(shapeTriangles)/sizeof(shapeTriangles[0]), GL_UNSIGNED_BYTE, 0);

    [_context presentRenderbuffer:GL_RENDERBUFFER];
}

, where

GLubyte faceShapeTriangles[] = {....}

If I'm on the right way - please help me understand what I missed. If I'm completely wrong - help me to do it right way.

Thanks.

0

There are 0 answers