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

Side by Side Diff: gpu/demos/app_framework/application.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 | « no previous file | gpu/demos/app_framework/application.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2006-2009 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 applications using command buffer.
6
7 #ifndef GPU_DEMOS_APP_FRAMEWORK_APPLICATION_H_
8 #define GPU_DEMOS_APP_FRAMEWORK_APPLICATION_H_
9
10 #include "base/at_exit.h"
11 #include "base/message_loop.h"
12 #include "base/time.h"
13
14 #include "gpu/demos/app_framework/platform.h"
15
16 namespace gpu_demos {
17
18 // Acts as a base class for GLES2 applications using command buffer.
19 // The derived calls needs to call InitRenderContext() to create a render
20 // surface and initialize a rendering context. Currently it only creates
21 // an on-screen window. It will be extended to support pepper/nacl plugin
22 // when pepper 3D api is in place.
23 class Application {
24 public:
25 Application();
26 virtual ~Application();
27
28 // Enters the event processing loop.
29 void MainLoop();
30 void OnPaint();
31
32 protected:
33 // Returns the width of rendering surface.
34 inline int width() const { return width_; }
35 // Returns the height of rendering surface.
36 inline int height() const { return height_; }
37
38 bool InitRenderContext();
39
40 // The framework calls this function for the derived classes to do custom
41 // rendering. There is no default implementation. It must be defined by the
42 // derived classes. The elapsed_sec param represents the time elapsed
43 // (in seconds) after Draw was called the last time. It can be used to
44 // make the application frame-rate independent. It is 0.0f for the
45 // first draw call.
46 virtual void Draw(float elapsed_sec) = 0;
47
48 private:
49 // Creates a native on-screen window.
50 NativeWindowHandle CreateNativeWindow();
51
52 int width_;
53 int height_;
54 NativeWindowHandle window_handle_;
55
56 // Time at which draw was called last.
57 base::Time last_draw_time_;
58
59 // The following two variables are just needed to satisfy
60 // the assumption that we are running inside a browser.
61 base::AtExitManager at_exit_manager_;
62 MessageLoopForUI message_loop_;
63
64 DISALLOW_COPY_AND_ASSIGN(Application);
65 };
66
67 } // namespace gpu_demos
68 #endif // GPU_DEMOS_APP_FRAMEWORK_APPLICATION_H_
OLDNEW
« no previous file with comments | « no previous file | gpu/demos/app_framework/application.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698