2
我想以最有效的方式截取屏幕截图。我使用FrameBuffer是截取屏幕最有效的方式,因为我可以在不同于渲染线程的线程中处理数据。 我如何从FrameBuffer获取信息并将其传输到文件?FrameBuffer到libgdx或OpenGL里面的文件
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(); - i need some lines of code for the implementation of this method
}
“仍然需要在渲染线程上使用OpenGL API获取这些字节” - 通过这样做,fps将降低到6.如果这可以在单独的线程中完成将是有用的。 – Lunatikul 2013-06-26 13:09:23
Libgdx(和下面的LWJGL)只允许一个线程执行OpenGL调用,所以没有太多希望从渲染线程中获得它。 – 2013-06-26 16:27:36