diff options
author | kbr@google.com <kbr@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-24 01:52:12 +0000 |
---|---|---|
committer | kbr@google.com <kbr@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-24 01:52:12 +0000 |
commit | 7fb32637bd9968a4c4c9e1d0a08e9b3501b0f7f8 (patch) | |
tree | 38a288386b393778daf3c10f468303a78caa662c /o3d/core | |
parent | 4e95d20901a74570052740441f2ec8290c7d8d77 (diff) | |
download | chromium_src-7fb32637bd9968a4c4c9e1d0a08e9b3501b0f7f8.zip chromium_src-7fb32637bd9968a4c4c9e1d0a08e9b3501b0f7f8.tar.gz chromium_src-7fb32637bd9968a4c4c9e1d0a08e9b3501b0f7f8.tar.bz2 |
Ported the Loop/Blinn shaders in samples/o3djs/gpu2d.js to GLSL to add
antialiasing support. Fixed build problems in GLES2 backend on Mac OS X.
Tested updated gpu2d.js in Cg and GLSL versions of plugin. Note that
multisampling must be turned on in order for the antialiasing to look
good, and in particular O3D's Core Graphics and Core Animation
backends on Mac OS X do not currently support this.
BUG=none
TEST=none
TBR=apatrick,gman
Review URL: http://codereview.chromium.org/2883038
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53564 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/core')
-rw-r--r-- | o3d/core/cross/gles2/renderer_gles2.cc | 16 | ||||
-rw-r--r-- | o3d/core/cross/gles2/renderer_gles2.h | 7 | ||||
-rw-r--r-- | o3d/core/cross/renderer_test.cc | 2 |
3 files changed, 25 insertions, 0 deletions
diff --git a/o3d/core/cross/gles2/renderer_gles2.cc b/o3d/core/cross/gles2/renderer_gles2.cc index 71d5c72..272524d 100644 --- a/o3d/core/cross/gles2/renderer_gles2.cc +++ b/o3d/core/cross/gles2/renderer_gles2.cc @@ -1367,6 +1367,22 @@ void RendererGLES2::UpdateDxClippingUniform(GLint location) { CHECK_GL_ERROR(); } +#if defined(OS_MACOSX) && defined(GLES2_BACKEND_DESKTOP_GL) +void RendererGLES2::set_mac_cgl_context(CGLContextObj obj) { + bool changed = (mac_cgl_context_ != obj); + mac_cgl_context_ = obj; + if (changed) { + // We need to reset all of the OpenGL state when the context changes. + alpha_function_ref_changed_ = true; + alpha_blend_settings_changed_ = true; + stencil_settings_changed_ = true; + polygon_offset_changed_ = true; + // TODO(kbr): properly wire up full-screen support in this configuration. + // must_reset_context_ = true; + } +} +#endif + void RendererGLES2::SetViewportInPixels(int left, int top, int width, diff --git a/o3d/core/cross/gles2/renderer_gles2.h b/o3d/core/cross/gles2/renderer_gles2.h index 30ca3ed..6ddfbf4 100644 --- a/o3d/core/cross/gles2/renderer_gles2.h +++ b/o3d/core/cross/gles2/renderer_gles2.h @@ -183,7 +183,14 @@ class RendererGLES2 : public Renderer { void UpdateDxClippingUniform(GLint location); #if defined(GLES2_BACKEND_DESKTOP_GL) +#if defined(OS_LINUX) inline GLXContext glx_context() const { return context_; } +#endif +#if defined(OS_MACOSX) + // We need to be able to reset the CGLContextObj when we go into and + // out of full-screen mode. + void set_mac_cgl_context(CGLContextObj obj); +#endif #elif defined(GLES2_BACKEND_NATIVE_GLES2) inline EGLContext egl_context() const { return egl_context_; } #endif diff --git a/o3d/core/cross/renderer_test.cc b/o3d/core/cross/renderer_test.cc index a73ec2f..9eb0942 100644 --- a/o3d/core/cross/renderer_test.cc +++ b/o3d/core/cross/renderer_test.cc @@ -106,7 +106,9 @@ TEST_F(RendererTest, InitAndDestroyRenderer) { EXPECT_FALSE(gl_renderer->cg_context() != NULL); #elif defined(RENDERER_GLES2) #if defined(GLES2_BACKEND_DESKTOP_GL) +#if defined(OS_LINUX) EXPECT_FALSE(gles2_renderer->glx_context() != NULL); +#endif #elif defined(GLES2_BACKEND_NATIVE_GLES2) EXPECT_FALSE(gles2_renderer->egl_context() != NULL); #endif |