Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Side by Side Diff: gpu/demos/simple_texture_cubemap/main.cc

Issue 549063: Added cubemap demo. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // This is a simple example that draws a sphere with a cubemap image applied.
6
7 #include "gpu/demos/app_framework/application.h"
8 #include "third_party/gles2_book/Chapter_9/Simple_TextureCubemap/Simple_TextureC ubemap.h"
9
10 namespace gpu_demos {
11 class SimpleTextureCubemap : public Application {
12 public:
13 SimpleTextureCubemap();
14 ~SimpleTextureCubemap();
15
16 bool Init();
17
18 protected:
19 virtual void Draw(float);
apatrick 2010/01/14 22:41:32 parameter should have a name
20
21 private:
22 ESContext context_;
23 STCUserData user_data_;
24
25 DISALLOW_COPY_AND_ASSIGN(SimpleTextureCubemap);
26 };
27
28 SimpleTextureCubemap::SimpleTextureCubemap() {
29 esInitContext(&context_);
30
31 memset(&user_data_, 0, sizeof(STCUserData));
32 context_.userData = &user_data_;
33 }
34
35 SimpleTextureCubemap::~SimpleTextureCubemap() {
36 stcShutDown(&context_);
37 }
38
39 bool SimpleTextureCubemap::Init() {
40 if (!Application::InitRenderContext()) return false;
41
42 context_.width = width();
43 context_.height = height();
44 if (!stcInit(&context_)) return false;
45
46 return true;
47 }
48
49 void SimpleTextureCubemap::Draw(float) {
apatrick 2010/01/14 22:41:32 parameter should have a name
50 stcDraw(&context_);
51 }
52 } // namespace gpu_demos
53
54 int main(int argc, char *argv[]) {
55 gpu_demos::SimpleTextureCubemap app;
56 if (!app.Init()) {
57 printf("Could not init.\n");
58 return EXIT_FAILURE;
59 }
60
61 app.MainLoop();
62 return EXIT_SUCCESS;
63 }
OLDNEW
« no previous file with comments | « gpu/demos/demos.gyp ('k') | third_party/gles2_book/Chapter_9/Simple_TextureCubemap/Simple_TextureCubemap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698