18
18
# along with this framework; if not, see <http://www.gnu.org/licenses/>.
21
######################################################################
22
from lib.common.common import *
23
from lib.egl.egl import *
25
######################################################################
26
def getConfig( apis, surfaces, attributes = {} ):
27
return getEglConfig( apis, surfaces, attributes )
29
######################################################################
21
# ----------------------------------------------------------------------
22
from lib.common import *
25
# ----------------------------------------------------------------------
26
def supportFeature( features ):
27
return set( [ 'EGL' ] ).issuperset( features )
29
# ----------------------------------------------------------------------
30
30
def getScreenSize():
33
######################################################################
33
# ----------------------------------------------------------------------
34
34
def getScreenFormat():
35
35
return 'SCT_COLOR_FORMAT_DEFAULT'
37
######################################################################
38
def initializeWindow( modules, indexTracker, config, size, format ):
37
# ----------------------------------------------------------------------
38
def initialize( modules, indexTracker, api, attributes = {} ):
39
39
Egl = modules[ 'Egl' ]
41
windowSurfaceConfig = EGLWindowSurfaceConfig( [ 0, 0 ],
48
state = eglInitialize( Egl,
42
attributes = getDefaultAttributes( api )
44
colorSpace = 'EGL_NONE'
45
alphaFormat = 'EGL_NONE'
47
colorSpace = 'EGL_VG_COLORSPACE_sRGB'
48
alphaFormat = 'EGL_ALPHA_FORMAT_PRE'
50
a = getEglAttributes( api, SURFACE_WINDOW, attributes )
51
s = [ 0, 0 ] + getScreenSize() + [ getScreenFormat() ] + [ 'EGL_BACK_BUFFER', colorSpace, alphaFormat ]
53
state = eglInitializeWindow( Egl, indexTracker, api, s, a )
54
Egl.SwapInterval( state[ 'displayIndex' ], 0 )
55
######################################################################
56
def swapInterval( state, swapInterval ):
57
eglSwapInterval( state, swapInterval )
59
######################################################################
60
def terminateWindow( modules, state ):
63
######################################################################
58
# ----------------------------------------------------------------------
59
def swapInterval( state, interval ):
61
Egl.SwapInterval( state[ 'displayIndex' ], interval )
63
# ----------------------------------------------------------------------
64
64
def swapBuffers( state ):
65
65
eglSwapBuffers( state )
67
######################################################################
68
def getDefaultSurfaceAttributes( api, surface ):
67
# ----------------------------------------------------------------------
68
def getDefaultAttributes( api, surface = SURFACE_WINDOW ):
71
attributes[ BD_CONFIG_BUFFERSIZE ] = 32
72
attributes[ BD_CONFIG_REDSIZE ] = 8
73
attributes[ BD_CONFIG_GREENSIZE ] = 8
74
attributes[ BD_CONFIG_BLUESIZE ] = 8
75
attributes[ BD_CONFIG_ALPHASIZE ] = 8
76
attributes[ BD_CONFIG_DEPTHSIZE ] = 24
77
attributes[ BD_CONFIG_ALPHAMASKSIZE ] = -1
78
attributes[ BD_CONFIG_SAMPLE_BUFFERS ] = 0
71
if api != API_OPENGLES1:
74
attributes[ CONFIG_BUFFERSIZE ] = 32
75
attributes[ CONFIG_REDSIZE ] = 8
76
attributes[ CONFIG_GREENSIZE ] = 8
77
attributes[ CONFIG_BLUESIZE ] = 8
78
attributes[ CONFIG_ALPHASIZE ] = 8
79
attributes[ CONFIG_DEPTHSIZE ] = '>=16'
80
attributes[ CONFIG_ALPHAMASKSIZE ] = '-'
81
attributes[ CONFIG_SAMPLE_BUFFERS ] = 0