0

I have been using everyplay SDK for recording my project's gameplay(ios-opengles 2.0). its working well. But if i use RenderToTexture (for shadows) it just records blank screen. How can i overcome this problem ?

For shadows i need to have multiple render pass that shifts rendertarget . is there any other way ?

genpfault
  • 51,148
  • 11
  • 85
  • 139
VivekParamasivam
  • 1,086
  • 2
  • 13
  • 23
  • Yes, it should be possible. I have used shadows in my Unity 3d project and the recording worked fine. Might be something to do with your framebuffers. You should make sure that you call afterPresentRenderbuffer only for the framebuffer which you have defined in createframebuffer. – Pauli Ojanen Oct 21 '13 at 12:50

2 Answers2

1

Try it like this:

while(1) { 
    renderShadow();

    glBindFramebuffer(GL_FRAMEBUFFER, fbo1);

    [everyplayCapture afterPresentRenderbuffer:fbo1];

    glClearColor(0.45f, 0.45f, 0.45f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    ....
    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
    ...

    [everyplayCapture beforePresentRenderbuffer:fbo1];

    [(EAGLView *)self.view presentFramebuffer];
}
Pauli Ojanen
  • 296
  • 2
  • 5
0

ya i'm sure that i'm calling afterPresentRenderbuffer for the framebuffer that i have defined in createframebuffer.As multiple render pass requires binding 2 or more framebuffers for a single pass.

consider that fbo1(framebuffer object) is used for everyplay and fb02 is for shadows, then comes the order of execution per frame without shadows

while(1){ 
    glClearColor(0.45f, 0.45f, 0.45f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    ....
    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
    ...
    [(EAGLView *)self.view presentFramebuffer];
 }

below code order is for rendering with shadows

while(1) { 

    glClearColor(0.45f, 0.45f, 0.45f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    renderShadow();
    glBindFramebuffer(GL_FRAMEBUFFER, fbo1);
    ....
    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
    ...
    [(EAGLView *)self.view presentFramebuffer];
 }

 renderShadow(){
     glBindFramebuffer(GL_FRAMEBUFFER, fbo2);
     ....
     glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
     ....

 }

when i shift the glBindframebuffer with two FBo's , the screen becomes blank and everyplay records the blank screen. If i remove Everyplay's integration the above code for shadows works well. In the example project provided by Everyplay for ios "EveryplayRecord.xcodeproject", if i include the line

glBindFramebuffer(GL_FRAMEBUFFER, defaultFrameBuffer); // in drawRect() method it also renders blank screen.
VivekParamasivam
  • 1,086
  • 2
  • 13
  • 23
  • What if you move the [everyplayCapture beforePresentRenderbuffer:fbo1] after glBindFramebuffer(GL_FRAMEBUFFER, fbo1); in you shadow code example? – Pauli Ojanen Oct 24 '13 at 10:36
  • thanks for your reply. Your suggestion made the changes but not solved the problem completely. After placing glBindFramebuffer(GL_FRAMEBUFFER, fbo1); next to [everyplayCapture beforePresentRenderbuffer:fbo1] line, my game renders well while recording , but displays nothing after clicking "PlayLastRecorded".I think its close to the solution. – VivekParamasivam Oct 26 '13 at 12:43
  • Please try the answer below. The correct placing of afterPresentRenderBuffer and beforePresentRenderbuffer is crucial and in some cases you might need to use the setActiveFramebufferCallback mentioned in Everyplay FAQ. – Pauli Ojanen Nov 05 '13 at 15:36