简体   繁体   中英

FrameBuffer size in libgdx

I want to use Framebuffer s in my little libgdx game.

The game uses scene2d and I modify the Stage s camera to use a viewport of 50 width and 31 height. Then I set the SpriteBatch 's projection matrix to camera.combined . Doing this I have a resolution independent game and I can use my own "WorldUnit" instead of using pixels.

But now, if I create a FrameBuffer , I have to give it a size. Do i have to give it the size of the cameras viewport or the size of the screen in pixels?

And, when I render things to that FrameBuffer , can I render them in WorldUnits , meaning rendering at P(25,16) is almost in the middle of the game window?

Thanks

Its the height and width of the frame which should be buffed. So it should be the viewport height and width if you dont do something fanzy with it. (Same as at the Stage for example)

Just do mention dont forget to add the setSize of the FBO to the resize method of your Scene2D.

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.

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