diff options
author | 2011-12-12 16:47:48 -0800 | |
---|---|---|
committer | 2011-12-12 16:47:48 -0800 | |
commit | 3e263fac8c9c0e0fb242186b514a7af8efb40961 (patch) | |
tree | c4333a2489886c933172a5cd271c8bda0796324a /libs/hwui/OpenGLRenderer.cpp | |
parent | 6752d0ab029a185a42e34e7a933b669e6ed19e89 (diff) |
Keep shaders to render properly
I don't know who's to blame, SGX or Tegra2 but one of those two GPUs is not
following the OpenGL ES 2.0 spec.
Change-Id: I2624e0efbc9c57d571c55c8b440a5e43f08a54f2
Diffstat (limited to 'libs/hwui/OpenGLRenderer.cpp')
-rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index 1d7b99dfc81e..fa17aad1b8b6 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -133,8 +133,6 @@ OpenGLRenderer::~OpenGLRenderer() { /////////////////////////////////////////////////////////////////////////////// void OpenGLRenderer::setViewport(int width, int height) { - glDisable(GL_DITHER); - glViewport(0, 0, width, height); mOrthoMatrix.loadOrtho(0, width, height, 0, -1, 1); mWidth = width; @@ -144,6 +142,13 @@ void OpenGLRenderer::setViewport(int width, int height) { mFirstSnapshot->viewport.set(0, 0, width, height); mDirtyClip = false; + + glDisable(GL_DITHER); + glViewport(0, 0, width, height); + + glClearColor(0.0f, 0.0f, 0.0f, 0.0f); + + glEnableVertexAttribArray(Program::kBindingPosition); } void OpenGLRenderer::prepare(bool opaque) { @@ -159,14 +164,11 @@ void OpenGLRenderer::prepareDirty(float left, float top, float right, float bott mSaveCount = 1; - glViewport(0, 0, mWidth, mHeight); - glEnable(GL_SCISSOR_TEST); glScissor(left, mSnapshot->height - bottom, right - left, bottom - top); mSnapshot->setClip(left, top, right, bottom); if (!opaque) { - glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClear(GL_COLOR_BUFFER_BIT); } } @@ -207,6 +209,8 @@ void OpenGLRenderer::resume() { glViewport(0, 0, snapshot->viewport.getWidth(), snapshot->viewport.getHeight()); + glClearColor(0.0f, 0.0f, 0.0f, 0.0f); + glEnable(GL_SCISSOR_TEST); dirtyClip(); @@ -215,6 +219,8 @@ void OpenGLRenderer::resume() { glBindFramebuffer(GL_FRAMEBUFFER, snapshot->fbo); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + glEnableVertexAttribArray(Program::kBindingPosition); + mCaches.blend = true; glEnable(GL_BLEND); glBlendFunc(mCaches.lastSrcMode, mCaches.lastDstMode); @@ -556,7 +562,6 @@ bool OpenGLRenderer::createFboLayer(Layer* layer, Rect& bounds, sp<Snapshot> sna // Clear the FBO, expand the clear region by 1 to get nice bilinear filtering glScissor(clip.left - 1.0f, bounds.getHeight() - clip.bottom - 1.0f, clip.getWidth() + 2.0f, clip.getHeight() + 2.0f); - glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClear(GL_COLOR_BUFFER_BIT); dirtyClip(); |