Exemplo n.º 1
0
func display() {
	gl.Clear(gl.COLOR_BUFFER_BIT)
	bitmap_output(40, 35, "This is written in a GLUT bitmap font.", glut.BITMAP_TIMES_ROMAN_24)
	bitmap_output(30, 210, "More bitmap text is a fixed 9 by 15 font.", glut.BITMAP_9_BY_15)
	bitmap_output(70, 240, "                Helvetica is yet another bitmap font.", glut.BITMAP_HELVETICA_18)

	gl.MatrixMode(gl.PROJECTION)
	gl.PushMatrix()
	gl.LoadIdentity()
	glu.Perspective(40.0, 1.0, 0.1, 20.0)
	gl.MatrixMode(gl.MODELVIEW)
	gl.PushMatrix()
	glu.LookAt(0.0, 0.0, 4.0, /* eye is at (0,0,30) */
		0.0, 0.0, 0.0, /* center is at (0,0,0) */
		0.0, 1.0, 0.0) /* up is in postivie Y direction */
	gl.PushMatrix()
	gl.Translatef(0, 0, -4)
	gl.Rotatef(50, 0, 1, 0)
	stroke_output(-2.5, 1.1, "  This is written in a", glut.STROKE_ROMAN)
	stroke_output(-2.5, 0, " GLUT stroke font.", glut.STROKE_ROMAN)
	stroke_output(-2.5, -1.1, "using 3D perspective.", glut.STROKE_ROMAN)
	gl.PopMatrix()
	gl.MatrixMode(gl.MODELVIEW)
	gl.PopMatrix()
	gl.MatrixMode(gl.PROJECTION)
	gl.PopMatrix()
	gl.MatrixMode(gl.MODELVIEW)
	gl.Flush()
}
Exemplo n.º 2
0
func RunGamehost() {
	if !glfw.Init() {
		panic("Cannot init GLFW")
	}

	defer glfw.Terminate()

	window, err := glfw.CreateWindow(800, 600, "Apollo", nil, nil)
	if err != nil {
		panic(err)
	}

	window.MakeContextCurrent()
	gamehost_Window = window

	gl.ClearColor(1, 1, 1, 1)
	glu.LookAt(0, 1.5, 5, 0, 0, 0, 0, 1, 0)
	frame := 0

	EvaluateString("(trigger GAMEHOST Init!)", MainContext)

	gamehost_world.Create(CreateCube(0, 0, 0))

	for !gamehost_Window.ShouldClose() {
		gl.Clear(gl.COLOR_BUFFER_BIT)
		gl.LoadIdentity()
		gamehost_Window.SetTitle(fmt.Sprintf("Frame #%v", frame))
		frame++

		EvaluateString("(gameloop 0.016)", MainContext)

		gamehost_world.Render()
		graphicsQueue.Process()

		gamehost_Window.SwapBuffers()
		glfw.PollEvents()
	}

	EvaluateString("(trigger GAMEHOST Shutdown!)", MainContext)
}