blob: 9851c49883fe739725ed3b22008ae6526e6ba393 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Base class for gles2 applications using command buffer.
#ifndef GPU_DEMOS_APP_FRAMEWORK_APPLICATION_H_
#define GPU_DEMOS_APP_FRAMEWORK_APPLICATION_H_
#include "base/at_exit.h"
#include "base/message_loop.h"
#include "gpu/demos/app_framework/platform.h"
namespace gpu_demos {
// Acts as a base class for GLES2 applications using command buffer.
// The derived calls needs to call InitRenderContext() to create a render
// surface and initialize a rendering context. Currently it only creates
// an on-screen window. It will be extended to support pepper/nacl plugin
// when pepper 3D api is in place.
class Application {
public:
Application();
virtual ~Application();
// Enters the event processing loop.
void MainLoop();
void OnPaint();
protected:
// Returns the size of rendering surface.
inline int width() const { return width_; }
inline int height() const { return height_; }
bool InitRenderContext();
virtual void Draw() = 0;
private:
// Creates a native on-screen window.
NativeWindowHandle CreateNativeWindow();
int width_;
int height_;
NativeWindowHandle window_handle_;
// The following two variables are just needed to satisfy
// the assumption that we are running inside a browser.
base::AtExitManager at_exit_manager_;
MessageLoopForUI message_loop_;
DISALLOW_COPY_AND_ASSIGN(Application);
};
} // namespace gpu_demos
#endif // GPU_DEMOS_APP_FRAMEWORK_APPLICATION_H_
|