Esempio n. 1
0
func (s *MainState) Resize(width, height int) {
	aspect := float32(width) / float32(height)
	if width > height {
		s.projection = mgl32.Ortho2D(-aspect, aspect, -1, 1)
	} else {
		s.projection = mgl32.Ortho2D(-1, 1, -1/aspect, 1/aspect)
	}
	gl.Viewport(0, 0, int32(width), int32(height))
}
Esempio n. 2
0
func (s *MainState) Resize(width int, height int) {
	println("resize!", width, height)
	aspect := float32(width) / float32(height)
	if width > height {
		projection = mgl32.Ortho2D(-aspect, aspect, -1, 1)
	} else {
		projection = mgl32.Ortho2D(-1, 1, -1/aspect, 1/aspect)
	}
	gl.Viewport(0, 0, int32(width), int32(height))

	return
}