EGl-Context

Wraps the creation of an OpenGL graphics context using the EGL api.

Summary
EGl-ContextWraps the creation of an OpenGL graphics context using the EGL api.
CopyrightThis program is free software.
Files
C-kern/api/platform/OpenGL/EGL/eglcontext.hHeader file EGl-Context.
C-kern/platform/OpenGL/EGL/eglcontext.cImplementation file EGl-Context impl.
Types
opengl_context_tType which tags the native implementation of an OpenGL capable graphics context.
struct eglcontext_tExport eglcontext_t into global namespace.
Functions
test
unittest_platform_opengl_egl_eglcontextTest eglcontext_t functionality.
eglcontext_tPoints to an OpenGL graphics context.
lifetime
eglcontext_FREEStatic initializer.
init_eglcontextInitializes eglcont with a graphic context.
free_eglcontextFrees all associated resources with this context.
query
api_eglcontextReturns in api the client rendering API the context supports.
configid_eglcontextReturns id of the configuration used during context creation in configid.
current_eglcontextGibt den aktuellen OpenGL Kontext in eglcont zurück.
update
setcurrent_eglcontextSetzt den aktuellen OpenGL Kontext für diesen Thread auf eglcont.
releasecurrent_eglcontextDer Verbindung des Threads mit dem aktuellen Kontextes wird aufgehoben.

Copyright

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.

Author

© 2014 Jörg Seebohn

Files

C-kern/api/platform/OpenGL/EGL/eglcontext.h

Header file EGl-Context.

C-kern/platform/OpenGL/EGL/eglcontext.c

Implementation file EGl-Context impl.

Types

opengl_context_t

typedef struct opengl_context_t opengl_context_t

Type which tags the native implementation of an OpenGL capable graphics context.

struct eglcontext_t

Export eglcontext_t into global namespace.

test

unittest_platform_opengl_egl_eglcontext

int unittest_platform_opengl_egl_eglcontext(void)

Test eglcontext_t functionality.

eglcontext_t

typedef opengl_context_t * eglcontext_t

Points to an OpenGL graphics context.  The implementation uses EGL to create the context.

Summary
lifetime
eglcontext_FREEStatic initializer.
init_eglcontextInitializes eglcont with a graphic context.
free_eglcontextFrees all associated resources with this context.
query
api_eglcontextReturns in api the client rendering API the context supports.
configid_eglcontextReturns id of the configuration used during context creation in configid.
current_eglcontextGibt den aktuellen OpenGL Kontext in eglcont zurück.
update
setcurrent_eglcontextSetzt den aktuellen OpenGL Kontext für diesen Thread auf eglcont.
releasecurrent_eglcontextDer Verbindung des Threads mit dem aktuellen Kontextes wird aufgehoben.

lifetime

eglcontext_FREE

#define eglcontext_FREE 0

Static initializer.

init_eglcontext

int init_eglcontext(/*out*/eglcontext_t *eglcont,
struct opengl_display_t *egldisp,
struct opengl_config_t *eglconf,
uint8_t api)

Initializes eglcont with a 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.  The version used by OpenGLES is hard coded to 2.

free_eglcontext

int free_eglcontext(eglcontext_t *eglcont,
struct opengl_display_t *egldisp)

Frees all associated resources with this context.  Make sure that the context is not current (active) to any thread before calling this function.

query

api_eglcontext

int api_eglcontext(const eglcontext_t eglcont,
struct opengl_display_t *egldisp,
/*out*/uint8_t *api)

Returns in api the client rendering API the context supports.  See gcontext_api_e for a list of possible values.

configid_eglcontext

int configid_eglcontext(const eglcontext_t eglcont,
struct opengl_display_t *egldisp,
/*out*/uint32_t *configid)

Returns id of the configuration used during context creation in configid.

current_eglcontext

void current_eglcontext(/*out*/eglcontext_t *eglcont,
/*out*/struct opengl_display_t **egldisp,
/*out*/struct opengl_surface_t **drawsurf,
/*out*/struct opengl_surface_t **readsurf)

Gibt den aktuellen OpenGL Kontext in eglcont zurück.  Die damit verbundenen Typen egldisp, drawsurf and readsurf werden auch zurückgegeben, es sei denn, ein Parameter ist auf 0 gesetzt.  FEHLER: Kann für alle out Parameter 0 zurückliefern, falls aktuelles API != gcontext_api_OPENGLES.

update

setcurrent_eglcontext

int setcurrent_eglcontext(const eglcontext_t eglcont,
struct opengl_display_t *egldisp,
struct opengl_surface_t *drawsurf,
struct opengl_surface_t *readsurf)

Setzt den aktuellen OpenGL Kontext für diesen Thread auf eglcont.  Das aktuelle render API wird auf das von eglcont unterstützte API umgeschalten.  Gibt EACCES zurück falls eglcont gerade von einem anderen Thread verwendet wird oder drawsurf bzw. readsurf an einen anderen Kontext gebunden sind.

releasecurrent_eglcontext

int releasecurrent_eglcontext(struct opengl_display_t *egldisp)

Der Verbindung des Threads mit dem aktuellen Kontextes wird aufgehoben.  Nach erfolgreicher Rückkehr gibt current_eglcontext 0 in allen out Parametern zurück.

Wraps the creation of an OpenGL graphics context using the EGL api.
Implements EGl-Context.
typedef struct opengl_context_t opengl_context_t
Type which tags the native implementation of an OpenGL capable graphics context.
typedef opengl_context_t * eglcontext_t
Points to an OpenGL graphics context.
int unittest_platform_opengl_egl_eglcontext(void)
Test eglcontext_t functionality.
#define eglcontext_FREE 0
Static initializer.
int init_eglcontext(/*out*/eglcontext_t *eglcont,
struct opengl_display_t *egldisp,
struct opengl_config_t *eglconf,
uint8_t api)
Initializes eglcont with a graphic context.
int free_eglcontext(eglcontext_t *eglcont,
struct opengl_display_t *egldisp)
Frees all associated resources with this context.
int api_eglcontext(const eglcontext_t eglcont,
struct opengl_display_t *egldisp,
/*out*/uint8_t *api)
Returns in api the client rendering API the context supports.
int configid_eglcontext(const eglcontext_t eglcont,
struct opengl_display_t *egldisp,
/*out*/uint32_t *configid)
Returns id of the configuration used during context creation in configid.
void current_eglcontext(/*out*/eglcontext_t *eglcont,
/*out*/struct opengl_display_t **egldisp,
/*out*/struct opengl_surface_t **drawsurf,
/*out*/struct opengl_surface_t **readsurf)
Gibt den aktuellen OpenGL Kontext in eglcont zurück.
int setcurrent_eglcontext(const eglcontext_t eglcont,
struct opengl_display_t *egldisp,
struct opengl_surface_t *drawsurf,
struct opengl_surface_t *readsurf)
Setzt den aktuellen OpenGL Kontext für diesen Thread auf eglcont.
int releasecurrent_eglcontext(struct opengl_display_t *egldisp)
Der Verbindung des Threads mit dem aktuellen Kontextes wird aufgehoben.
Determines the rendering API the graphic context supports and the client is using for drawing calls.
The client uses api OpenGL ES for drawing.
Close