diff options
author | alokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-29 16:41:46 +0000 |
---|---|---|
committer | alokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-29 16:41:46 +0000 |
commit | 50eea3459c15cd8f38f1a0f91cb75e43a35fbfb3 (patch) | |
tree | 460514726c6608ce04edb92464c0a5e96c5fbe0f /third_party/gles2_book/Chapter_11 | |
parent | 18590f24c69ded8500cf6970b4071654cdb22db4 (diff) | |
download | chromium_src-50eea3459c15cd8f38f1a0f91cb75e43a35fbfb3.zip chromium_src-50eea3459c15cd8f38f1a0f91cb75e43a35fbfb3.tar.gz chromium_src-50eea3459c15cd8f38f1a0f91cb75e43a35fbfb3.tar.bz2 |
Fixed Stencil test.
- It was using a depth value greated than depth clear value.
- Color for one of the quads was completely transparent, making it invisible when composited on a webpage.
- Removed redundant glGetIntegerv calls from draw loop.
Review URL: http://codereview.chromium.org/7530011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94688 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/gles2_book/Chapter_11')
-rw-r--r-- | third_party/gles2_book/Chapter_11/Stencil_Test/Stencil_Test.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/third_party/gles2_book/Chapter_11/Stencil_Test/Stencil_Test.c b/third_party/gles2_book/Chapter_11/Stencil_Test/Stencil_Test.c index 696fe25..1f6d91e 100644 --- a/third_party/gles2_book/Chapter_11/Stencil_Test/Stencil_Test.c +++ b/third_party/gles2_book/Chapter_11/Stencil_Test/Stencil_Test.c @@ -42,10 +42,10 @@ int stInit ( ESContext *esContext ) -0.25f, 0.25f, 0.50f, -0.25f, 0.75f, 0.50f, -0.75f, 0.75f, 0.50f, - 0.25f, 0.25f, 0.90f, // Quad #1 - 0.75f, 0.25f, 0.90f, - 0.75f, 0.75f, 0.90f, - 0.25f, 0.75f, 0.90f, + 0.25f, 0.25f, 0.50f, // Quad #1 + 0.75f, 0.25f, 0.50f, + 0.75f, 0.75f, 0.50f, + 0.25f, 0.75f, 0.50f, -0.75f, -0.75f, 0.50f, // Quad #2 -0.25f, -0.75f, 0.50f, -0.25f, -0.25f, 0.50f, @@ -118,16 +118,14 @@ void stDraw ( ESContext *esContext ) { 1.0f, 0.0f, 0.0f, 1.0f }, { 0.0f, 1.0f, 0.0f, 1.0f }, { 0.0f, 0.0f, 1.0f, 1.0f }, - { 1.0f, 1.0f, 0.0f, 0.0f } + { 1.0f, 1.0f, 0.0f, 1.0f } }; - GLint numStencilBits = 0; GLuint stencilValues[NumTests] = { 0x7, // Result of test 0 0x0, // Result of test 1 0x2, // Result of test 2 - 0xff // Result of test 3. We need to fill this - // value in a run-time + 0xfe // Result of test 3 }; // Set the viewport @@ -214,14 +212,6 @@ void stDraw ( ESContext *esContext ) glStencilOp( GL_INVERT, GL_KEEP, GL_KEEP ); offset += 6; glDrawElements( GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, offset ); - - // Since we don't know at compile time how many stecil bits are present, - // we'll query, and update the value correct value in the - // stencilValues arrays for the fourth tests. We'll use this value - // later in rendering. - glGetIntegerv( GL_STENCIL_BITS, &numStencilBits ); - - stencilValues[3] = ~(((1 << numStencilBits) - 1) & 0x1) & 0xff; // Use the stencil buffer for controlling where rendering will // occur. We diable writing to the stencil buffer so we |