png - FrameBuffer to file inside libgdx or OpenGL -
i trying take screenshots in efficient way. thing using framebuffer efficient way of taking screenshots because can process data in different thread rendering thread. how can information framebuffer , transfer file?
framebuffer m_fbo; render(){ m_fbo = new framebuffer(format.rgb565, (int)(w * m_fboscaler), (int)(h * m_fboscaler), false); m_fboregion = new textureregion(m_fbo.getcolorbuffertexture()); m_fboregion.flip(false, true); m_fbo.begin(); ...rendering... m_fbo.end(); writetextureregiontofile(); - need lines of code implementation of method }
the framebuffer
contents reside in memory managed opengl, (as far understand things) still need fetch bytes using opengl apis on render thread. specifically, want the screenutils
class byte[]
containing rgba8888
contents of framebuffer
.
once raw bytes, can compression/conversion/output on different thread, of course. there forum post has quick , dirty png writer. libgdx-specific (?) cim
format option (see pixmapio
class), you'll have convert bytes pixmap
first.
Comments
Post a Comment