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

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

Issue 545092: Added stencil-test 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_11/Stencil_Test/Stencil_Test.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 example shows various stencil buffer operations.
6
7 #include "gpu/demos/app_framework/application.h"
8 #include "third_party/gles2_book/Chapter_11/Stencil_Test/Stencil_Test.h"
9
10 namespace gpu_demos {
11 class StencilTest : public Application {
12 public:
13 StencilTest();
14 ~StencilTest();
15
16 bool Init();
17
18 protected:
19 virtual void Draw(float elapsed_sec);
20
21 private:
22 ESContext context_;
23 STUserData user_data_;
24
25 DISALLOW_COPY_AND_ASSIGN(StencilTest);
26 };
27
28 StencilTest::StencilTest() {
29 esInitContext(&context_);
30
31 memset(&user_data_, 0, sizeof(STUserData));
32 context_.userData = &user_data_;
33 }
34
35 StencilTest::~StencilTest() {
36 stShutDown(&context_);
37 }
38
39 bool StencilTest::Init() {
40 if (!Application::InitRenderContext()) return false;
41
42 context_.width = width();
43 context_.height = height();
44 if (!stInit(&context_)) return false;
45
46 return true;
47 }
48
49 void StencilTest::Draw(float /*elapsed_sec*/) {
50 stDraw(&context_);
51 }
52 } // namespace gpu_demos
53
54 int main(int argc, char *argv[]) {
55 gpu_demos::StencilTest 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_11/Stencil_Test/Stencil_Test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698