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 | |
| 43 | OSWindow *getWindow() const; |
| 44 | EGLConfig getConfig() const; |
| 45 | EGLDisplay getDisplay() const; |
| 46 | EGLSurface getSurface() const; |
| 47 | EGLContext getContext() const; |
| 48 | size_t getWidth() const { return mWidth; } |
| 49 | size_t getHeight() const { return mHeight; } |
| 50 | |
| 51 | bool initializeGL(); |
| 52 | void destroyGL(); |
| 53 | |
| 54 | private: |
| 55 | DISALLOW_COPY_AND_ASSIGN(EGLWindow); |
| 56 | |
| 57 | EGLConfig mConfig; |
| 58 | EGLDisplay mDisplay; |
| 59 | EGLSurface mSurface; |
| 60 | EGLContext mContext; |
| 61 | |
| 62 | GLuint mClientVersion; |
| 63 | EGLint mRequestedRenderer; |
| 64 | size_t mWidth; |
| 65 | size_t mHeight; |
| 66 | |
| 67 | std::unique_ptr<OSWindow> mOSWindow; |
| 68 | }; |
| 69 | |
| 70 | #endif // UTIL_EGLWINDOW_H_ |