示例#1
0
文件: simple.go 项目: KUGDC/GoServe
func initWindow() {

	// Function called to do the re-rendering
	glut.DisplayFunc(display)
	// Called when the visibility of the program changes
	glut.VisibilityFunc(visible)
	// Called when a regular ascii character is pressed
	glut.KeyboardFunc(keyboardIn)
	// Called when any non-ascii character is pressed
	glut.SpecialFunc(specialIn)
	// Called when the size of the window changes
	glut.ReshapeFunc(reshape)

	// affect our projection matrix
	gl.MatrixMode(gl.PROJECTION)
	gl.LoadIdentity() // Load an identity matrix -> projection
	// Specify the bounds of the of our scene
	gl.Ortho(0, 40, 0, 40, 0, 40)

	// Now affect our modelview matrix
	gl.MatrixMode(gl.MODELVIEW)
	// Make points be rendererd larger
	gl.PointSize(3.0)

	currentWindow = glut.GetWindow()
}
示例#2
0
文件: asteroids.go 项目: tmc/glut
func initWindow() {
	glut.IgnoreKeyRepeat(1)

	glut.DisplayFunc(display)
	glut.VisibilityFunc(visible)
	glut.KeyboardFunc(key)
	glut.KeyboardUpFunc(keyup)
	glut.SpecialFunc(special)
	glut.SpecialUpFunc(specialup)
	glut.JoystickFunc(joystick, 100)

	gl.MatrixMode(gl.PROJECTION)
	gl.LoadIdentity()
	gl.Ortho(0, 40, 0, 40, 0, 40)
	gl.MatrixMode(gl.MODELVIEW)
	gl.PointSize(3.0)

	currentWindow = glut.GetWindow()
}