Render Scene to Texture - Questions/Possibility

Started by Jamiro, January 20, 2018, 05:56:36 PM

Previous topic - Next topic

Jamiro

Hello once again,

I've read about this particular possibility and I've tried it in the past but without any success. So I' will try it again this time until it works, so, my render loop is defined this way:


   while(run){
      //-- START RENDER WORLD --//
      BUFFER.clear(back_Color);
      BUFFER.setPaintListenerState(false);
     
      *1*
     
      WORLD.renderScene(BUFFER);
      WORLD.draw(BUFFER);
      //-- END RENDER WORLD --//
     
      draw2DElements(BLIT_OBJECTS, BUFFER);
     
      *2*
     
      BUFFER.setPaintListenerState(true);
      BUFFER.update();
      BUFFER.displayGLOnly();
      canvas.repaint();
     
      *3*
     
      Thread.sleep(delay);
   }


So my questions are these:


       
  • Can I use the same FrameBuffer to render the scene to the canvas and to a texture? If so, how? and where? at position 1, 2 or 3 in the code or other?


  • Can I use different FrameBuffers to render to texture as well? if so, what you suggest is better, using the same world or one world per framebuffer?


  • If I want to change this texture on the go, what is the best technique to do so, and the fastest way? using shaders ou can it be done by AWT graphics way?


  • And lastly, can I render it to a bitmap or any other image format in order to be saved as a file?


regards,
Jamiro

EgonOlsen

I'll jump straight to your question: