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

Side by Side Diff: gpu/demos/framework/demo.h

Issue 554053: Added infrastructure to run gpu demos under Pepper3D. Created a Demo class th... (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/demos.gyp ('k') | gpu/demos/framework/demo.cc » ('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 // Base class for gles2 demos.
6
7 #ifndef GPU_DEMOS_FRAMEWORK_DEMO_H_
8 #define GPU_DEMOS_FRAMEWORK_DEMO_H_
9
10 #include "base/time.h"
11
12 namespace gpu {
13 namespace demos {
14
15 // Base class for GLES2 demos. The same demo class is supposed to be run as
16 // standalone apps (exe), pepper plugin (dll), and nacl module (nexe). This is
17 // accomplished by creating framework for each platfom and hosting the demo
18 // class object.
19 class Demo {
20 public:
21 Demo();
22 virtual ~Demo();
23
24 // Returns the title of demo. This title is used to name the window or
25 // html page where demo is running.
26 virtual const wchar_t* Title() const = 0;
27
28 // Initializes the size of the window on which this demo object will render.
29 void InitWindowSize(int width, int height);
30
31 // This function is called by the framework to initialize the OpenGL state
32 // required by this demo. When this function is called, it is assumed that
33 // a rendering context has already been created and made current.
34 virtual bool InitGL() = 0;
35
36 // This function is called by the framework to perform OpenGL rendering.
37 // When this function is called, it is assumed that the rendering context
38 // has been made current.
39 void Draw();
40
41 protected:
42 // Returns the width of window.
43 int width() const { return width_; }
44 // Returns the height of window.
45 int height() const { return height_; }
46
47 // The framework calls this function for the derived classes to do custom
48 // rendering. There is no default implementation. It must be defined by the
49 // derived classes. The elapsed_sec param represents the time elapsed
50 // (in seconds) after Render was called the last time. It can be used to
51 // make the application frame-rate independent. It is 0.0f for the
52 // first render call.
53 virtual void Render(float elapsed_sec) = 0;
54
55 private:
56 int width_; // Window width.
57 int height_; // Window height.
58
59 // Time at which draw was called last.
60 base::Time last_draw_time_;
61
62 DISALLOW_COPY_AND_ASSIGN(Demo);
63 };
64
65 } // namespace demos
66 } // namespace gpu
67 #endif // GPU_DEMOS_FRAMEWORK_DEMO_H_
OLDNEW
« no previous file with comments | « gpu/demos/demos.gyp ('k') | gpu/demos/framework/demo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698