Example #1
0
func initPlatform() {
	egl.BCMHostInit()
	screenWidth, screenHeight = egl.GraphicsGetDisplaySize(0)

	dstRect.X = 0
	dstRect.Y = 0
	dstRect.Width = int32(screenWidth)
	dstRect.Height = int32(screenHeight)

	srcRect.X = 0
	srcRect.Y = 0
	srcRect.Width = int32(screenWidth << 16)
	srcRect.Height = int32(screenHeight << 16)

	dispman_display := egl.VCDispmanxDisplayOpen(0 /* LCD */)
	dispman_update := egl.VCDispmanxUpdateStart(0)

	dispman_element := egl.VCDispmanxElementAdd(
		dispman_update,
		dispman_display,
		0, /*layer */
		&dstRect,
		0, /*src */
		&srcRect,
		egl.DISPMANX_PROTECTION_NONE,
		nil, /*alpha */
		nil, /*clamp */
		0 /*transform */)

	dispmanxTestWin.Element = dispman_element
	dispmanxTestWin.Width = int(screenWidth)
	dispmanxTestWin.Height = int(screenHeight)
	egl.VCDispmanxUpdateSubmitSync(dispman_update)
	testWin = egl.NativeWindowType(unsafe.Pointer(&dispmanxTestWin))
}
Example #2
0
func initEGL(controlCh *controlCh, width, height int) *platform.EGLState {
	egl.BCMHostInit()
	return raspberry.Initialize(
		raspberry.DefaultConfigAttributes,
		raspberry.DefaultContextAttributes,
	)
	go func() {
		fmt.Scanln()
		controlCh.exit <- true
	}
}