Author Topic: Render Scene to Texture - Questions/Possibility  (Read 417 times)

Offline Jamiro

  • byte
  • *
  • Posts: 36
    • View Profile
Render Scene to Texture - Questions/Possibility
« on: January 20, 2018, 05:56:36 pm »
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:

Code: [Select]
   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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11913
    • View Profile
    • http://www.jpct.net
Re: Render Scene to Texture - Questions/Possibility
« Reply #1 on: January 21, 2018, 05:22:14 pm »
I'll jump straight to your question:



Offline Jamiro

  • byte
  • *
  • Posts: 36
    • View Profile
Re: Render Scene to Texture - Questions/Possibility
« Reply #2 on: January 21, 2018, 11:04:11 pm »
Awesome, thanks