diff options
author | alokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-26 18:13:25 +0000 |
---|---|---|
committer | alokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-26 18:13:25 +0000 |
commit | 984a4d13671e3c2d1ac459b391256cbdb1de977d (patch) | |
tree | 186d35d00e7f4b8382945c55e6e4a8296b8a0d5d /gpu | |
parent | befc8eef6aa5ad2fdece3c3cf31fb3568450424c (diff) | |
download | chromium_src-984a4d13671e3c2d1ac459b391256cbdb1de977d.zip chromium_src-984a4d13671e3c2d1ac459b391256cbdb1de977d.tar.gz chromium_src-984a4d13671e3c2d1ac459b391256cbdb1de977d.tar.bz2 |
Hooked all demos to gpu/demos.gyp. Now all demos run as both - standalone executables and pepper plugin.
BUG=26099
Review URL: http://codereview.chromium.org/549159
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37119 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r-- | gpu/demos/demos.gyp | 144 | ||||
-rw-r--r-- | gpu/demos/gles2_book/mip_map_2d.cc (renamed from gpu/demos/mip_map_2d/main.cc) | 30 | ||||
-rw-r--r-- | gpu/demos/gles2_book/simple_texture_2d.cc (renamed from gpu/demos/simple_texture_2d/main.cc) | 32 | ||||
-rw-r--r-- | gpu/demos/gles2_book/simple_texture_cubemap.cc (renamed from gpu/demos/simple_texture_cubemap/main.cc) | 30 | ||||
-rw-r--r-- | gpu/demos/gles2_book/simple_vertex_shader.cc | 33 | ||||
-rw-r--r-- | gpu/demos/gles2_book/stencil_test.cc (renamed from gpu/demos/stencil_test/main.cc) | 30 | ||||
-rw-r--r-- | gpu/demos/gles2_book/texture_wrap.cc (renamed from gpu/demos/texture_wrap/main.cc) | 30 | ||||
-rw-r--r-- | gpu/demos/simple_vertex_shader/main.cc | 31 |
8 files changed, 263 insertions, 97 deletions
diff --git a/gpu/demos/demos.gyp b/gpu/demos/demos.gyp index 307e50b..10d3cba 100644 --- a/gpu/demos/demos.gyp +++ b/gpu/demos/demos.gyp @@ -94,6 +94,150 @@ 'gles2_book/hello_triangle.cc', ], }, + { + 'target_name': 'mip_map_2d_exe', + 'type': 'executable', + 'dependencies': [ + 'gpu_demo_framework_exe', + '../../third_party/gles2_book/gles2_book.gyp:mip_map_2d', + ], + 'sources': [ + 'gles2_book/example.h', + 'gles2_book/mip_map_2d.cc', + ], + }, + { + 'target_name': 'mip_map_2d_pepper', + 'type': 'shared_library', + 'dependencies': [ + 'gpu_demo_framework_pepper', + '../../third_party/gles2_book/gles2_book.gyp:mip_map_2d', + ], + 'sources': [ + 'gles2_book/example.h', + 'gles2_book/mip_map_2d.cc', + ], + }, + { + 'target_name': 'simple_texture_2d_exe', + 'type': 'executable', + 'dependencies': [ + 'gpu_demo_framework_exe', + '../../third_party/gles2_book/gles2_book.gyp:simple_texture_2d', + ], + 'sources': [ + 'gles2_book/example.h', + 'gles2_book/simple_texture_2d.cc', + ], + }, + { + 'target_name': 'simple_texture_2d_pepper', + 'type': 'shared_library', + 'dependencies': [ + 'gpu_demo_framework_pepper', + '../../third_party/gles2_book/gles2_book.gyp:simple_texture_2d', + ], + 'sources': [ + 'gles2_book/example.h', + 'gles2_book/simple_texture_2d.cc', + ], + }, + { + 'target_name': 'simple_texture_cubemap_exe', + 'type': 'executable', + 'dependencies': [ + 'gpu_demo_framework_exe', + '../../third_party/gles2_book/gles2_book.gyp:simple_texture_cubemap', + ], + 'sources': [ + 'gles2_book/example.h', + 'gles2_book/simple_texture_cubemap.cc', + ], + }, + { + 'target_name': 'simple_texture_cubemap_pepper', + 'type': 'shared_library', + 'dependencies': [ + 'gpu_demo_framework_pepper', + '../../third_party/gles2_book/gles2_book.gyp:simple_texture_cubemap', + ], + 'sources': [ + 'gles2_book/example.h', + 'gles2_book/simple_texture_cubemap.cc', + ], + }, + { + 'target_name': 'simple_vertex_shader_exe', + 'type': 'executable', + 'dependencies': [ + 'gpu_demo_framework_exe', + '../../third_party/gles2_book/gles2_book.gyp:simple_vertex_shader', + ], + 'sources': [ + 'gles2_book/example.h', + 'gles2_book/simple_vertex_shader.cc', + ], + }, + { + 'target_name': 'simple_vertex_shader_pepper', + 'type': 'shared_library', + 'dependencies': [ + 'gpu_demo_framework_pepper', + '../../third_party/gles2_book/gles2_book.gyp:simple_vertex_shader', + ], + 'sources': [ + 'gles2_book/example.h', + 'gles2_book/simple_vertex_shader.cc', + ], + }, + { + 'target_name': 'stencil_test_exe', + 'type': 'executable', + 'dependencies': [ + 'gpu_demo_framework_exe', + '../../third_party/gles2_book/gles2_book.gyp:stencil_test', + ], + 'sources': [ + 'gles2_book/example.h', + 'gles2_book/stencil_test.cc', + ], + }, + { + 'target_name': 'stencil_test_pepper', + 'type': 'shared_library', + 'dependencies': [ + 'gpu_demo_framework_pepper', + '../../third_party/gles2_book/gles2_book.gyp:stencil_test', + ], + 'sources': [ + 'gles2_book/example.h', + 'gles2_book/stencil_test.cc', + ], + }, + { + 'target_name': 'texture_wrap_exe', + 'type': 'executable', + 'dependencies': [ + 'gpu_demo_framework_exe', + '../../third_party/gles2_book/gles2_book.gyp:texture_wrap', + ], + 'sources': [ + 'gles2_book/example.h', + 'gles2_book/texture_wrap.cc', + ], + }, + { + 'target_name': 'texture_wrap_pepper', + 'type': 'shared_library', + 'dependencies': [ + 'gpu_demo_framework_pepper', + '../../third_party/gles2_book/gles2_book.gyp:texture_wrap', + ], + 'sources': [ + 'gles2_book/example.h', + 'gles2_book/texture_wrap.cc', + ], + }, ] } diff --git a/gpu/demos/mip_map_2d/main.cc b/gpu/demos/gles2_book/mip_map_2d.cc index 72818d0e..fcb5c3b 100644 --- a/gpu/demos/mip_map_2d/main.cc +++ b/gpu/demos/gles2_book/mip_map_2d.cc @@ -5,25 +5,29 @@ // This is a simple example that demonstrates generating a mipmap chain // and rendering with it. +#include "gpu/demos/framework/demo_factory.h" #include "gpu/demos/gles2_book/example.h" #include "third_party/gles2_book/Chapter_9/MipMap2D/MipMap2D.h" namespace gpu { namespace demos { + namespace gles2_book { -typedef Example<MMUserData, - mmInit, - NoOpUpdateFunc, - mmDraw, - mmShutDown> MipMap2D; -} // namespace gles2_book -} // namespace demos -} // namespace gpu +class MipMap2D : public Example<MMUserData> { + public: + MipMap2D() { + RegisterCallbacks(mmInit, NULL, mmDraw, mmShutDown); + } -int main(int argc, char *argv[]) { - gpu::demos::gles2_book::MipMap2D demo; - CHECK(demo.Init()); + const wchar_t* Title() const { + return L"Mip-Map 2D"; + } +}; +} // namespace gles2_book - demo.MainLoop(); - return EXIT_SUCCESS; +Demo* CreateDemo() { + return new gles2_book::MipMap2D(); } + +} // namespace demos +} // namespace gpu diff --git a/gpu/demos/simple_texture_2d/main.cc b/gpu/demos/gles2_book/simple_texture_2d.cc index 116f298..3f4eff6 100644 --- a/gpu/demos/simple_texture_2d/main.cc +++ b/gpu/demos/gles2_book/simple_texture_2d.cc @@ -4,27 +4,31 @@ // This is a simple example that draws a quad with a 2D // texture image. The purpose of this example is to demonstrate -// the basics of 2D texturing +// the basics of 2D texturing. +#include "gpu/demos/framework/demo_factory.h" #include "gpu/demos/gles2_book/example.h" #include "third_party/gles2_book/Chapter_9/Simple_Texture2D/Simple_Texture2D.h" namespace gpu { namespace demos { + namespace gles2_book { -typedef Example<STUserData, - stInit, - NoOpUpdateFunc, - stDraw, - stShutDown> SimpleTexture2D; -} // namespace gles2_book -} // namespace demos -} // namespace gpu +class SimpleTexture2D : public Example<STUserData> { + public: + SimpleTexture2D() { + RegisterCallbacks(stInit, NULL, stDraw, stShutDown); + } -int main(int argc, char *argv[]) { - gpu::demos::gles2_book::SimpleTexture2D demo; - CHECK(demo.Init()); + const wchar_t* Title() const { + return L"Simple Texture 2D"; + } +}; +} // namespace gles2_book - demo.MainLoop(); - return EXIT_SUCCESS; +Demo* CreateDemo() { + return new gles2_book::SimpleTexture2D(); } + +} // namespace demos +} // namespace gpu diff --git a/gpu/demos/simple_texture_cubemap/main.cc b/gpu/demos/gles2_book/simple_texture_cubemap.cc index 6317a2d..6db525b 100644 --- a/gpu/demos/simple_texture_cubemap/main.cc +++ b/gpu/demos/gles2_book/simple_texture_cubemap.cc @@ -4,25 +4,29 @@ // This is a simple example that draws a sphere with a cubemap image applied. +#include "gpu/demos/framework/demo_factory.h" #include "gpu/demos/gles2_book/example.h" #include "third_party/gles2_book/Chapter_9/Simple_TextureCubemap/Simple_TextureCubemap.h" namespace gpu { namespace demos { + namespace gles2_book { -typedef Example<STCUserData, - stcInit, - NoOpUpdateFunc, - stcDraw, - stcShutDown> SimpleTextureCubemap; -} // namespace gles2_book -} // namespace demos -} // namespace gpu +class SimpleTextureCubemap : public Example<STCUserData> { + public: + SimpleTextureCubemap() { + RegisterCallbacks(stcInit, NULL, stcDraw, stcShutDown); + } -int main(int argc, char *argv[]) { - gpu::demos::gles2_book::SimpleTextureCubemap demo; - CHECK(demo.Init()); + const wchar_t* Title() const { + return L"Simple Texture Cubemap"; + } +}; +} // namespace gles2_book - demo.MainLoop(); - return EXIT_SUCCESS; +Demo* CreateDemo() { + return new gles2_book::SimpleTextureCubemap(); } + +} // namespace demos +} // namespace gpu diff --git a/gpu/demos/gles2_book/simple_vertex_shader.cc b/gpu/demos/gles2_book/simple_vertex_shader.cc new file mode 100644 index 0000000..dff99ca --- /dev/null +++ b/gpu/demos/gles2_book/simple_vertex_shader.cc @@ -0,0 +1,33 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// This is a simple example that draws a rotating cube in perspective +// using a vertex shader to transform the object. + +#include "gpu/demos/framework/demo_factory.h" +#include "gpu/demos/gles2_book/example.h" +#include "third_party/gles2_book/Chapter_8/Simple_VertexShader/Simple_VertexShader.h" + +namespace gpu { +namespace demos { + +namespace gles2_book { +class SimpleVertexShader : public Example<SVSUserData> { + public: + SimpleVertexShader() { + RegisterCallbacks(svsInit, svsUpdate, svsDraw, svsShutDown); + } + + const wchar_t* Title() const { + return L"Simple Vertex Shader"; + } +}; +} // namespace gles2_book + +Demo* CreateDemo() { + return new gles2_book::SimpleVertexShader(); +} + +} // namespace demos +} // namespace gpu diff --git a/gpu/demos/stencil_test/main.cc b/gpu/demos/gles2_book/stencil_test.cc index 9489fee..66be791 100644 --- a/gpu/demos/stencil_test/main.cc +++ b/gpu/demos/gles2_book/stencil_test.cc @@ -4,25 +4,29 @@ // This example shows various stencil buffer operations. +#include "gpu/demos/framework/demo_factory.h" #include "gpu/demos/gles2_book/example.h" #include "third_party/gles2_book/Chapter_11/Stencil_Test/Stencil_Test.h" namespace gpu { namespace demos { + namespace gles2_book { -typedef Example<STUserData, - stInit, - NoOpUpdateFunc, - stDraw, - stShutDown> StencilTest; -} // namespace gles2_book -} // namespace demos -} // namespace gpu +class StencilTest : public Example<STUserData> { + public: + StencilTest() { + RegisterCallbacks(stInit, NULL, stDraw, stShutDown); + } -int main(int argc, char *argv[]) { - gpu::demos::gles2_book::StencilTest demo; - CHECK(demo.Init()); + const wchar_t* Title() const { + return L"Stencil Test"; + } +}; +} // namespace gles2_book - demo.MainLoop(); - return EXIT_SUCCESS; +Demo* CreateDemo() { + return new gles2_book::StencilTest(); } + +} // namespace demos +} // namespace gpu diff --git a/gpu/demos/texture_wrap/main.cc b/gpu/demos/gles2_book/texture_wrap.cc index 4c2a86e..a3fb3ba 100644 --- a/gpu/demos/texture_wrap/main.cc +++ b/gpu/demos/gles2_book/texture_wrap.cc @@ -5,25 +5,29 @@ // This is an example that demonstrates the three texture // wrap modes available on 2D textures. +#include "gpu/demos/framework/demo_factory.h" #include "gpu/demos/gles2_book/example.h" #include "third_party/gles2_book/Chapter_9/TextureWrap/TextureWrap.h" namespace gpu { namespace demos { + namespace gles2_book { -typedef Example<TWUserData, - twInit, - NoOpUpdateFunc, - twDraw, - twShutDown> TextureWrap; -} // namespace gles2_book -} // namespace demos -} // namespace gpu +class TextureWrap : public Example<TWUserData> { + public: + TextureWrap() { + RegisterCallbacks(twInit, NULL, twDraw, twShutDown); + } -int main(int argc, char *argv[]) { - gpu::demos::gles2_book::TextureWrap demo; - CHECK(demo.Init()); + const wchar_t* Title() const { + return L"Texture Wrap"; + } +}; +} // namespace gles2_book - demo.MainLoop(); - return EXIT_SUCCESS; +Demo* CreateDemo() { + return new gles2_book::TextureWrap(); } + +} // namespace demos +} // namespace gpu diff --git a/gpu/demos/simple_vertex_shader/main.cc b/gpu/demos/simple_vertex_shader/main.cc deleted file mode 100644 index 87978fc..0000000 --- a/gpu/demos/simple_vertex_shader/main.cc +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// This is a simple example that draws a single triangle with -// a minimal vertex/fragment shader. The purpose of this -// example is to demonstrate the basic concepts of -// OpenGL ES 2.0 rendering. - -#include "gpu/demos/gles2_book/example.h" -#include "third_party/gles2_book/Chapter_8/Simple_VertexShader/Simple_VertexShader.h" - -namespace gpu { -namespace demos { -namespace gles2_book { -typedef Example<SVSUserData, - svsInit, - svsUpdate, - svsDraw, - svsShutDown> SimpleVertexShader; -} // namespace gles2_book -} // namespace demos -} // namespace gpu - -int main(int argc, char *argv[]) { - gpu::demos::gles2_book::SimpleVertexShader demo; - CHECK(demo.Init()); - - demo.MainLoop(); - return EXIT_SUCCESS; -} |