| OLD | NEW |
| (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 | |
| 13 #include "gpu/demos/app_framework/platform.h" | |
| 14 | |
| 15 namespace gpu_demos { | |
| 16 | |
| 17 // Acts as a base class for GLES2 applications using command buffer. | |
| 18 // The derived calls needs to call InitRenderContext() to create a render | |
| 19 // surface and initialize a rendering context. Currently it only creates | |
| 20 // an on-screen window. It will be extended to support pepper/nacl plugin | |
| 21 // when pepper 3D api is in place. | |
| 22 class Application { | |
| 23 public: | |
| 24 Application(); | |
| 25 virtual ~Application(); | |
| 26 | |
| 27 // Enters the event processing loop. | |
| 28 void MainLoop(); | |
| 29 void OnPaint(); | |
| 30 | |
| 31 protected: | |
| 32 // Returns the size of rendering surface. | |
| 33 inline int width() const { return width_; } | |
| 34 inline int height() const { return height_; } | |
| 35 | |
| 36 bool InitRenderContext(); | |
| 37 | |
| 38 virtual void Draw() = 0; | |
| 39 | |
| 40 private: | |
| 41 // Creates a native on-screen window. | |
| 42 NativeWindowHandle CreateNativeWindow(); | |
| 43 | |
| 44 int width_; | |
| 45 int height_; | |
| 46 NativeWindowHandle window_handle_; | |
| 47 | |
| 48 // The following two variables are just needed to satisfy | |
| 49 // the assumption that we are running inside a browser. | |
| 50 base::AtExitManager at_exit_manager_; | |
| 51 MessageLoopForUI message_loop_; | |
| 52 | |
| 53 DISALLOW_COPY_AND_ASSIGN(Application); | |
| 54 }; | |
| 55 | |
| 56 } // namespace gpu_demos | |
| 57 #endif // GPU_DEMOS_APP_FRAMEWORK_APPLICATION_H_ | |
| OLD | NEW |