Guest User

Untitled

a guest
Sep 13th, 2014
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.94 KB | None | 0 0
  1. public PerspectiveCamera cam = new PerspectiveCamera(80, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
  2. public FrameBuffer FBO;
  3. public TextureRegion fboRegion;
  4. public ModelBatch modelBatch;
  5. public SpriteBatch spriteBatch;
  6.  
  7. create(){
  8.     FBO = new FrameBuffer(Format.RGBA4444,Gdx.graphics.getWidth(),Gdx.graphics.getHeight(),false);
  9.     fboRegion = new TextureRegion(FBO.getColorBufferTexture());
  10.     fboRegion.flip(false, true);
  11. }
  12.  
  13. render(){
  14. gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
  15. gl.glClearColor(0, 0.5f, 0.9f, 1);
  16. gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
  17.  
  18. cam.update();
  19.  
  20.     FBO.begin();
  21.     modelBatch.begin(cam);
  22.         modelBatch.render(modelInstance1, environment);
  23.         modelBatch.render(modelInstance2, environment);
  24.     modelBatch.end();
  25.     FBO.end();
  26.  
  27.     spriteBatch.begin();
  28.         fboRegion.setTexture(FBO.getColorBufferTexture());
  29.         spriteBatch.draw(fboRegion, 0, 0);
  30.     spriteBatch.end();
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment