0

Hi i am trying to figure out how the renderTargets are working in rajawali.

RajawaliVuforiaSideBySideRenderer.java is the only module that uses them.

Also the content is not 1:1 applicable to Rajawali Renderer. What i tryed so far is the following.

I created 2 scenes.

I created 3 RenderTargets.

.. the main code :

scene1(); // creating Scene1 
scene2(); // creating Scene2

addScene(sc1); adding created scenes to renderer
addScene(sc2);

r1 = new RenderTarget(512, 512);
r2 = new RenderTarget(512, 512);
r3 = getRenderTarget();

addRenderTarget(r1);
addRenderTarget(r2);

plane = new Plane(10,10,1,1);
Material planeMat = new Material();
plane.setRotX(180);
plane.setRotZ(180);
plane.setPosition(0,0,-5);

try{
planeMat.addTexture(r1.getTexture());
planeMat.setColorInfluence(0);
plane.setMaterial(planeMat);

}catch(TextureException t){
    t.printStackTrace();
}

addChild(plane);
mUserScene = getCurrentScene();

}

protected void onRender(double deltaTime) {

    switchScene(sc1);
    setRenderTarget(r1);
    render(deltaTime);

    switchScene(sc2);
    setRenderTarget(r2);
    render(deltaTime);

    setRenderTarget(r3);
    switchScene(mUserScene);
    render(deltaTime);

};

This was only a guess how it could work but the application crashes with

GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: returned if the framebuffer does not have at least one image attached to it.

I am still a beginner on the subject and sadly there aren't any tutorials on how to use renderTargets.

I would use PostProcessingEffects if i know how to use them.

I try to acomplish to add shaders to whole Scenes. So i thought : "Render to Texture and add Shadereffects"

TommyX
  • 331
  • 2
  • 7

1 Answers1

-3

Change rendertarget size to match veiwport

Ignat
  • 1