示例#1
0
文件: egl.go 项目: nick-fedesna/egles
func CreateContext(disp Display, config Config,
	shareContext Context, attribList *int32) Context {

	return Context(C.eglCreateContext(C.EGLDisplay(unsafe.Pointer(disp)),
		C.EGLConfig(unsafe.Pointer(config)),
		C.EGLContext(unsafe.Pointer(shareContext)),
		(*C.EGLint)(attribList)))
}
示例#2
0
文件: display.go 项目: foobaz/egl
func (display *Display) CreateContext(config Config, shareContext *Context, attribList []Attrib) (*Context, error) {
	var eglShareContext C.EGLContext
	if shareContext != nil {
		eglShareContext = shareContext.eglContext
	}

	var eglAttribs *C.EGLint
	if attribList != nil {
		eglAttribs = (*C.EGLint)(&(attribList[0]))
	}

	eglContext := C.eglCreateContext(display.eglDisplay, C.EGLConfig(config), eglShareContext, eglAttribs)
	if eglContext == noContext {
		return nil, getError()
	}

	context := new(Context)
	//runtime.SetFinalizer(context, destroyContext)
	context.eglContext = eglContext
	context.Display = display
	return context, nil
}