简体   繁体   中英

Rajawali RenderTargets

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"

更改rendertarget大小以匹配veiwport

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

Related Question
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM