egl :: EGLConfigChooser :: defaultinit
# Utility class to choose an EGLConfig
class EGLConfigChooser
var array = new Array[Int]
var closed = false
protected var inserted_attribs = new Array[Int]
protected fun insert_attrib_key(key: Int)
do
assert not inserted_attribs.has(key) else
print "Duplicate attrib passed to EGLConfigChooser"
end
array.add key
end
protected fun insert_attrib_with_val(key, val: Int)
do
insert_attrib_key key
array.add val
end
fun close do
insert_attrib_key 0x3038
closed = true
end
fun surface_type=(flag: Int) do insert_attrib_with_val(0x3033, flag)
fun surface_type_egl do surface_type = 4
# Set which client rendering APIs are supported
fun renderable_type=(flag: Int) do insert_attrib_with_val(0x3040, flag)
# Set EGL as the only supported rendering API
fun renderable_type_egl do renderable_type = 4
fun blue_size=(size: Int) do insert_attrib_with_val(0x3022, size)
fun green_size=(size: Int) do insert_attrib_with_val(0x3023, size)
fun red_size=(size: Int) do insert_attrib_with_val(0x3024, size)
fun buffer_size=(size: Int) do insert_attrib_with_val(0x3020, size)
fun alpha_size=(size: Int) do insert_attrib_with_val(0x3021, size)
fun depth_size=(size: Int) do insert_attrib_with_val(0x3025, size)
fun stencil_size=(size: Int) do insert_attrib_with_val(0x3026, size)
fun samples=(count: Int) do insert_attrib_with_val(0x3031, count)
fun sample_buffers=(size: Int) do insert_attrib_with_val(0x3032, size)
fun caveat=(caveat: EGLConfigCaveat) do insert_attrib_with_val(0x3050, caveat.to_i)
fun conformant=(conformant: EGLConformant) do insert_attrib_with_val(0x3042, conformant.to_i)
fun choose(display: EGLDisplay): nullable Array[EGLConfig]
do
assert closed else print "EGLConfigChooser not closed."
return display.choose_configs(array)
end
end
lib/egl/egl.nit:390,1--444,3