diff options
| author | 2011-12-12 16:49:40 -0800 | |
|---|---|---|
| committer | 2011-12-12 16:49:40 -0800 | |
| commit | ebb2c6b36da049b32c1dba6f14f16660d860eb09 (patch) | |
| tree | 80805a5077913b048dbcc1ccfedfdde6605e989f /libs/hwui/OpenGLRenderer.cpp | |
| parent | c1761e7fe10390d90b805f373b51ecaabf214dac (diff) | |
| parent | 3e263fac8c9c0e0fb242186b514a7af8efb40961 (diff) | |
Merge "Keep shaders to render properly"
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(); |