1

Topic: To intercept OpenGl ES2

I work with the large-scale project which it is strong hands better not to touch. In the code is OpenGL a cycle  schedules on the screen. The drawing consists of several logical parts void OnDrawLoop () {//setup transformations//setup shaders DoDraw1 ();//setup transformations//setup shaders DoDraw2 ();} It is adjusted so that this code draws the image in  . And it is necessary to me that DoDraw1 () drew the content on mine OES a texture (which I  in other place as video), and this insertion did not affect operation DoDraw2 () I at first tried to change : void CreateVideoFbo () {gl_-> GenFramebuffers (1, &video_fbo); gl_-> BindFramebuffer (GL_FRAMEBUFFER, video_fbo); if (video_texture == 0) {gl_-> GenTextures (1, &video_texture); gl_-> BindTexture (GL_TEXTURE_2D, video_texture); gl_-> TexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, video_w, video_h, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); gl_-> TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); gl_-> TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); gl_-> BindTexture (GL_TEXTURE_2D, 0);} } void GLRenderer:: ReplaceVideoFbo () {gl_-> BindFramebuffer (GL_FRAMEBUFFER, video_fbo); gl_-> FramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, video_texture, 0);} void OnDrawLoop () {//setup transformations//setup shaders ReplaceVideoFbo (); DoDraw1 (); BindFramebuffer (GL_FRAMEBUFFER, 0); DoDraw2 ();} Thus it turns out that DoDraw1 () really drew the image in mine , and remaining functions were not affected. I can take this image as pixels int bufferSize = video_w * video_h * sizeof (GLubyte) * 4; if (video_pixels == NULL) video_pixels = (GLubyte *) malloc (bufferSize); ReadPixels (0, 0, video_w, video_h, GL_RGBA, GL_UNSIGNED_BYTE, video_pixels); But it works too slowly and thus I receive the big black rectangle in which small part drawing DoDraw1 was deduced () OES a texture not  in created  As though to force DoDraw1 () to draw on OES a texture? Special experience at me is not present, therefore I do not know from what end to begin