84 bool isSharing() const { return sharing; } |
84 bool isSharing() const { return sharing; } |
85 |
85 |
86 QEgl::API api() const { return apiType; } |
86 QEgl::API api() const { return apiType; } |
87 void setApi(QEgl::API api) { apiType = api; } |
87 void setApi(QEgl::API api) { apiType = api; } |
88 |
88 |
89 bool openDisplay(QPaintDevice *device); |
|
90 bool chooseConfig(const QEglProperties& properties, QEgl::PixelFormatMatch match = QEgl::ExactPixelFormat); |
89 bool chooseConfig(const QEglProperties& properties, QEgl::PixelFormatMatch match = QEgl::ExactPixelFormat); |
91 bool createContext(QEglContext *shareContext = 0, const QEglProperties *properties = 0); |
90 bool createContext(QEglContext *shareContext = 0, const QEglProperties *properties = 0); |
|
91 void destroyContext(); |
92 EGLSurface createSurface(QPaintDevice *device, const QEglProperties *properties = 0); |
92 EGLSurface createSurface(QPaintDevice *device, const QEglProperties *properties = 0); |
93 void destroySurface(EGLSurface surface); |
93 void destroySurface(EGLSurface surface); |
94 |
|
95 void destroy(); |
|
96 |
94 |
97 bool makeCurrent(EGLSurface surface); |
95 bool makeCurrent(EGLSurface surface); |
98 bool doneCurrent(); |
96 bool doneCurrent(); |
99 bool lazyDoneCurrent(); |
97 bool lazyDoneCurrent(); |
100 bool swapBuffers(EGLSurface surface); |
98 bool swapBuffers(EGLSurface surface); |
106 |
104 |
107 static void clearError() { eglGetError(); } |
105 static void clearError() { eglGetError(); } |
108 static EGLint error() { return eglGetError(); } |
106 static EGLint error() { return eglGetError(); } |
109 static QString errorString(EGLint code); |
107 static QString errorString(EGLint code); |
110 |
108 |
111 EGLDisplay display() const { return dpy; } |
109 static EGLDisplay display(); |
112 |
110 |
113 EGLContext context() const { return ctx; } |
111 EGLContext context() const { return ctx; } |
114 void setContext(EGLContext context) { ctx = context; ownsContext = false;} |
112 void setContext(EGLContext context) { ctx = context; ownsContext = false;} |
115 |
113 |
116 EGLConfig config() const { return cfg; } |
114 EGLConfig config() const { return cfg; } |
117 void setConfig(EGLConfig config) { cfg = config; } |
115 void setConfig(EGLConfig config) { cfg = config; } |
118 |
116 |
119 QEglProperties configProperties(EGLConfig cfg = 0) const; |
117 QEglProperties configProperties(EGLConfig cfg = 0) const; |
120 |
118 |
121 static EGLDisplay defaultDisplay(QPaintDevice *device); |
|
122 |
|
123 void dumpAllConfigs(); |
119 void dumpAllConfigs(); |
124 |
120 |
125 static QString extensions(); |
121 static QString extensions(); |
126 static bool hasExtension(const char* extensionName); |
122 static bool hasExtension(const char* extensionName); |
127 |
123 |
128 private: |
124 private: |
129 QEgl::API apiType; |
125 QEgl::API apiType; |
130 EGLDisplay dpy; |
|
131 EGLContext ctx; |
126 EGLContext ctx; |
132 EGLConfig cfg; |
127 EGLConfig cfg; |
133 EGLSurface currentSurface; |
128 EGLSurface currentSurface; |
134 bool current; |
129 bool current; |
135 bool ownsContext; |
130 bool ownsContext; |
136 bool sharing; |
131 bool sharing; |
137 |
132 |
138 static EGLDisplay getDisplay(QPaintDevice *device); |
133 static EGLDisplay dpy; |
|
134 static EGLNativeDisplayType nativeDisplay(); |
139 |
135 |
140 static QEglContext *currentContext(QEgl::API api); |
136 static QEglContext *currentContext(QEgl::API api); |
141 static void setCurrentContext(QEgl::API api, QEglContext *context); |
137 static void setCurrentContext(QEgl::API api, QEglContext *context); |
142 }; |
138 }; |
143 |
139 |