Ocean
Loading...
Searching...
No Matches
platform/gl/Context.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8#ifndef META_OCEAN_PLATFORM_GL_CONTEXT_H
9#define META_OCEAN_PLATFORM_GL_CONTEXT_H
10
12
13#include "ocean/base/Thread.h"
14
15namespace Ocean
16{
17
18namespace Platform
19{
20
21namespace GL
22{
23
24/**
25 * This class encapsulates an OpenGL context.
26 * @ingroup platformgl
27 */
28class OCEAN_PLATFORM_GL_EXPORT Context
29{
30 public:
31
32 /**
33 * Definition of a set holding strings.
34 */
35 using StringSet = std::set<std::string>;
36
37 /**
38 * Definition of the glGetStringi function pointer type.
39 */
40 using glGetStringiFunction = const GLubyte* (*)(GLenum, GLuint);
41
42 /**
43 * Definition of the glGenFramebuffers function pointer type.
44 */
45 using glGenFramebuffersFunction = void (*)(GLsizei, GLuint*);
46
47 /**
48 * Definition of the glDeleteFramebuffers function pointer type.
49 */
50 using glDeleteFramebuffersFunction = void (*)(GLsizei, const GLuint*);
51
52 /**
53 * Definition of the glBindFramebuffer function pointer type.
54 */
55 using glBindFramebufferFunction = void (*)(GLenum, GLuint);
56
57 /**
58 * Definition of the glGenRenderbuffers function pointer type.
59 */
60 using glGenRenderbuffersFunction = void (*)(GLsizei, GLuint*);
61
62 /**
63 * Definition of the glDeleteRenderbuffers function pointer type.
64 */
65 using glDeleteRenderbuffersFunction = void (*)(GLsizei, const GLuint*);
66
67 /**
68 * Definition of the glBindRenderbuffer function pointer type.
69 */
70 using glBindRenderbufferFunction = void (*)(GLenum, GLuint);
71
72 /**
73 * Definition of the glRenderbufferStorage function pointer type.
74 */
75 using glRenderbufferStorageFunction = void (*)(GLenum, GLenum, GLsizei, GLsizei);
76
77 /**
78 * Definition of the glRenderbufferStorageMultisample function pointer type.
79 */
80 using glRenderbufferStorageMultisampleFunction = void (*)(GLenum, GLsizei, GLenum, GLsizei, GLsizei);
81
82 /**
83 * Definition of the glFramebufferRenderbuffer function pointer type.
84 */
85 using glFramebufferRenderbufferFunction = void (*)(GLenum, GLenum, GLenum, GLuint);
86
87 /**
88 * Definition of the glBlitFramebuffer function pointer type.
89 */
90 using glBlitFramebufferFunction = void (*)(GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum);
91
92 /**
93 * Definition of the glCheckFramebufferStatus function pointer type.
94 */
95 using glCheckFramebufferStatusFunction = GLenum (*)(GLenum);
96
97 /**
98 * Definition of the glGenBuffers function pointer type.
99 */
100 using glGenBuffersFunction = void (*)(GLsizei, GLuint*);
101
102 /**
103 * Definition of the glDeleteBuffers function pointer type.
104 */
105 using glDeleteBuffersFunction = void (*)(GLsizei, const GLuint*);
106
107 /**
108 * Definition of the glBindBuffer function pointer type.
109 */
110 using glBindBufferFunction = void (*)(GLenum, GLuint);
111
112 /**
113 * Definition of the glBufferData function pointer type.
114 */
115 using glBufferDataFunction = void (*)(GLenum, GLsizeiptr, const GLvoid*, GLenum);
116
117 /**
118 * Definition of the glCreateProgram function pointer type.
119 */
120 using glCreateProgramFunction = GLuint (*)();
121
122 /**
123 * Definition of the glDeleteProgram function pointer type.
124 */
125 using glDeleteProgramFunction = void (*)(GLuint);
126
127 /**
128 * Definition of the glIsProgram function pointer type.
129 */
130 using glIsProgramFunction = GLboolean (*)(GLuint);
131
132 /**
133 * Definition of the glAttachShader function pointer type.
134 */
135 using glAttachShaderFunction = void (*)(GLuint, GLuint);
136
137 /**
138 * Definition of the glDetachShader function pointer type.
139 */
140 using glDetachShaderFunction = void (*)(GLuint, GLuint);
141
142 /**
143 * Definition of the glLinkProgram function pointer type.
144 */
145 using glLinkProgramFunction = void (*)(GLuint);
146
147 /**
148 * Definition of the glUseProgram function pointer type.
149 */
150 using glUseProgramFunction = void (*)(GLuint);
151
152 /**
153 * Definition of the glCreateShader function pointer type.
154 */
155 using glCreateShaderFunction = GLuint (*)(GLenum);
156
157 /**
158 * Definition of the glDeleteShader function pointer type.
159 */
160 using glDeleteShaderFunction = void (*)(GLuint);
161
162 /**
163 * Definition of the glCompileShader function pointer type.
164 */
165 using glCompileShaderFunction = void (*)(GLuint);
166
167 /**
168 * Definition of the glShaderSource function pointer type.
169 */
170 using glShaderSourceFunction = void (*)(GLuint, GLsizei, const GLchar**, const GLint*);
171
172 /**
173 * Definition of the glGetProgramiv function pointer type.
174 */
175 using glGetProgramivFunction = void (*)(GLuint, GLenum, GLint*);
176
177 /**
178 * Definition of the glGetShaderiv function pointer type.
179 */
180 using glGetShaderivFunction = void (*)(GLuint, GLenum, GLint*);
181
182 /**
183 * Definition of the glGetProgramInfoLog function pointer type.
184 */
185 using glGetProgramInfoLogFunction = void (*)(GLuint, GLsizei, GLsizei*, GLchar*);
186
187 /**
188 * Definition of the glGetShaderInfoLog function pointer type.
189 */
190 using glGetShaderInfoLogFunction = void (*)(GLuint, GLsizei, GLsizei*, GLchar*);
191
192 /**
193 * Definition of the glGetAttribLocation function pointer type.
194 */
195 using glGetAttribLocationFunction = GLint (*)(GLuint, const GLchar*);
196
197 /**
198 * Definition of the glGetUniformLocation function pointer type.
199 */
200 using glGetUniformLocationFunction = GLint (*)(GLuint, const GLchar*);
201
202 /**
203 * Definition of the glUniform1i function pointer type.
204 */
205 using glUniform1iFunction = void (*)(GLint, GLint);
206
207 /**
208 * Definition of the glUniform1fv function pointer type.
209 */
210 using glUniform1fvFunction = void (*)(GLint, GLsizei, const GLfloat*);
211
212 /**
213 * Definition of the glUniform2fv function pointer type.
214 */
215 using glUniform2fvFunction = void (*)(GLint, GLsizei, const GLfloat*);
216
217 /**
218 * Definition of the glUniform3fv function pointer type.
219 */
220 using glUniform3fvFunction = void (*)(GLint, GLsizei, const GLfloat*);
221
222 /**
223 * Definition of the glUniform4fv function pointer type.
224 */
225 using glUniform4fvFunction = void (*)(GLint, GLsizei, const GLfloat*);
226
227 /**
228 * Definition of the glUniformMatrix3fv function pointer type.
229 */
230 using glUniformMatrix3fvFunction = void (*)(GLint, GLsizei, GLboolean, const GLfloat*);
231
232 /**
233 * Definition of the glUniformMatrix4fv function pointer type.
234 */
235 using glUniformMatrix4fvFunction = void (*)(GLint, GLsizei, GLboolean, const GLfloat*);
236
237 /**
238 * Definition of the glEnableVertexAttribArray function pointer type.
239 */
240 using glEnableVertexAttribArrayFunction = void (*)(GLuint);
241
242 /**
243 * Definition of the glDisableVertexAttribArray function pointer type.
244 */
245 using glDisableVertexAttribArrayFunction = void (*)(GLuint);
246
247 /**
248 * Definition of the glVertexAttribPointer function pointer type.
249 */
250 using glVertexAttribPointerFunction = void (*)(GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid*);
251
252 /**
253 * Definition of the glActiveTexture function pointer type.
254 */
255 using glActiveTextureFunction = void (*)(GLenum);
256
257 /**
258 * Definition of the glGenerateMipmap function pointer type.
259 */
260 using glGenerateMipmapFunction = void (*)(GLenum);
261
262 /**
263 * Definition of the glBlendFuncSeparate function pointer type.
264 */
265 using glBlendFuncSeparateFunction = void (*)(GLenum, GLenum, GLenum, GLenum);
266
267 /**
268 * Definition of the glTexImage2DMultisample function pointer type.
269 */
270 using glTexImage2DMultisampleFunction = void (*)(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLboolean);
271
272 /**
273 * Definition of the glFramebufferTexture2D function pointer type.
274 */
275 using glFramebufferTexture2DFunction = void (*)(GLenum, GLenum, GLenum, GLuint, GLint);
276
277 /**
278 * Definition of the glBindFragDataLocation function pointer type.
279 */
280 using glBindFragDataLocationFunction = void (*)(GLuint, GLuint, const char*);
281
282 /**
283 * Definition of the glGenVertexArrays function pointer type.
284 */
285 using glGenVertexArraysFunction = void (*)(GLsizei, GLuint*);
286
287 /**
288 * Definition of the glDeleteVertexArrays function pointer type.
289 */
290 using glDeleteVertexArraysFunction = void (*)(GLsizei, const GLuint*);
291
292 /**
293 * Definition of the glBindVertexArray function pointer type.
294 */
295 using glBindVertexArrayFunction = void (*)(GLuint);
296
297#ifdef _WINDOWS
298
299 using wglCreateContextAttribsARBFunction = HGLRC (*)(HDC, HGLRC, const int*);
300
301#endif
302
303 public:
304
305 /**
306 * Releases the context.
307 */
308 virtual ~Context();
309
310 /**
311 * Makes the OpenGL rendering context of this framebuffer the calling thread's current rendering context or makes the calling thread's current rendering context not longer current.
312 * @param state True, to make the context current; False, to make the current context not current any longer
313 */
314 virtual void makeCurrent(const bool state = true) = 0;
315
316 /**
317 * Swaps the foreground and background buffer if this context has two buffers.
318 * @return True, if this context has two buffers
319 */
320 virtual bool swapBuffers();
321
322 /**
323 * Returns the major OpenGL version of this context.
324 * The determination of the version may fail if the version is below 3.0.<br>
325 * @return The context's major OpenGL version, 0 if the major version could not be determined
326 */
327 inline unsigned int majorVersion() const;
328
329 /**
330 * Returns the minor OpenGL version of this context.
331 * The determination of the version may fail if the version is below 3.0.<br>
332 * @return The context's minor OpenGL version, 0 if the major version could not be determined
333 */
334 inline unsigned int minorVersion() const;
335
336 /**
337 * Returns whether this context provides the compatibility profile or the core profile.
338 * In general, the compatibility profile allows to use also deprecated functions.<br>
339 * However, an existing core profile does not guarantee a compatibility profile with same features (OpenGL version).
340 * @return True, if this context provides the compatibility profile
341 */
342 inline bool compatibilityProfile() const;
343
344 /**
345 * Returns the set of supported extensions.
346 * @return The supported extensions
347 */
348 inline const StringSet& supportedExtensions() const;
349
350 /**
351 * Returns whether a specific extension is supported.
352 * @param extension The extension to check
353 * @return True, if so
354 */
355 inline bool isExtensionSupported(const std::string& extension) const;
356
357 /**
358 * Returns the number of multi samples that this context supports.
359 * @return The context's number of multi samples
360 */
361 inline unsigned int multisamples() const;
362
363 /**
364 * Releases the context explicitly.
365 */
366 virtual void release();
367
368 /**
369 * Returns whether this context is valid.
370 * @return True, if so
371 */
372 virtual bool isValid() const;
373
374 protected:
375
376 /**
377 * Creates a new context.
378 */
379 Context() = default;
380
381 /**
382 * Creates the OpenGL context for this object.
383 * @param initializeOpenGL33 True, to initialize the capabilities of OpenGL 3.3 and higher
384 * @param multisamples The number of multisamples requested for the context
385 * @return True, if succeeded
386 */
387 virtual bool createOpenGLContext(const bool initializeOpenGL33 = true, const unsigned int multisamples = 1u);
388
389 /**
390 * Releases the OpenGL context of this framebuffer.
391 * @return True, if succeeded
392 */
393 virtual bool releaseOpenGLContext();
394
395#ifdef _WINDOWS
396 /**
397 * Creates a the OpennGL context handle on Windows platforms.
398 * @param dc The device context for which the OpenGL context will be created, must be valid
399 * @param initializeOpenGL33 True, to initialize the capabilities of OpenGL 3.3 and higher
400 * @param multisamples The number of multisamples requested for the context and also the resulting number of multisamples if the context could be created successfully, with range [1, infinity)
401 * @return Resulting OpenGL context handle, if the context could be created
402 */
403 static HGLRC windowsCreateOpenGLContextHandle(HDC dc, const bool initializeOpenGL33, unsigned int& multisamples);
404#endif
405
406 public:
407
408 /// The glGetStringi function.
409 glGetStringiFunction glGetStringi = nullptr;
410
411 /// The glGenFramebuffers function.
412 glGenFramebuffersFunction glGenFramebuffers = nullptr;
413
414 /// The glDeleteFramebuffer function.
415 glDeleteFramebuffersFunction glDeleteFramebuffers = nullptr;
416
417 /// The glBindFramebuffer function.
418 glBindFramebufferFunction glBindFramebuffer = nullptr;
419
420 /// The glGenRenderbuffers functions.
421 glGenRenderbuffersFunction glGenRenderbuffers = nullptr;
422
423 /// The glDeleteRenderbuffers function.
424 glDeleteRenderbuffersFunction glDeleteRenderbuffers = nullptr;
425
426 /// The glBindRenderbuffer function.
427 glBindRenderbufferFunction glBindRenderbuffer = nullptr;
428
429 /// The glRenderbufferStorage function.
430 glRenderbufferStorageFunction glRenderbufferStorage = nullptr;
431
432 /// The glRenderbufferStorageMultisample function.
433 glRenderbufferStorageMultisampleFunction glRenderbufferStorageMultisample = nullptr;
434
435 /// The glFramebufferRenderbuffer function.
436 glFramebufferRenderbufferFunction glFramebufferRenderbuffer = nullptr;
437
438 /// The glBlitFramebuffer function;
439 glBlitFramebufferFunction glBlitFramebuffer = nullptr;
440
441 /// The glCheckFramebufferStatus function.
442 glCheckFramebufferStatusFunction glCheckFramebufferStatus = nullptr;
443
444 /// The glGenBuffers function.
445 glGenBuffersFunction glGenBuffers = nullptr;
446
447 /// The glDeleteBuffers function.
448 glDeleteBuffersFunction glDeleteBuffers = nullptr;
449
450 /// The glBindBuffer function.
451 glBindBufferFunction glBindBuffer = nullptr;
452
453 /// The glBufferData function.
454 glBufferDataFunction glBufferData = nullptr;
455
456 /// The glCreateProgram function.
457 glCreateProgramFunction glCreateProgram = nullptr;
458
459 /// The glDeleteProgram function.
460 glDeleteProgramFunction glDeleteProgram = nullptr;
461
462 /// The glIsProgram function.
463 glIsProgramFunction glIsProgram = nullptr;
464
465 /// The glAttachShader function.
466 glAttachShaderFunction glAttachShader = nullptr;
467
468 /// The glDetachShader function.
469 glDetachShaderFunction glDetachShader = nullptr;
470
471 /// The glLinkProgram function.
472 glLinkProgramFunction glLinkProgram = nullptr;
473
474 /// The glUseProgram function.
475 glUseProgramFunction glUseProgram = nullptr;
476
477 /// The glCreateShader function.
478 glCreateShaderFunction glCreateShader = nullptr;
479
480 /// The glDeleteShader function.
481 glDeleteShaderFunction glDeleteShader = nullptr;
482
483 /// The glCompileShader function.
484 glCompileShaderFunction glCompileShader = nullptr;
485
486 /// The glShaderSource function.
487 glShaderSourceFunction glShaderSource = nullptr;
488
489 /// The glGetProgramiv function.
490 glGetProgramivFunction glGetProgramiv = nullptr;
491
492 /// The glGetShaderiv function.
493 glGetShaderivFunction glGetShaderiv = nullptr;
494
495 /// The glGetProgramInfoLog function.
496 glGetProgramInfoLogFunction glGetProgramInfoLog = nullptr;
497
498 /// The glGetShaderInfoLog function.
499 glGetShaderInfoLogFunction glGetShaderInfoLog = nullptr;
500
501 /// The glGetAttribLocation function.
502 glGetAttribLocationFunction glGetAttribLocation = nullptr;
503
504 /// The glGetUniformLocation function.
505 glGetUniformLocationFunction glGetUniformLocation = nullptr;
506
507 /// The glUniform1i function.
508 glUniform1iFunction glUniform1i = nullptr;
509
510 /// The glUniform1fv function.
511 glUniform1fvFunction glUniform1fv = nullptr;
512
513 /// The glUniform2fv function.
514 glUniform2fvFunction glUniform2fv = nullptr;
515
516 /// The glUniform3fv function.
517 glUniform3fvFunction glUniform3fv = nullptr;
518
519 /// The glUniform4fv function.
520 glUniform4fvFunction glUniform4fv = nullptr;
521
522 /// The glUniformMatrix3fv function.
523 glUniformMatrix3fvFunction glUniformMatrix3fv = nullptr;
524
525 /// The glUniformMatrix4fv function.
526 glUniformMatrix4fvFunction glUniformMatrix4fv = nullptr;
527
528 /// The glEnableVertexAttribArray function.
529 glEnableVertexAttribArrayFunction glEnableVertexAttribArray = nullptr;
530
531 /// The glEnableVertexAttribArray function.
532 glDisableVertexAttribArrayFunction glDisableVertexAttribArray = nullptr;
533
534 /// The glVertexAttribPointer function.
535 glVertexAttribPointerFunction glVertexAttribPointer = nullptr;
536
537 /// The glActiveTexture function.
538 glActiveTextureFunction glActiveTexture = nullptr;
539
540 /// The glGenerateMipmap function.
541 glGenerateMipmapFunction glGenerateMipmap = nullptr;
542
543 /// The glBlendFuncSeparate function.
544 glBlendFuncSeparateFunction glBlendFuncSeparate = nullptr;
545
546 /// The glTexImage2DMultisample function.
547 glTexImage2DMultisampleFunction glTexImage2DMultisample = nullptr;
548
549 /// The glFramebufferTexture2D function.
550 glFramebufferTexture2DFunction glFramebufferTexture2D = nullptr;
551
552 /// The glGenVertexArrays function.
553 glGenVertexArraysFunction glGenVertexArrays = nullptr;
554
555 /// The glDeleteVertexArrays function.
556 glDeleteVertexArraysFunction glDeleteVertexArrays = nullptr;
557
558 /// glBindVertexArray function.
559 glBindVertexArrayFunction glBindVertexArray = nullptr;
560
561 protected:
562
563 /// The OpenGL context handle.
564 void* handle_ = nullptr;
565
566 /// The major version of this OpenGL context.
567 unsigned int majorVersion_ = 0u;
568
569 /// The minor version of this OpenGL context.
570 unsigned int minorVersion_ = 0u;
571
572 /// True, if this context provides the compatibility profile.
573 bool compatibilityProfile_ = false;
574
575 /// The set of supported extensions.
577
578 /// The number of multi samples of this context.
579 unsigned int multisamples_ = 0u;
580
581#ifdef OCEAN_DEBUG
582 // The id of the thread which is responsible for the context.
584#endif
585};
586
587inline unsigned int Context::majorVersion() const
588{
589 return majorVersion_;
590}
591
592inline unsigned int Context::minorVersion() const
593{
594 return minorVersion_;
595}
596
598{
600}
601
603{
604 return extensions_;
605}
606
607inline bool Context::isExtensionSupported(const std::string& extension) const
608{
609 return extensions_.find(extension) != extensions_.end();
610}
611
612inline unsigned int Context::multisamples() const
613{
614 return multisamples_;
615}
616
617}
618
619}
620
621}
622
623#endif // META_OCEAN_PLATFORM_GL_CONTEXT_H
This class encapsulates an OpenGL context.
Definition platform/gl/Context.h:29
virtual bool createOpenGLContext(const bool initializeOpenGL33=true, const unsigned int multisamples=1u)
Creates the OpenGL context for this object.
void(*)(GLsizei, const GLuint *) glDeleteRenderbuffersFunction
Definition of the glDeleteRenderbuffers function pointer type.
Definition platform/gl/Context.h:65
void(*)(GLsizei, GLuint *) glGenVertexArraysFunction
Definition of the glGenVertexArrays function pointer type.
Definition platform/gl/Context.h:285
void(*)(GLenum) glActiveTextureFunction
Definition of the glActiveTexture function pointer type.
Definition platform/gl/Context.h:255
GLint(*)(GLuint, const GLchar *) glGetUniformLocationFunction
Definition of the glGetUniformLocation function pointer type.
Definition platform/gl/Context.h:200
void(*)(GLuint, GLuint) glAttachShaderFunction
Definition of the glAttachShader function pointer type.
Definition platform/gl/Context.h:135
virtual ~Context()
Releases the context.
void(*)(GLuint) glLinkProgramFunction
Definition of the glLinkProgram function pointer type.
Definition platform/gl/Context.h:145
void(*)(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLboolean) glTexImage2DMultisampleFunction
Definition of the glTexImage2DMultisample function pointer type.
Definition platform/gl/Context.h:270
bool isExtensionSupported(const std::string &extension) const
Returns whether a specific extension is supported.
Definition platform/gl/Context.h:607
void(*)(GLenum, GLsizei, GLenum, GLsizei, GLsizei) glRenderbufferStorageMultisampleFunction
Definition of the glRenderbufferStorageMultisample function pointer type.
Definition platform/gl/Context.h:80
void(*)(GLsizei, const GLuint *) glDeleteBuffersFunction
Definition of the glDeleteBuffers function pointer type.
Definition platform/gl/Context.h:105
void(*)(GLuint, GLsizei, const GLchar **, const GLint *) glShaderSourceFunction
Definition of the glShaderSource function pointer type.
Definition platform/gl/Context.h:170
void(*)(GLint, GLsizei, GLboolean, const GLfloat *) glUniformMatrix3fvFunction
Definition of the glUniformMatrix3fv function pointer type.
Definition platform/gl/Context.h:230
void(*)(GLenum) glGenerateMipmapFunction
Definition of the glGenerateMipmap function pointer type.
Definition platform/gl/Context.h:260
void(*)(GLuint, GLsizei, GLsizei *, GLchar *) glGetShaderInfoLogFunction
Definition of the glGetShaderInfoLog function pointer type.
Definition platform/gl/Context.h:190
std::set< std::string > StringSet
Definition of a set holding strings.
Definition platform/gl/Context.h:35
void(*)(GLenum, GLsizeiptr, const GLvoid *, GLenum) glBufferDataFunction
Definition of the glBufferData function pointer type.
Definition platform/gl/Context.h:115
void(*)(GLsizei, GLuint *) glGenFramebuffersFunction
Definition of the glGenFramebuffers function pointer type.
Definition platform/gl/Context.h:45
unsigned int minorVersion_
The minor version of this OpenGL context.
Definition platform/gl/Context.h:570
virtual bool isValid() const
Returns whether this context is valid.
GLuint(*)() glCreateProgramFunction
Definition of the glCreateProgram function pointer type.
Definition platform/gl/Context.h:120
void(*)(GLuint) glBindVertexArrayFunction
Definition of the glBindVertexArray function pointer type.
Definition platform/gl/Context.h:295
void(*)(GLsizei, GLuint *) glGenBuffersFunction
Definition of the glGenBuffers function pointer type.
Definition platform/gl/Context.h:100
void(*)(GLenum, GLenum, GLenum, GLenum) glBlendFuncSeparateFunction
Definition of the glBlendFuncSeparate function pointer type.
Definition platform/gl/Context.h:265
void(*)(GLenum, GLenum, GLsizei, GLsizei) glRenderbufferStorageFunction
Definition of the glRenderbufferStorage function pointer type.
Definition platform/gl/Context.h:75
unsigned int multisamples() const
Returns the number of multi samples that this context supports.
Definition platform/gl/Context.h:612
unsigned int minorVersion() const
Returns the minor OpenGL version of this context.
Definition platform/gl/Context.h:592
void(*)(GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum) glBlitFramebufferFunction
Definition of the glBlitFramebuffer function pointer type.
Definition platform/gl/Context.h:90
void(*)(GLint, GLsizei, const GLfloat *) glUniform2fvFunction
Definition of the glUniform2fv function pointer type.
Definition platform/gl/Context.h:215
void(*)(GLuint, GLenum, GLint *) glGetProgramivFunction
Definition of the glGetProgramiv function pointer type.
Definition platform/gl/Context.h:175
void(*)(GLenum, GLenum, GLenum, GLuint, GLint) glFramebufferTexture2DFunction
Definition of the glFramebufferTexture2D function pointer type.
Definition platform/gl/Context.h:275
void(*)(GLenum, GLenum, GLenum, GLuint) glFramebufferRenderbufferFunction
Definition of the glFramebufferRenderbuffer function pointer type.
Definition platform/gl/Context.h:85
void(*)(GLuint) glUseProgramFunction
Definition of the glUseProgram function pointer type.
Definition platform/gl/Context.h:150
void(*)(GLenum, GLuint) glBindFramebufferFunction
Definition of the glBindFramebuffer function pointer type.
Definition platform/gl/Context.h:55
void(*)(GLint, GLint) glUniform1iFunction
Definition of the glUniform1i function pointer type.
Definition platform/gl/Context.h:205
const StringSet & supportedExtensions() const
Returns the set of supported extensions.
Definition platform/gl/Context.h:602
unsigned int majorVersion() const
Returns the major OpenGL version of this context.
Definition platform/gl/Context.h:587
void(*)(GLint, GLsizei, const GLfloat *) glUniform1fvFunction
Definition of the glUniform1fv function pointer type.
Definition platform/gl/Context.h:210
void(*)(GLsizei, const GLuint *) glDeleteFramebuffersFunction
Definition of the glDeleteFramebuffers function pointer type.
Definition platform/gl/Context.h:50
void(*)(GLsizei, const GLuint *) glDeleteVertexArraysFunction
Definition of the glDeleteVertexArrays function pointer type.
Definition platform/gl/Context.h:290
virtual void release()
Releases the context explicitly.
GLuint(*)(GLenum) glCreateShaderFunction
Definition of the glCreateShader function pointer type.
Definition platform/gl/Context.h:155
void(*)(GLuint) glEnableVertexAttribArrayFunction
Definition of the glEnableVertexAttribArray function pointer type.
Definition platform/gl/Context.h:240
void(*)(GLsizei, GLuint *) glGenRenderbuffersFunction
Definition of the glGenRenderbuffers function pointer type.
Definition platform/gl/Context.h:60
const GLubyte *(*)(GLenum, GLuint) glGetStringiFunction
Definition of the glGetStringi function pointer type.
Definition platform/gl/Context.h:40
virtual void makeCurrent(const bool state=true)=0
Makes the OpenGL rendering context of this framebuffer the calling thread's current rendering context...
bool compatibilityProfile_
True, if this context provides the compatibility profile.
Definition platform/gl/Context.h:573
void(*)(GLuint) glDisableVertexAttribArrayFunction
Definition of the glDisableVertexAttribArray function pointer type.
Definition platform/gl/Context.h:245
void(*)(GLuint) glDeleteProgramFunction
Definition of the glDeleteProgram function pointer type.
Definition platform/gl/Context.h:125
void(*)(GLenum, GLuint) glBindRenderbufferFunction
Definition of the glBindRenderbuffer function pointer type.
Definition platform/gl/Context.h:70
void(*)(GLuint, GLuint, const char *) glBindFragDataLocationFunction
Definition of the glBindFragDataLocation function pointer type.
Definition platform/gl/Context.h:280
void(*)(GLint, GLsizei, const GLfloat *) glUniform3fvFunction
Definition of the glUniform3fv function pointer type.
Definition platform/gl/Context.h:220
bool compatibilityProfile() const
Returns whether this context provides the compatibility profile or the core profile.
Definition platform/gl/Context.h:597
void(*)(GLint, GLsizei, const GLfloat *) glUniform4fvFunction
Definition of the glUniform4fv function pointer type.
Definition platform/gl/Context.h:225
void(*)(GLuint, GLenum, GLint *) glGetShaderivFunction
Definition of the glGetShaderiv function pointer type.
Definition platform/gl/Context.h:180
void(*)(GLuint, GLuint) glDetachShaderFunction
Definition of the glDetachShader function pointer type.
Definition platform/gl/Context.h:140
GLenum(*)(GLenum) glCheckFramebufferStatusFunction
Definition of the glCheckFramebufferStatus function pointer type.
Definition platform/gl/Context.h:95
StringSet extensions_
The set of supported extensions.
Definition platform/gl/Context.h:576
Thread::ThreadId threadId_
Definition platform/gl/Context.h:583
unsigned int majorVersion_
The major version of this OpenGL context.
Definition platform/gl/Context.h:567
void(*)(GLuint, GLsizei, GLsizei *, GLchar *) glGetProgramInfoLogFunction
Definition of the glGetProgramInfoLog function pointer type.
Definition platform/gl/Context.h:185
static HGLRC windowsCreateOpenGLContextHandle(HDC dc, const bool initializeOpenGL33, unsigned int &multisamples)
Creates a the OpennGL context handle on Windows platforms.
virtual bool releaseOpenGLContext()
Releases the OpenGL context of this framebuffer.
void(*)(GLint, GLsizei, GLboolean, const GLfloat *) glUniformMatrix4fvFunction
Definition of the glUniformMatrix4fv function pointer type.
Definition platform/gl/Context.h:235
unsigned int multisamples_
The number of multi samples of this context.
Definition platform/gl/Context.h:579
void(*)(GLuint) glCompileShaderFunction
Definition of the glCompileShader function pointer type.
Definition platform/gl/Context.h:165
virtual bool swapBuffers()
Swaps the foreground and background buffer if this context has two buffers.
void(*)(GLuint) glDeleteShaderFunction
Definition of the glDeleteShader function pointer type.
Definition platform/gl/Context.h:160
void(*)(GLenum, GLuint) glBindBufferFunction
Definition of the glBindBuffer function pointer type.
Definition platform/gl/Context.h:110
HGLRC(*)(HDC, HGLRC, const int *) wglCreateContextAttribsARBFunction
Definition platform/gl/Context.h:299
GLint(*)(GLuint, const GLchar *) glGetAttribLocationFunction
Definition of the glGetAttribLocation function pointer type.
Definition platform/gl/Context.h:195
Context()=default
Creates a new context.
void(*)(GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *) glVertexAttribPointerFunction
Definition of the glVertexAttribPointer function pointer type.
Definition platform/gl/Context.h:250
GLboolean(*)(GLuint) glIsProgramFunction
Definition of the glIsProgram function pointer type.
Definition platform/gl/Context.h:130
This class implements a platform independent wrapper for thread ids.
Definition Thread.h:122
The namespace covering the entire Ocean framework.
Definition Accessor.h:15