Abstracts the os specific way to create an OpenGL graphic context.
Uses lower level of abstractions like eglcontext_t in case of EGL adapting OpenGL to the local windowing system.
Graphic-Context | Abstracts the os specific way to create an OpenGL graphic context. |
Copyright | This program is free software. |
Files | |
C-kern/ | Header file Graphic-Context. |
C-kern/ | Implementation file Graphic-Context impl. |
Types | |
struct gcontext_t | Export gcontext_t into global namespace. |
Enumerations | |
gcontext_api_e | Determines the rendering API the graphic context supports and the client is using for drawing calls. |
Functions | |
test | |
unittest_graphic_gcontext | Test gcontext_t functionality. |
gcontext_t | Wraps the native implementation of an OpenGL context. |
lifetime | |
gcontext_FREE | Static initializer. |
init_gcontext | Creates a new native OpenGL graphic context. |
free_gcontext | Frees graphic context cont and associated resources (frame buffers). |
query | |
gl_gcontext | Returns the native OpenGL context. |
api_gcontext | Returns in api the client rendering API cont supports. |
configid_gcontext | Returns id of the configuration cont in configid used during context creation. |
current_gcontext | Returns the current native OpenGL context and associated native resources. |
update | |
setcurrent_gcontext | Setzt den aktuellen OpenGL Kontext für diesen Thread auf cont. |
releasecurrent_gcontext | Der Verbindung des Threads mit dem aktuellen Kontextes wird aufgehoben. |
inline implementation | |
gcontext_t | |
gl_gcontext | Implements gcontext_t.gl_gcontext. |
api_gcontext | Implements gcontext_t.api_gcontext. |
configid_gcontext | Implements gcontext_t.configid_gcontext. |
current_gcontext | Implements gcontext_t.current_gcontext. |
releasecurrent_gcontext | Implements gcontext_t.releasecurrent_gcontext. |
setcurrent_gcontext | Implements gcontext_t.setcurrent_gcontext. |
This program is free software. You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
© 2014 Jörg Seebohn
Header file Graphic-Context.
Implementation file Graphic-Context impl.
typedef struct gcontext_t gcontext_t
Export gcontext_t into global namespace.
Determines the rendering API the graphic context supports and the client is using for drawing calls.
gcontext_api_OPENGLES | The client uses api OpenGL ES for drawing. The default version is 2. The version can be configured during creation of eglcontext_t. |
gcontext_api_OPENVG | The client uses api OpenVG for drawing. |
gcontext_api_OPENGL | The client uses api OpenGL for drawing. |
test | |
unittest_graphic_gcontext | Test gcontext_t functionality. |
int unittest_graphic_gcontext( void )
Test gcontext_t functionality.
struct gcontext_t
Wraps the native implementation of an OpenGL context.
lifetime | |
gcontext_FREE | Static initializer. |
init_gcontext | Creates a new native OpenGL graphic context. |
free_gcontext | Frees graphic context cont and associated resources (frame buffers). |
query | |
gl_gcontext | Returns the native OpenGL context. |
api_gcontext | Returns in api the client rendering API cont supports. |
configid_gcontext | Returns id of the configuration cont in configid used during context creation. |
current_gcontext | Returns the current native OpenGL context and associated native resources. |
update | |
setcurrent_gcontext | Setzt den aktuellen OpenGL Kontext für diesen Thread auf cont. |
releasecurrent_gcontext | Der Verbindung des Threads mit dem aktuellen Kontextes wird aufgehoben. |
int init_gcontext( /*out*/gcontext_t * cont, struct display_t * disp, struct gconfig_t * gconf, uint8_t api )
Creates a new native OpenGL graphic context. The context supports rendering with a render API determined by api. Parameter api must be a value from gcontext_api_e. If eglconf does not support the rendering API EINVAL is returned. A copy of the pointer disp is stored internally so do not free display_t disp until win has been freed.
int api_gcontext( const gcontext_t * cont, struct display_t * disp, /*out*/uint8_t * api )
Returns in api the client rendering API cont supports. See gcontext_api_e for a list of possible values.
void current_gcontext( /*out*/struct opengl_context_t ** cont, /*out*/struct opengl_display_t ** disp, /*out*/struct opengl_surface_t ** drawsurf, /*out*/struct opengl_surface_t ** readsurf )
Returns the current native OpenGL context and associated native resources. A an out pointer is set to 0 no value is returned.
Bug: This function returns 0 for any out parameter in case the current context uses not API gcontext_api_OPENGLES.
int setcurrent_gcontext( const gcontext_t cont, struct display_t * disp, struct surface_t * drawsurf, struct surface_t * readsurf )
Setzt den aktuellen OpenGL Kontext für diesen Thread auf cont. Das aktuelle render API wird auf das von cont unterstützte API umgeschalten. Gibt EACCES zurück falls cont gerade von einem anderen Thread verwendet wird oder drawsurf bzw. readsurf an einen anderen Kontext gebunden sind.
gcontext_t | |
gl_gcontext | Implements gcontext_t.gl_gcontext. |
api_gcontext | Implements gcontext_t.api_gcontext. |
configid_gcontext | Implements gcontext_t.configid_gcontext. |
current_gcontext | Implements gcontext_t.current_gcontext. |
releasecurrent_gcontext | Implements gcontext_t.releasecurrent_gcontext. |
setcurrent_gcontext | Implements gcontext_t.setcurrent_gcontext. |
#define gl_gcontext( cont ) ((cont)->glcontext)
Implements gcontext_t.gl_gcontext.
#define api_gcontext( cont, disp, api ) api_eglcontext(gl_gcontext(cont), gl_display(disp), api)
Implements gcontext_t.api_gcontext.
#define configid_gcontext( cont, disp, configid ) configid_eglcontext(gl_gcontext(cont), gl_display(disp), configid)
Implements gcontext_t.configid_gcontext.
#define current_gcontext( cont, disp, drawsurf, readsurf ) current_eglcontext(cont, disp, drawsurf, readsurf)
Implements gcontext_t.current_gcontext.
#define releasecurrent_gcontext( disp ) releasecurrent_eglcontext(gl_display(disp))
Implements gcontext_t.releasecurrent_gcontext.
#define setcurrent_gcontext( cont, disp, drawsurf, readsurf ) setcurrent_eglcontext(gl_gcontext(cont), gl_display(disp), gl_surface(drawsurf), gl_surface(readsurf))
Implements gcontext_t.setcurrent_gcontext.
Export gcontext_t into global namespace.
typedef struct gcontext_t gcontext_t
Wraps the native implementation of an OpenGL context.
struct gcontext_t
Test gcontext_t functionality.
int unittest_graphic_gcontext( void )
Static initializer.
#define gcontext_FREE { 0 }
Creates a new native OpenGL graphic context.
int init_gcontext( /*out*/gcontext_t * cont, struct display_t * disp, struct gconfig_t * gconf, uint8_t api )
Frees graphic context cont and associated resources (frame buffers).
int free_gcontext( gcontext_t * cont, struct display_t * disp )
Returns the native OpenGL context.
struct opengl_context_t * gl_gcontext( const gcontext_t * cont )
Returns in api the client rendering API cont supports.
int api_gcontext( const gcontext_t * cont, struct display_t * disp, /*out*/uint8_t * api )
Returns id of the configuration cont in configid used during context creation.
int configid_gcontext( const gcontext_t * cont, struct display_t * disp, /*out*/uint32_t * configid )
Returns the current native OpenGL context and associated native resources.
void current_gcontext( /*out*/struct opengl_context_t ** cont, /*out*/struct opengl_display_t ** disp, /*out*/struct opengl_surface_t ** drawsurf, /*out*/struct opengl_surface_t ** readsurf )
Setzt den aktuellen OpenGL Kontext für diesen Thread auf cont.
int setcurrent_gcontext( const gcontext_t cont, struct display_t * disp, struct surface_t * drawsurf, struct surface_t * readsurf )
Der Verbindung des Threads mit dem aktuellen Kontextes wird aufgehoben.
int releasecurrent_gcontext( struct display_t * disp )
Implements gcontext_t.gl_gcontext.
#define gl_gcontext( cont ) ((cont)->glcontext)
Implements gcontext_t.api_gcontext.
#define api_gcontext( cont, disp, api ) api_eglcontext(gl_gcontext(cont), gl_display(disp), api)
Implements gcontext_t.configid_gcontext.
#define configid_gcontext( cont, disp, configid ) configid_eglcontext(gl_gcontext(cont), gl_display(disp), configid)
Implements gcontext_t.current_gcontext.
#define current_gcontext( cont, disp, drawsurf, readsurf ) current_eglcontext(cont, disp, drawsurf, readsurf)
Implements gcontext_t.releasecurrent_gcontext.
#define releasecurrent_gcontext( disp ) releasecurrent_eglcontext(gl_display(disp))
Implements gcontext_t.setcurrent_gcontext.
#define setcurrent_gcontext( cont, disp, drawsurf, readsurf ) setcurrent_eglcontext(gl_gcontext(cont), gl_display(disp), gl_surface(drawsurf), gl_surface(readsurf))
Points to an OpenGL graphics context.
typedef opengl_context_t * eglcontext_t
Wraps the OS specific graphics display.
struct display_t