summaryrefslogtreecommitdiffstats
path: root/o3d/core
diff options
context:
space:
mode:
authorpetersont@chromium.org <petersont@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-17 21:07:42 +0000
committerpetersont@chromium.org <petersont@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-17 21:07:42 +0000
commit02127f8772c83c5e53f66a9ad8267d4b343f8007 (patch)
tree7e0b7f110cbda919f66b39f7cdfe5be02f1143f3 /o3d/core
parentd569a16535e85b517ff49138d0dd77d6fc6420c7 (diff)
downloadchromium_src-02127f8772c83c5e53f66a9ad8267d4b343f8007.zip
chromium_src-02127f8772c83c5e53f66a9ad8267d4b343f8007.tar.gz
chromium_src-02127f8772c83c5e53f66a9ad8267d4b343f8007.tar.bz2
Added a new sample which implements basic shadow mapping.
Review URL: http://codereview.chromium.org/155401 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21000 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/core')
-rw-r--r--o3d/core/cross/gl/renderer_gl.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/o3d/core/cross/gl/renderer_gl.cc b/o3d/core/cross/gl/renderer_gl.cc
index 8638607..dbd34fd 100644
--- a/o3d/core/cross/gl/renderer_gl.cc
+++ b/o3d/core/cross/gl/renderer_gl.cc
@@ -1567,6 +1567,11 @@ bool RendererGL::SaveScreen(const String& file_name) {
MakeCurrentLazy();
Bitmap::Ref bitmap = Bitmap::Ref(new Bitmap(service_locator()));
bitmap->Allocate(Texture::ARGB8, width(), height(), 1, false);
+
+ // Note: glReadPixels captures the alpha component of the frame buffer as well
+ // as the color components, the browser usually ignores the alpha channel when
+ // drawing to the screen, so unless the alpha is 1, the png image generated
+ // might exhibit suprise translucency.
::glReadPixels(0, 0, width(), height(), GL_BGRA, GL_UNSIGNED_BYTE,
bitmap->image_data());
bool result = bitmap->SaveToPNGFile((file_name + ".png").c_str());