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     void destroyGL() override;
37     bool isGLInitialized() const override;
38 
39     bool makeCurrent() override;
40     void swap() override;
41     bool hasError() const override;
42     bool setSwapInterval(EGLint swapInterval) override;
43     angle::GenericProc getProcAddress(const char *name) override;
44 
45   private:
46     WGLWindow(int glesMajorVersion, int glesMinorVersion);
47     ~WGLWindow() override;
48 
49     // OS resources.
50     HDC mDeviceContext;
51     HGLRC mWGLContext;
52     HWND mWindow;
53 };
54 
55 #endif  // UTIL_WINDOWS_WGLWINDOW_H_
56