Main repository of MikuMikuStudio
Revision | 07a0ef14e6171c9f1a50026dd26e9cf364e38a50 (tree) |
---|---|
Zeit | 2014-02-19 14:40:56 |
Autor | kobayasi <kobayasi@pscn...> |
Commiter | kobayasi |
Support setFrameBuffer and depth texture on iOS
@@ -103,7 +103,7 @@ public final class GdxRenderer implements Renderer { | ||
103 | 103 | private boolean verboseLogging = false; |
104 | 104 | private boolean useVBO = true; |
105 | 105 | public boolean adreno_finish_bug = false; |
106 | - | |
106 | + private int mainFrameBuffer = -1; | |
107 | 107 | public GdxRenderer() { |
108 | 108 | } |
109 | 109 |
@@ -411,6 +411,12 @@ public final class GdxRenderer implements Renderer { | ||
411 | 411 | adreno_finish_bug = true; |
412 | 412 | } |
413 | 413 | logger.log(Level.INFO, "Caps: {0}", caps); |
414 | + | |
415 | + // Get main framebuffer id because main framebuffer is not 0 on iOS. | |
416 | + if (mainFrameBuffer == -1) { | |
417 | + Gdx.gl20.glGetIntegerv(GL20.GL_FRAMEBUFFER_BINDING, intBuf16); | |
418 | + mainFrameBuffer = intBuf16.get(0); | |
419 | + } | |
414 | 420 | } |
415 | 421 | |
416 | 422 | /** |
@@ -1712,13 +1718,13 @@ public final class GdxRenderer implements Renderer { | ||
1712 | 1718 | |
1713 | 1719 | if (fb == null) { |
1714 | 1720 | // unbind any fbos |
1715 | - if (context.boundFBO != 0) { | |
1716 | - Gdx.gl20.glBindFramebuffer(GL20.GL_FRAMEBUFFER, 0); | |
1721 | + if (context.boundFBO != mainFrameBuffer) { | |
1722 | + Gdx.gl20.glBindFramebuffer(GL20.GL_FRAMEBUFFER, mainFrameBuffer); | |
1717 | 1723 | // RendererUtil.checkGLError(); |
1718 | 1724 | |
1719 | 1725 | statistics.onFrameBufferUse(null, true); |
1720 | 1726 | |
1721 | - context.boundFBO = 0; | |
1727 | + context.boundFBO = mainFrameBuffer; | |
1722 | 1728 | } |
1723 | 1729 | |
1724 | 1730 | /* |
@@ -406,13 +406,13 @@ public class TextureUtilGdx { | ||
406 | 406 | format = GL20.GL_COMPRESSED_TEXTURE_FORMATS; |
407 | 407 | dataType = GL20.GL_UNSIGNED_BYTE; |
408 | 408 | case Depth: |
409 | - format = GL20.GL_DEPTH_COMPONENT; | |
410 | - dataType = GL20.GL_UNSIGNED_BYTE; | |
411 | - break; | |
409 | +// format = GL20.GL_DEPTH_COMPONENT; | |
410 | +// dataType = GL20.GL_UNSIGNED_BYTE; | |
411 | +// break; | |
412 | 412 | case Depth16: |
413 | 413 | format = GL20.GL_DEPTH_COMPONENT; |
414 | - internalFormat = GL20.GL_DEPTH_COMPONENT16; | |
415 | - dataType = GL20.GL_UNSIGNED_BYTE; | |
414 | + internalFormat = GL20.GL_DEPTH_COMPONENT; | |
415 | + dataType = GL20.GL_UNSIGNED_SHORT; | |
416 | 416 | break; |
417 | 417 | case Depth24: |
418 | 418 | case Depth32: |