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

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

Issue 552012: Added texture wrap 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
« no previous file with comments | « gpu/demos/demos.gyp ('k') | third_party/gles2_book/Chapter_9/TextureWrap/TextureWrap.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 an example that demonstrates the three texture
6 // wrap modes available on 2D textures.
7
8 #include "gpu/demos/app_framework/application.h"
9 #include "third_party/gles2_book/Chapter_9/TextureWrap/TextureWrap.h"
10
11 namespace gpu_demos {
12 class TextureWrap : public Application {
13 public:
14 TextureWrap();
15 ~TextureWrap();
16
17 bool Init();
18
19 protected:
20 virtual void Draw(float elapsed_sec);
21
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
55 int main(int argc, char *argv[]) {
56 gpu_demos::TextureWrap app;
57 if (!app.Init()) {
58 printf("Could not init.\n");
59 return EXIT_FAILURE;
60 }
61
62 app.MainLoop();
63 return EXIT_SUCCESS;
64 }
OLDNEW
« no previous file with comments | « gpu/demos/demos.gyp ('k') | third_party/gles2_book/Chapter_9/TextureWrap/TextureWrap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698