Jamie Madill | 1cfaaf8 | 2014-08-21 10:04:04 -0400 | [diff] [blame] | 1 | // |
| 2 | // Copyright (c) 2014 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 | |
| 7 | #ifndef UTIL_EGLWINDOW_H_ |
| 8 | #define UTIL_EGLWINDOW_H_ |
| 9 | |
| 10 | #define GL_GLEXT_PROTOTYPES |
| 11 | |
| 12 | #include <GLES3/gl3.h> |
| 13 | #include <GLES3/gl3ext.h> |
| 14 | #include <GLES2/gl2.h> |
| 15 | #include <GLES2/gl2ext.h> |
| 16 | #include <EGL/egl.h> |
| 17 | #include <EGL/eglext.h> |
| 18 | |
| 19 | #include <string> |
| 20 | #include <list> |
| 21 | #include <cstdint> |
| 22 | #include <memory> |
| 23 | |
| 24 | // A macro to disallow the copy constructor and operator= functions |
| 25 | // This must be used in the private: declarations for a class |
| 26 | #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ |
| 27 | TypeName(const TypeName&); \ |
| 28 | void operator=(const TypeName&) |
| 29 | |
| 30 | class OSWindow; |
| 31 | |
| 32 | class EGLWindow |
| 33 | { |
| 34 | public: |
| 35 | EGLWindow(size_t width, size_t height, |
| 36 | EGLint glesMajorVersion = 2, |
| 37 | EGLint requestedRenderer = EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE); |
| 38 | |
| 39 | ~EGLWindow(); |
| 40 | |
| 41 | void swap(); |
| 42 | |
Jamie Madill | 1cfaaf8 | 2014-08-21 10:04:04 -0400 | [diff] [blame] | 43 | EGLConfig getConfig() const; |
| 44 | EGLDisplay getDisplay() const; |
| 45 | EGLSurface getSurface() const; |
| 46 | EGLContext getContext() const; |
| 47 | size_t getWidth() const { return mWidth; } |
| 48 | size_t getHeight() const { return mHeight; } |
| 49 | |
Jamie Madill | 586666c | 2014-08-21 10:04:05 -0400 | [diff] [blame^] | 50 | bool initializeGL(const OSWindow *osWindow); |
Jamie Madill | 1cfaaf8 | 2014-08-21 10:04:04 -0400 | [diff] [blame] | 51 | void destroyGL(); |
| 52 | |
| 53 | private: |
| 54 | DISALLOW_COPY_AND_ASSIGN(EGLWindow); |
| 55 | |
| 56 | EGLConfig mConfig; |
| 57 | EGLDisplay mDisplay; |
| 58 | EGLSurface mSurface; |
| 59 | EGLContext mContext; |
| 60 | |
| 61 | GLuint mClientVersion; |
| 62 | EGLint mRequestedRenderer; |
| 63 | size_t mWidth; |
| 64 | size_t mHeight; |
Jamie Madill | 1cfaaf8 | 2014-08-21 10:04:04 -0400 | [diff] [blame] | 65 | }; |
| 66 | |
| 67 | #endif // UTIL_EGLWINDOW_H_ |