• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2018 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 // WGLWindow:
7 //   Implements initializing a WGL rendering context.
8 //
9 
10 #ifndef UTIL_WINDOWS_WGLWINDOW_H_
11 #define UTIL_WINDOWS_WGLWINDOW_H_
12 
13 #include "common/angleutils.h"
14 #include "export.h"
15 #include "util/EGLWindow.h"
16 
17 class OSWindow;
18 
19 namespace angle
20 {
21 class Library;
22 }  // namespace angle
23 
24 class ANGLE_UTIL_EXPORT WGLWindow : public GLWindowBase
25 {
26   public:
27     static WGLWindow *New(int glesMajorVersion, int glesMinorVersion);
28     static void Delete(WGLWindow **window);
29 
30     // Internally initializes GL resources.
31     bool initializeGL(OSWindow *osWindow,
32                       angle::Library *glWindowingLibrary,
33                       angle::GLESDriverType driverType,
34                       const EGLPlatformParameters &platformParams,
35                       const ConfigParameters &configParams) override;
36 
37     GLWindowResult initializeGLWithResult(OSWindow *osWindow,
38                                           angle::Library *glWindowingLibrary,
39                                           angle::GLESDriverType driverType,
40                                           const EGLPlatformParameters &platformParams,
41                                           const ConfigParameters &configParams) override;
42 
43     void destroyGL() override;
44     bool isGLInitialized() const override;
45     bool makeCurrent() override;
46     void swap() override;
47     bool hasError() const override;
48     bool setSwapInterval(EGLint swapInterval) override;
49     angle::GenericProc getProcAddress(const char *name) override;
50     // Initializes WGL resources.
51     GLWindowContext getCurrentContextGeneric() override;
52     GLWindowContext createContextGeneric(GLWindowContext share) override;
53     bool makeCurrentGeneric(GLWindowContext context) override;
54 
55     // Create a WGL context with this window's configuration
56     HGLRC createContext(const ConfigParameters &configParams, HGLRC shareContext);
57     // Make the WGL context current
58     bool makeCurrent(HGLRC context);
59 
60   private:
61     WGLWindow(int glesMajorVersion, int glesMinorVersion);
62     ~WGLWindow() override;
63 
64     // OS resources.
65     HDC mDeviceContext;
66     HGLRC mWGLContext;
67     HWND mWindow;
68 };
69 
70 #endif  // UTIL_WINDOWS_WGLWINDOW_H_
71