OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef APP_GFX_GL_GL_CONTEXT_H_ | 5 #ifndef APP_GFX_GL_GL_CONTEXT_H_ |
6 #define APP_GFX_GL_GL_CONTEXT_H_ | 6 #define APP_GFX_GL_GL_CONTEXT_H_ |
7 | 7 |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "gfx/native_widget_types.h" | 10 #include "gfx/native_widget_types.h" |
11 #include "gfx/size.h" | 11 #include "gfx/size.h" |
12 | 12 |
13 namespace gfx { | 13 namespace gfx { |
14 | 14 |
15 bool InitializeGLEW(); | |
16 | |
17 // Encapsulates an OpenGL context, hiding platform specific management. | 15 // Encapsulates an OpenGL context, hiding platform specific management. |
18 class GLContext { | 16 class GLContext { |
19 public: | 17 public: |
20 GLContext() {} | 18 GLContext() {} |
21 virtual ~GLContext() {} | 19 virtual ~GLContext() {} |
22 | 20 |
23 // Destroys the GL context. | 21 // Destroys the GL context. |
24 virtual void Destroy() = 0; | 22 virtual void Destroy() = 0; |
25 | 23 |
26 // Makes the GL context current on the current thread. | 24 // Makes the GL context current on the current thread. |
(...skipping 16 matching lines...) Expand all Loading... |
43 virtual void* GetHandle() = 0; | 41 virtual void* GetHandle() = 0; |
44 | 42 |
45 #if !defined(OS_MACOSX) | 43 #if !defined(OS_MACOSX) |
46 // Create a GL context that renders directly to a view. | 44 // Create a GL context that renders directly to a view. |
47 static GLContext* CreateViewGLContext(gfx::PluginWindowHandle window, | 45 static GLContext* CreateViewGLContext(gfx::PluginWindowHandle window, |
48 bool multisampled); | 46 bool multisampled); |
49 #endif | 47 #endif |
50 | 48 |
51 // Create a GL context used for offscreen rendering. It is initially backed by | 49 // Create a GL context used for offscreen rendering. It is initially backed by |
52 // a 1x1 pbuffer. Use it to create an FBO to do useful rendering. | 50 // a 1x1 pbuffer. Use it to create an FBO to do useful rendering. |
53 static GLContext* CreateOffscreenGLContext(void* shared_handle); | 51 static GLContext* CreateOffscreenGLContext(GLContext* shared_context); |
54 | 52 |
55 protected: | 53 protected: |
56 bool InitializeCommon(); | 54 bool InitializeCommon(); |
57 | 55 |
58 private: | 56 private: |
59 DISALLOW_COPY_AND_ASSIGN(GLContext); | 57 DISALLOW_COPY_AND_ASSIGN(GLContext); |
60 }; | 58 }; |
61 | 59 |
62 } // namespace gfx | 60 } // namespace gfx |
63 | 61 |
64 #endif // APP_GFX_GL_GL_CONTEXT_H_ | 62 #endif // APP_GFX_GL_GL_CONTEXT_H_ |
OLD | NEW |