Based on the last question I have been researching how to run more than one shader in a pass (ie a FBO And texture). This is OpenSpot on the iPhone.
I have created some code that runs, but for only one frame, obviously I am doing something wrong, but I can not find it.
inout data from camera corevideo buffer
Any pointers or fixes are very welcome: ..)
Thanks,
Simon
PS: I've put everything in one method so far - that's all I can focus on doing it!
- (zero) PingPong: (CVImageBufferRef) cameraframe; {Int bufferhite = cvpxbuffergatehite (camoramframe); Int buffer wide = CVPsBufferGetWith (Camoramframe); // First create FBO - it is useless - do not make glume ffofo every time; GlenFramesbuffers (1, and firstfibou); GlobeFramebuffer (GL_framebuffer, FirstFBO); // Create the first texture and copy the video content in it. Glenn Texture (1, and the architecture); Globbdenactation (GL_EditDDD, SorKetext); GlTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); GlTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); GlTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); GltexPamerMarty (GL_EducationEd.D., GL_Whartwor_Wapper, GLCLAMPMOODEGEG); // Create another texture, next test; Glendexture (1, and next cloth); Globinated (GL_TEXTURE_2D, next tweets); GlTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); GlTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); GlTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); GltexPamerMarty (GL_EducationEd.D., GL_Whartwor_Wapper, GLCLAMPMOODEGEG); // attach texture to our first FBO glFramebufferTexture2D to (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, sourcetexture, 0); // draw using BGRA extensions video frame data directly glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, bufferWidth, bufferHeight, 0, GL_BGRA, GL_UNSIGNED_BYTE, CVPixelBufferGetBaseAddress (cameraframe)); // glDrawBuffer (sourcetexture); GlEnable (GL_TEXTURE_2D); GlViewport (0, 0, backingwidth, backinghit); Globbdenactation (GL_EditDDD, SorKetext); GlUseProgram (greyscaleProgram); // now 2 have access sourcetexture as input glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, nextTexture, 0); Globinated (GL_TEXTURE_2D, next tweets); GlUseProgram (program); Submit the framebuffer for // render buffer [EAGLContext setCurrentContext: reference]; Glubinderrender buffer (GL-e-writer, watchmanbuster); [Reference presenter buffer: GL_RENDERBUFFER]; // Clean the content; GlDeleteTextures (1, and sourcetexture); GlDeleteTextures (1, and next cloth); }
Your draws where code? Drawing What runs from the execution of the shader, and your code as I see it, there is still zero draw call (glDrawArrays, glDrawElements, etc.), so it is not working because you are not drawing.
Draw a full screen tractor to pass each and speed the shader execution and it will work.
It is also recommended to use glCheckFramebufferStatus to check that your FBO configuration is supported and your GL implementation will work.
Comments
Post a Comment