Ejemplo n.º 1
0
func (display *Display) ChooseConfig(attribList []Attrib) ([]Config, error) {
	var eglAttribs *C.EGLint
	if attribList != nil {
		eglAttribs = (*C.EGLint)(&(attribList[0]))
	}

	var configCount C.EGLint
	success := C.eglChooseConfig(display.eglDisplay, eglAttribs, nil, 0, &configCount)
	if success == C.EGL_FALSE {
		return nil, getError()
	}

	if configCount <= 0 {
		configCount = 10
	}
	configurations := make([]Config, configCount)

	success = C.eglChooseConfig(
		display.eglDisplay,
		eglAttribs,
		(*C.EGLConfig)(&(configurations[0])),
		configCount,
		&configCount)
	//fmt.Printf("success == %d, configCount == %d\n", success, configCount)
	if success == C.EGL_FALSE {
		return nil, getError()
	}
	if configCount <= 0 {
		return nil, errors.New("eglGetConfigs() returned zero configs")
	}

	return configurations[:configCount], nil
}
Ejemplo n.º 2
0
func ChooseConfig(disp Display, atrribList []int32, configs *Config,
	configSize int32, numConfig *int32) bool {

	return goBoolean(C.eglChooseConfig(C.EGLDisplay(unsafe.Pointer(disp)),
		(*C.EGLint)(&atrribList[0]),
		(*C.EGLConfig)(unsafe.Pointer(configs)),
		C.EGLint(configSize),
		(*C.EGLint)(numConfig)))
}