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

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

Issue 542120: Converted all demos to use gpu::demos::Example base class. (Closed) Base URL: svn://svn.chromium.org/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
« no previous file with comments | « gpu/demos/stencil_test/main.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This is an example that demonstrates the three texture 5 // This is an example that demonstrates the three texture
6 // wrap modes available on 2D textures. 6 // wrap modes available on 2D textures.
7 7
8 #include "gpu/demos/app_framework/application.h" 8 #include "gpu/demos/gles2_book/example.h"
9 #include "third_party/gles2_book/Chapter_9/TextureWrap/TextureWrap.h" 9 #include "third_party/gles2_book/Chapter_9/TextureWrap/TextureWrap.h"
10 10
11 namespace gpu_demos { 11 namespace gpu {
12 class TextureWrap : public Application { 12 namespace demos {
13 public: 13 namespace gles2_book {
14 TextureWrap(); 14 typedef Example<TWUserData,
15 ~TextureWrap(); 15 twInit,
16 16 NoOpUpdateFunc,
17 bool Init(); 17 twDraw,
18 18 twShutDown> TextureWrap;
19 protected: 19 } // namespace gles2_book
20 virtual void Draw(float elapsed_sec); 20 } // namespace demos
21 21 } // namespace gpu
22 private:
23 ESContext context_;
24 TWUserData user_data_;
25
26 DISALLOW_COPY_AND_ASSIGN(TextureWrap);
27 };
28
29 TextureWrap::TextureWrap() {
30 esInitContext(&context_);
31
32 memset(&user_data_, 0, sizeof(TWUserData));
33 context_.userData = &user_data_;
34 }
35
36 TextureWrap::~TextureWrap() {
37 twShutDown(&context_);
38 }
39
40 bool TextureWrap::Init() {
41 if (!Application::InitRenderContext()) return false;
42
43 context_.width = width();
44 context_.height = height();
45 if (!twInit(&context_)) return false;
46
47 return true;
48 }
49
50 void TextureWrap::Draw(float /*elapsed_sec*/) {
51 twDraw(&context_);
52 }
53 } // namespace gpu_demos
54 22
55 int main(int argc, char *argv[]) { 23 int main(int argc, char *argv[]) {
56 gpu_demos::TextureWrap app; 24 gpu::demos::gles2_book::TextureWrap demo;
57 if (!app.Init()) { 25 CHECK(demo.Init());
58 printf("Could not init.\n");
59 return EXIT_FAILURE;
60 }
61 26
62 app.MainLoop(); 27 demo.MainLoop();
63 return EXIT_SUCCESS; 28 return EXIT_SUCCESS;
64 } 29 }
OLDNEW
« no previous file with comments | « gpu/demos/stencil_test/main.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698