summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authoralokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-15 16:32:01 +0000
committeralokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-15 16:32:01 +0000
commit46180e667bcc6e943e5b54e083c4809cce5ccad0 (patch)
treeb4243fea1e88353b794e46ed12f78f8fcd1ab575 /gpu
parent48f65dde6736a55e4ab588491fcc0ec1987d7f29 (diff)
downloadchromium_src-46180e667bcc6e943e5b54e083c4809cce5ccad0.zip
chromium_src-46180e667bcc6e943e5b54e083c4809cce5ccad0.tar.gz
chromium_src-46180e667bcc6e943e5b54e083c4809cce5ccad0.tar.bz2
Added cubemap demo.
BUG=26099 Review URL: http://codereview.chromium.org/549063 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36356 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/demos/demos.gyp11
-rw-r--r--gpu/demos/simple_texture_cubemap/main.cc63
2 files changed, 74 insertions, 0 deletions
diff --git a/gpu/demos/demos.gyp b/gpu/demos/demos.gyp
index 0f55b0f..14845ad 100644
--- a/gpu/demos/demos.gyp
+++ b/gpu/demos/demos.gyp
@@ -57,6 +57,17 @@
],
},
{
+ 'target_name': 'simple_texture_cubemap',
+ 'type': 'executable',
+ 'dependencies': [
+ 'app_framework',
+ '../../third_party/gles2_book/gles2_book.gyp:simple_texture_cubemap',
+ ],
+ 'sources': [
+ 'simple_texture_cubemap/main.cc',
+ ],
+ },
+ {
'target_name': 'simple_vertex_shader',
'type': 'executable',
'dependencies': [
diff --git a/gpu/demos/simple_texture_cubemap/main.cc b/gpu/demos/simple_texture_cubemap/main.cc
new file mode 100644
index 0000000..d42f003
--- /dev/null
+++ b/gpu/demos/simple_texture_cubemap/main.cc
@@ -0,0 +1,63 @@
+// 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 sphere with a cubemap image applied.
+
+#include "gpu/demos/app_framework/application.h"
+#include "third_party/gles2_book/Chapter_9/Simple_TextureCubemap/Simple_TextureCubemap.h"
+
+namespace gpu_demos {
+class SimpleTextureCubemap : public Application {
+ public:
+ SimpleTextureCubemap();
+ ~SimpleTextureCubemap();
+
+ bool Init();
+
+ protected:
+ virtual void Draw(float elapsed_sec);
+
+ private:
+ ESContext context_;
+ STCUserData user_data_;
+
+ DISALLOW_COPY_AND_ASSIGN(SimpleTextureCubemap);
+};
+
+SimpleTextureCubemap::SimpleTextureCubemap() {
+ esInitContext(&context_);
+
+ memset(&user_data_, 0, sizeof(STCUserData));
+ context_.userData = &user_data_;
+}
+
+SimpleTextureCubemap::~SimpleTextureCubemap() {
+ stcShutDown(&context_);
+}
+
+bool SimpleTextureCubemap::Init() {
+ if (!Application::InitRenderContext()) return false;
+
+ context_.width = width();
+ context_.height = height();
+ if (!stcInit(&context_)) return false;
+
+ return true;
+}
+
+void SimpleTextureCubemap::Draw(float /*elapsed_sec*/) {
+ stcDraw(&context_);
+}
+} // namespace gpu_demos
+
+int main(int argc, char *argv[]) {
+ gpu_demos::SimpleTextureCubemap app;
+ if (!app.Init()) {
+ printf("Could not init.\n");
+ return EXIT_FAILURE;
+ }
+
+ app.MainLoop();
+ return EXIT_SUCCESS;
+}