Exemple #1
0
func main() {
	var err os.Error
	if err = glfw.Init(); err != nil {
		fmt.Fprintf(os.Stderr, "%v\n", err)
		return
	}

	defer glfw.Terminate()

	// Open window with FSAA samples (if possible).
	glfw.OpenWindowHint(glfw.FsaaSamples, 4)

	if err = glfw.OpenWindow(400, 400, 0, 0, 0, 0, 0, 0, glfw.Windowed); err != nil {
		fmt.Fprintf(os.Stderr, "%v\n", err)
		return
	}

	defer glfw.CloseWindow()

	glfw.SetWindowTitle("Aliasing Detector")
	glfw.SetSwapInterval(1)

	if samples := glfw.WindowParam(glfw.FsaaSamples); samples != 0 {
		fmt.Fprintf(os.Stdout, "Context reports FSAA is supported with %d samples\n", samples)
	} else {
		fmt.Fprintf(os.Stdout, "Context reports FSAA is unsupported\n")
	}

	gl.MatrixMode(gl.PROJECTION)
	glu.Perspective(0, 1, 0, 1)

	for glfw.WindowParam(glfw.Opened) == 1 {
		time := float32(glfw.Time())

		gl.Clear(gl.COLOR_BUFFER_BIT)

		gl.LoadIdentity()
		gl.Translatef(0.5, 0, 0)
		gl.Rotatef(time, 0, 0, 1)

		gl.Enable(GL_MULTISAMPLE_ARB)
		gl.Color3f(1, 1, 1)
		gl.Rectf(-0.25, -0.25, 0.25, 0.25)

		gl.LoadIdentity()
		gl.Translatef(-0.5, 0, 0)
		gl.Rotatef(time, 0, 0, 1)

		gl.Disable(GL_MULTISAMPLE_ARB)
		gl.Color3f(1, 1, 1)
		gl.Rectf(-0.25, -0.25, 0.25, 0.25)
		glfw.SwapBuffers()
	}
}
// Here goes our drawing code
func drawGLScene() {
	// Clear the screen and depth buffer
	gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)

	// Move left 1.5 units and into the screen 6.0 units.
	gl.LoadIdentity()
	gl.Translatef(-1.5, 0.0, -6.0)
	gl.Rotatef(float32(rtri), 0.0, 1.0, 0.0) // Rotate the triangle on the Y axis

	gl.Begin(gl.TRIANGLES)       // Draw triangles
	gl.Color3f(1.0, 0.0, 0.0)    // Set The Color To Red
	gl.Vertex3f(0.0, 1.0, 0.0)   // top
	gl.Color3f(0.0, 1.0, 0.0)    // Set The Color To Red
	gl.Vertex3f(-1.0, -1.0, 0.0) // bottom left
	gl.Color3f(0.0, 0.0, 1.0)    // Set The Color To Red
	gl.Vertex3f(1.0, -1.0, 0.0)  // bottom right
	gl.End()                     // finish drawing the triangle

	// Move right 3 units
	gl.LoadIdentity()
	gl.Translatef(1.5, 0.0, -6.0)
	gl.Color3f(0.5, 0.5, 1.0)                 // Set The Color To Blue One Time Only
	gl.Rotatef(float32(rquad), 1.0, 0.0, 0.0) // rotate the quad on the X axis

	gl.Begin(gl.QUADS)           // draw quads
	gl.Vertex3f(-1.0, 1.0, 0.0)  // top left
	gl.Vertex3f(1.0, 1.0, 0.0)   // top right
	gl.Vertex3f(1.0, -1.0, 0.0)  // bottom right
	gl.Vertex3f(-1.0, -1.0, 0.0) // bottom left
	gl.End()                     // done drawing the quad

	// Draw to the screen
	sdl.GL_SwapBuffers()

	rtri += 0.2   // Increase The Rotation Variable For The Triangle
	rquad -= 0.15 // Decrease The Rotation Variable For The Quad

	// Gather our frames per second
	frames++
	t := sdl.GetTicks()
	if t-t0 >= 5000 {
		seconds := (t - t0) / 1000.0
		fps := frames / seconds
		fmt.Println(frames, "frames in", seconds, "seconds =", fps, "FPS")
		t0 = t
		frames = 0
	}
}
Exemple #3
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()
	// Banthar's glu doesn't have this right now.
	// 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.) /* 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()
}
Exemple #4
0
func drawShip(angle gl.GLfloat) {
	gl.PushMatrix()
	gl.Translatef(x, y, 0.0)
	gl.Rotatef(angle, 0.0, 0.0, 1.0)
	if thrust {
		gl.Color3f(1.0, 0.0, 0.0)
		gl.Begin(gl.LINE_STRIP)
		gl.Vertex2f(-0.75, -0.5)
		gl.Vertex2f(-1.75, 0)
		gl.Vertex2f(-0.75, 0.5)
		gl.End()
	}
	gl.Color3f(1.0, 1.0, 0.0)
	gl.Begin(gl.LINE_LOOP)
	gl.Vertex2f(2.0, 0.0)
	gl.Vertex2f(-1.0, -1.0)
	gl.Vertex2f(-0.5, 0.0)
	gl.Vertex2f(-1.0, 1.0)
	gl.Vertex2f(2.0, 0.0)
	gl.End()
	if shield {
		gl.Color3f(0.1, 0.1, 1.0)
		gl.Begin(gl.LINE_LOOP)
		for rad := 0.0; rad < 12.0; rad += 1.0 {
			gl.Vertex2f(
				gl.GLfloat(2.3*math.Cos(2*float64(rad)/math.Pi)+0.2),
				gl.GLfloat(2.0*math.Sin(2*float64(rad)/math.Pi)))
		}
		gl.End()
	}
	gl.PopMatrix()
}
Exemple #5
0
func stroke_output(x, y gl.GLfloat, str string, font glut.StrokeFont) {
	gl.PushMatrix()
	gl.Translatef(x, y, 0)
	gl.Scalef(0.005, 0.005, 0.005)
	for _, ch := range str {
		font.Character(ch)
	}
	gl.PopMatrix()
}
Exemple #6
0
func reshape(w, h int) {
	gl.Viewport(0, 0, gl.GLsizei(w), gl.GLsizei(h))
	gl.MatrixMode(gl.PROJECTION)
	gl.LoadIdentity()
	gl.Ortho(0, gl.GLdouble(w), 0, gl.GLdouble(h), -1, 1)
	gl.Scalef(1, -1, 1)
	gl.Translatef(0, gl.GLfloat(-h), 0)
	gl.MatrixMode(gl.MODELVIEW)
}
Exemple #7
0
func reshape(w, h int) {
	gl.Viewport(0, 0, w, h)
	gl.MatrixMode(gl.PROJECTION)
	gl.LoadIdentity()
	gl.Ortho(0, float64(w), 0, float64(h), -1, 1)
	gl.Scalef(1, -1, 1)
	gl.Translatef(0, float32(-h), 0)
	gl.MatrixMode(gl.MODELVIEW)
}
Exemple #8
0
func (self *Camera) Setup() {
	d := self.Distance
	Angle := self.Angle
	Angle360 := Angle.Scale(1 / math.Pi * 180)
	TargetPos := self.Target.Pos

	gl.MatrixMode(gl.PROJECTION)
	gl.LoadIdentity()
	gl.Viewport(0, 0, 800, 600)
	gl.Frustum(-1, 1, -1, 1, 4, 1000)

	gl.MatrixMode(gl.MODELVIEW)
	gl.LoadIdentity()
	gl.Translatef(0, 0, -d)
	gl.Rotatef(Angle360.Y, 1, 0, 0)
	gl.Rotatef(Angle360.X, 0, 1, 0)
	gl.Translatef(-TargetPos.X, -TargetPos.Y, -TargetPos.Z)

}
Exemple #9
0
/* new window size or exposure */
func reshape(width int, height int) {

	h := float64(height) / float64(width)

	gl.Viewport(0, 0, width, height)
	gl.MatrixMode(gl.PROJECTION)
	gl.LoadIdentity()
	gl.Frustum(-1.0, 1.0, -h, h, 5.0, 60.0)
	gl.MatrixMode(gl.MODELVIEW)
	gl.LoadIdentity()
	gl.Translatef(0.0, 0.0, -40.0)
}
Exemple #10
0
func draw() {
	xtrans := -xpos
	ztrans := -zpos
	ytrans := -walkbias - 0.25
	scenroty := 360.0 - yrot

	// Clear the screen and depth buffer
	gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)

	// reset the view
	gl.LoadIdentity()

	// Rotate up and down to look up and down
	gl.Rotatef(lookupdown, 1.0, 0.0, 0.0)
	// Rotate depending on direction player is facing
	gl.Rotatef(scenroty, 0.0, 1.0, 0.0)
	// translate the scene based on player position
	gl.Translatef(xtrans, ytrans-1.75, ztrans)

	for _, chunk := range chunks {
		for y := 0; y < 16; y++ {
			for x := 0; x < 16; x++ {
				for z := 0; z <= 16; z++ {
					if len(chunk.Data[y][x]) > z && chunk.Data[y][x][z] != "" {
						gl.PushMatrix()
						gl.Translated(
							float64(16*chunk.X+x),
							float64(z),
							float64(16*chunk.Y+y))
						gl.CallList(cubes[chunk.Data[y][x][z]])
						gl.PopMatrix()
					}
				}
			}
		}
	}

	gl.PopMatrix()

	sdl.GL_SwapBuffers()

	Frames++
	{
		t := sdl.GetTicks()
		if t-T0 >= 5000 {
			seconds := (t - T0) / 1000.0
			fps := Frames / seconds
			print(Frames, " frames in ", seconds, " seconds = ", fps, " FPS\n")
			T0 = t
			Frames = 0
		}
	}
}
Exemple #11
0
// Here goes our drawing code
func drawGLScene() {
	// Clear the screen and depth buffer
	gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)

	// Move left 1.5 units and into the screen 6.0 units.
	gl.LoadIdentity()
	gl.Translatef(-1.5, 0.0, -6.0)

	gl.Begin(gl.TRIANGLES)       // Draw triangles
	gl.Vertex3f(0.0, 1.0, 0.0)   // top
	gl.Vertex3f(-1.0, -1.0, 0.0) // bottom left
	gl.Vertex3f(1.0, -1.0, 0.0)  // bottom right
	gl.End()                     // finish drawing the triangle

	// Move right 3 units
	gl.Translatef(3.0, 0.0, 0.0)

	gl.Begin(gl.QUADS)           // draw quads
	gl.Vertex3f(-1.0, 1.0, 0.0)  // top left
	gl.Vertex3f(1.0, 1.0, 0.0)   // top right
	gl.Vertex3f(1.0, -1.0, 0.0)  // bottom right
	gl.Vertex3f(-1.0, -1.0, 0.0) // bottom left
	gl.End()                     // done drawing the quad

	// Draw to the screen
	sdl.GL_SwapBuffers()

	// Gather our frames per second
	frames++
	t := sdl.GetTicks()
	if t-t0 >= 5000 {
		seconds := (t - t0) / 1000.0
		fps := frames / seconds
		fmt.Println(frames, "frames in", seconds, "seconds =", fps, "FPS")
		t0 = t
		frames = 0
	}
}
Exemple #12
0
func reshape(w, h int) {
	/* Because Gil specified "screen coordinates" (presumably with an
	   upper-left origin), this short bit of code sets up the coordinate
	   system to correspond to actual window coodrinates.  This code
	   wouldn't be required if you chose a (more typical in 3D) abstract
	   coordinate system. */

	gl.Viewport(0, 0, w, h)                       /* Establish viewing area to cover entire window. */
	gl.MatrixMode(gl.PROJECTION)                  /* Start modifying the projection matrix. */
	gl.LoadIdentity()                             /* Reset project matrix. */
	gl.Ortho(0, float64(w), 0, float64(h), -1, 1) /* Map abstract coords directly to window coords. */
	gl.Scalef(1, -1, 1)                           /* Invert Y axis so increasing Y goes down. */
	gl.Translatef(0, float32(-h), 0)              /* Shift origin up to upper-left corner. */
}
Exemple #13
0
func resetZoom() {
	// Reset viewport
	gl.LoadIdentity()
	gl.MatrixMode(gl.PROJECTION)
	gl.LoadIdentity()

	// Reset ortho view
	gl.Ortho(left, right, bottom, top, 1, -1)
	gl.Rotatef(180, 0, 0, 0)
	gl.Translatef(float32(-*cx), float32(-*cy), 0)
	gl.MatrixMode(gl.MODELVIEW)
	gl.Disable(gl.DEPTH_TEST)
	gl.LoadIdentity()
}
// Here goes our drawing code
func drawGLScene(sector Sector) {
	xtrans := gl.GLfloat(-xpos)
	ztrans := gl.GLfloat(-zpos)
	ytrans := gl.GLfloat(-walkbias - 0.25)
	scenroty := gl.GLfloat(360.0 - yrot)

	// Clear the screen and depth buffer
	gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)

	// reset the view
	gl.LoadIdentity()

	// Rotate up and down to look up and down
	gl.Rotatef(float32(lookupdown), 1.0, 0.0, 0.0)
	// Rotate depending on direction player is facing
	gl.Rotatef(float32(scenroty), 0.0, 1.0, 0.0)
	// translate the scene based on player position
	gl.Translatef(float32(xtrans), float32(ytrans), float32(ztrans))

	gl.BindTexture(gl.TEXTURE_2D, uint(textures[filter]))

	for _, vertices := range sector {
		gl.Begin(gl.TRIANGLES)
		for _, triangle := range *vertices {
			gl.Normal3f(0.0, 0.0, 1.0)
			gl.TexCoord2f(float32(triangle.u), float32(triangle.v))
			gl.Vertex3f(float32(triangle.x), float32(triangle.y), float32(triangle.z))
		}
		gl.End()
	}

	// Draw to the screen
	sdl.GL_SwapBuffers()

	// Gather our frames per second
	frames++
	t := sdl.GetTicks()
	if t-t0 >= 5000 {
		seconds := (t - t0) / 1000.0
		fps := frames / seconds
		fmt.Println(frames, "frames in", seconds, "seconds =", fps, "FPS")
		t0 = t
		frames = 0
	}
}
Exemple #15
0
func reshape(w, h int) {
	/* Because Gil specified "screen coordinates" (presumably with an
	   upper-left origin), this short bit of code sets up the coordinate
	   system to correspond to actual window coodrinates.  This code
	   wouldn't be required if you chose a (more typical in 3D) abstract
	   coordinate system. */
	gl.ClearColor(1, 1, 1, 1)
	//fmt.Println(gl.GetString(gl.EXTENSIONS))
	gl.Viewport(0, 0, w, h)                       /* Establish viewing area to cover entire window. */
	gl.MatrixMode(gl.PROJECTION)                  /* Start modifying the projection matrix. */
	gl.LoadIdentity()                             /* Reset project matrix. */
	gl.Ortho(0, float64(w), 0, float64(h), -1, 1) /* Map abstract coords directly to window coords. */
	gl.Scalef(1, -1, 1)                           /* Invert Y axis so increasing Y goes down. */
	gl.Translatef(0, float32(-h), 0)              /* Shift origin up to upper-left corner. */
	gl.Enable(gl.BLEND)
	gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
	gl.Disable(gl.DEPTH_TEST)
	width, height = w, h
}
Exemple #16
0
func drawMass(m *phys.Mass, dsz gl.GLfloat) {

	gl.LoadIdentity()
	//	gl.Translatef( -1.5, 0.0, -6.0 )

	v := m.Pos
	gl.Translatef(gl.GLfloat(v.X), gl.GLfloat(v.Y), gl.GLfloat(v.Z))

	/* Rotate The Triangle On The Y axis ( NEW ) */
	// gl.Rotatef( rtri, 0.0, 1.0, 0.0 );

	gl.Begin(gl.TRIANGLES)       /* Drawing Using Triangles       */
	gl.Color3f(dsz, 0.0, 0.0)    /* Red                           */
	gl.Vertex3f(0.0, dsz, 0.0)   /* Top Of Triangle (Front)       */
	gl.Color3f(0.0, dsz, 0.0)    /* Green                         */
	gl.Vertex3f(-dsz, -dsz, dsz) /* Left Of Triangle (Front)      */
	gl.Color3f(0.0, 0.0, dsz)    /* Blue                          */
	gl.Vertex3f(dsz, -dsz, dsz)  /* Right Of Triangle (Front)     */

	gl.Color3f(dsz, 0.0, 0.0)    /* Red                           */
	gl.Vertex3f(0.0, dsz, 0.0)   /* Top Of Triangle (Right)       */
	gl.Color3f(0.0, 0.0, dsz)    /* Blue                          */
	gl.Vertex3f(dsz, -dsz, dsz)  /* Left Of Triangle (Right)      */
	gl.Color3f(0.0, dsz, 0.0)    /* Green                         */
	gl.Vertex3f(dsz, -dsz, -dsz) /* Right Of Triangle (Right)     */

	gl.Color3f(dsz, 0.0, 0.0)     /* Red                           */
	gl.Vertex3f(0.0, dsz, 0.0)    /* Top Of Triangle (Back)        */
	gl.Color3f(0.0, dsz, 0.0)     /* Green                         */
	gl.Vertex3f(dsz, -dsz, -dsz)  /* Left Of Triangle (Back)       */
	gl.Color3f(0.0, 0.0, dsz)     /* Blue                          */
	gl.Vertex3f(-dsz, -dsz, -dsz) /* Right Of Triangle (Back)      */

	gl.Color3f(dsz, 0.0, 0.0)     /* Red                           */
	gl.Vertex3f(0.0, dsz, 0.0)    /* Top Of Triangle (Left)        */
	gl.Color3f(0.0, 0.0, dsz)     /* Blue                          */
	gl.Vertex3f(-dsz, -dsz, -dsz) /* Left Of Triangle (Left)       */
	gl.Color3f(0.0, dsz, 0.0)     /* Green                         */
	gl.Vertex3f(-dsz, -dsz, dsz)  /* Right Of Triangle (Left)      */
	gl.End()                      /* Finished Drawing The Triangle */

}
Exemple #17
0
func drawCube(v *Vector3) {

	gl.LoadIdentity()
	//	gl.Translatef( -1.5, 0.0, -6.0 )
	gl.Translatef(gl.GLfloat(v.X), gl.GLfloat(v.Y), gl.GLfloat(v.Z))

	/* Rotate The Triangle On The Y axis ( NEW ) */
	// gl.Rotatef( rtri, 0.0, 1.0, 0.0 );

	gl.Begin(gl.TRIANGLES)       /* Drawing Using Triangles       */
	gl.Color3f(1.0, 0.0, 0.0)    /* Red                           */
	gl.Vertex3f(0.0, 1.0, 0.0)   /* Top Of Triangle (Front)       */
	gl.Color3f(0.0, 1.0, 0.0)    /* Green                         */
	gl.Vertex3f(-1.0, -1.0, 1.0) /* Left Of Triangle (Front)      */
	gl.Color3f(0.0, 0.0, 1.0)    /* Blue                          */
	gl.Vertex3f(1.0, -1.0, 1.0)  /* Right Of Triangle (Front)     */

	gl.Color3f(1.0, 0.0, 0.0)    /* Red                           */
	gl.Vertex3f(0.0, 1.0, 0.0)   /* Top Of Triangle (Right)       */
	gl.Color3f(0.0, 0.0, 1.0)    /* Blue                          */
	gl.Vertex3f(1.0, -1.0, 1.0)  /* Left Of Triangle (Right)      */
	gl.Color3f(0.0, 1.0, 0.0)    /* Green                         */
	gl.Vertex3f(1.0, -1.0, -1.0) /* Right Of Triangle (Right)     */

	gl.Color3f(1.0, 0.0, 0.0)     /* Red                           */
	gl.Vertex3f(0.0, 1.0, 0.0)    /* Top Of Triangle (Back)        */
	gl.Color3f(0.0, 1.0, 0.0)     /* Green                         */
	gl.Vertex3f(1.0, -1.0, -1.0)  /* Left Of Triangle (Back)       */
	gl.Color3f(0.0, 0.0, 1.0)     /* Blue                          */
	gl.Vertex3f(-1.0, -1.0, -1.0) /* Right Of Triangle (Back)      */

	gl.Color3f(1.0, 0.0, 0.0)     /* Red                           */
	gl.Vertex3f(0.0, 1.0, 0.0)    /* Top Of Triangle (Left)        */
	gl.Color3f(0.0, 0.0, 1.0)     /* Blue                          */
	gl.Vertex3f(-1.0, -1.0, -1.0) /* Left Of Triangle (Left)       */
	gl.Color3f(0.0, 1.0, 0.0)     /* Green                         */
	gl.Vertex3f(-1.0, -1.0, 1.0)  /* Right Of Triangle (Left)      */
	gl.End()                      /* Finished Drawing The Triangle */

	rtri = rtri + 0.2

}
Exemple #18
0
func (f *Font) DrawText3D(pos Vector3, color [3]byte, scale float, txt string) (endw int, endh int) {

	gl.LoadIdentity()
	// 	gl.Translatef(gl.GLfloat(pos.X), gl.GLfloat(pos.Y), gl.GLfloat(-4.99));
	gl.Translatef(gl.GLfloat(pos.X), gl.GLfloat(pos.Y), gl.GLfloat(-4.99))
	gl.Scalef(gl.GLfloat(1.0/64.0*scale), gl.GLfloat(1.0/64.0*scale), gl.GLfloat(1.0))
	gl.Disable(gl.DEPTH_TEST)

	texture, initial, intermediarya, intermediary, w, h := f.setupTextRendering(color, txt)

	wi := gl.GLfloat(w)
	he := gl.GLfloat(h)
	locX := gl.GLfloat(0) - wi*0.5
	locY := gl.GLfloat(0) - he*0.5

	/* Draw a quad at location */
	gl.Begin(gl.QUADS)
	/* Recall that the origin is in the lower-left corner
	   That is why the TexCoords specify different corners
	   than the Vertex coors seem to. */

	gl.Color4f(1.0, 1.0, 0.0, 1.0)

	gl.TexCoord2f(0.0, 1.0)
	gl.Vertex3f(locX, locY, 0.0)
	gl.TexCoord2f(1.0, 1.0)
	gl.Vertex3f(locX+wi, locY, 0.0)
	gl.TexCoord2f(1.0, 0.0)
	gl.Vertex3f(locX+wi, locY+he, 0.0)
	gl.TexCoord2f(0.0, 0.0)
	gl.Vertex3f(locX, locY+he, 0.0)
	gl.End()

	endw, endh = f.teardownTextRendering(texture, initial, intermediarya, intermediary)

	gl.Enable(gl.DEPTH_TEST)
	return
}
Exemple #19
0
func drawCircle(t *trigger) {

	radius := float64(t.Size)
	pos := t.Pos

	gl.LoadIdentity()
	gl.Color4f(gl.GLfloat(t.Col[0]), gl.GLfloat(t.Col[1]), gl.GLfloat(t.Col[2]), gl.GLfloat(t.Col[3]))

	gl.LineWidth(2.0)
	gl.Translatef(gl.GLfloat(pos.X), gl.GLfloat(pos.Y), gl.GLfloat(pos.Z))

	gl.Enable(gl.BLEND)
	gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)

	gl.Begin(gl.POLYGON)

	for i := 0; i < 360; i++ {
		var degInRad float64 = float64(i) * DEG2RAD
		gl.Vertex3f(gl.GLfloat(math.Cos(degInRad)*radius), gl.GLfloat(math.Sin(degInRad)*radius), gl.GLfloat(0.0))
	}

	gl.End()
	gl.Disable(gl.BLEND)
}
Exemple #20
0
// Here goes our drawing code
func drawGLScene() {
	// Clear the screen and depth buffer
	gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)

	// Move left 1.5 units and into the screen 6.0 units.
	gl.LoadIdentity()
	gl.Translatef(0.0, 0.0, -7.0)

	gl.Rotatef(float32(xrot), 1.0, 0.0, 0.0) /* Rotate On The X Axis */
	gl.Rotatef(float32(yrot), 0.0, 1.0, 0.0) /* Rotate On The Y Axis */
	gl.Rotatef(float32(zrot), 0.0, 0.0, 1.0) /* Rotate On The Z Axis */

	/* Select Our Texture */
	gl.BindTexture(gl.TEXTURE_2D, uint(texture))

	gl.Begin(gl.QUADS) // Draw a quad
	/* Front Face */
	gl.TexCoord2f(0.0, 1.0)
	gl.Vertex3f(-1.0, -1.0, 1.0) // Bottom left
	gl.TexCoord2f(1.0, 1.0)
	gl.Vertex3f(1.0, -1.0, 1.0) // Bottom right
	gl.TexCoord2f(1.0, 0.0)
	gl.Vertex3f(1.0, 1.0, 1.0) // Top right
	gl.TexCoord2f(0.0, 0.0)
	gl.Vertex3f(-1.0, 1.0, 1.0) // Top left

	/* Back Face */
	gl.TexCoord2f(0.0, 0.0)
	gl.Vertex3f(-1.0, -1.0, -1.0) // Bottom right
	gl.TexCoord2f(0.0, 1.0)
	gl.Vertex3f(-1.0, 1.0, -1.0) // Top right
	gl.TexCoord2f(1.0, 1.0)
	gl.Vertex3f(1.0, 1.0, -1.0) // Top left
	gl.TexCoord2f(1.0, 0.0)
	gl.Vertex3f(1.0, -1.0, -1.0) // Bottom left

	/* Top Face */
	gl.TexCoord2f(1.0, 1.0)
	gl.Vertex3f(-1.0, 1.0, -1.0) // Top left
	gl.TexCoord2f(1.0, 0.0)
	gl.Vertex3f(-1.0, 1.0, 1.0) // Bottom left
	gl.TexCoord2f(0.0, 0.0)
	gl.Vertex3f(1.0, 1.0, 1.0) // Bottom right
	gl.TexCoord2f(0.0, 1.0)
	gl.Vertex3f(1.0, 1.0, -1.0) // Top right

	/* Bottom Face */
	gl.TexCoord2f(0.0, 1.0)
	gl.Vertex3f(-1.0, -1.0, -1.0) // Top right
	gl.TexCoord2f(1.0, 1.0)
	gl.Vertex3f(1.0, -1.0, -1.0) // Top left
	gl.TexCoord2f(1.0, 0.0)
	gl.Vertex3f(1.0, -1.0, 1.0) // Bottom left
	gl.TexCoord2f(0.0, 0.0)
	gl.Vertex3f(-1.0, -1.0, 1.0) // Bottom right

	/* Right face */
	gl.TexCoord2f(0.0, 0.0)
	gl.Vertex3f(1.0, -1.0, -1.0) // Bottom right
	gl.TexCoord2f(0.0, 1.0)
	gl.Vertex3f(1.0, 1.0, -1.0) // Top right
	gl.TexCoord2f(1.0, 1.0)
	gl.Vertex3f(1.0, 1.0, 1.0) // Top left
	gl.TexCoord2f(1.0, 0.0)
	gl.Vertex3f(1.0, -1.0, 1.0) // Bottom left

	/* Left Face */
	gl.TexCoord2f(1.0, 0.0)
	gl.Vertex3f(-1.0, -1.0, -1.0) // Bottom left
	gl.TexCoord2f(0.0, 0.0)
	gl.Vertex3f(-1.0, -1.0, 1.0) // Bottom right
	gl.TexCoord2f(0.0, 1.0)
	gl.Vertex3f(-1.0, 1.0, 1.0) // Top right
	gl.TexCoord2f(1.0, 1.0)
	gl.Vertex3f(-1.0, 1.0, -1.0) // Top left
	gl.End()                     // done drawing the quad

	// Draw to the screen
	sdl.GL_SwapBuffers()

	xrot += 0.3 /* X Axis Rotation */
	yrot += 0.2 /* Y Axis Rotation */
	zrot += 0.4 /* Z Axis Rotation */

	// Gather our frames per second
	frames++
	t := sdl.GetTicks()
	if t-t0 >= 5000 {
		seconds := (t - t0) / 1000.0
		fps := frames / seconds
		fmt.Println(frames, "frames in", seconds, "seconds =", fps, "FPS")
		t0 = t
		frames = 0
	}
}
// Here goes our drawing code
func drawGLScene() {
	// Clear the screen and depth buffer
	gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)
	gl.BindTexture(gl.TEXTURE_2D, uint(texture))

	for loop, star := range stars {
		gl.LoadIdentity()
		gl.Translatef(0.0, 0.0, float32(zoom))
		gl.Rotatef(float32(tilt), 1.0, 0.0, 0.0)
		gl.Rotatef(float32(star.angle), 0.0, 1.0, 0.0)
		gl.Translatef(float32(star.dist), 0.0, 0.0)
		gl.Rotatef(float32(-star.angle), 0.0, 1.0, 0.0)
		gl.Rotatef(float32(-tilt), 1.0, 0.0, 0.0)

		if twinkle {
			other := stars[(num-loop)-1]
			gl.Color4ub(uint8(other.r), uint8(other.g), uint8(other.b), 255)
			gl.Begin(gl.QUADS)
			gl.TexCoord2f(0.0, 0.0)
			gl.Vertex3f(-1.0, -1.0, 0.0)
			gl.TexCoord2f(1.0, 0.0)
			gl.Vertex3f(1.0, -1.0, 0.0)
			gl.TexCoord2f(1.0, 1.0)
			gl.Vertex3f(1.0, 1.0, 0.0)
			gl.TexCoord2f(0.0, 1.0)
			gl.Vertex3f(-1.0, 1.0, 0.0)
			gl.End()
		}

		gl.Rotatef(float32(spin), 0.0, 0.0, 1.0)
		gl.Color4ub(uint8(star.r), uint8(star.g), uint8(star.b), 255)
		gl.Begin(gl.QUADS)
		gl.TexCoord2f(0.0, 0.0)
		gl.Vertex3f(-1.0, -1.0, 0.0)
		gl.TexCoord2f(1.0, 0.0)
		gl.Vertex3f(1.0, -1.0, 0.0)
		gl.TexCoord2f(1.0, 1.0)
		gl.Vertex3f(1.0, 1.0, 0.0)
		gl.TexCoord2f(0.0, 1.0)
		gl.Vertex3f(-1.0, 1.0, 0.0)
		gl.End()

		spin += 0.01
		star.angle += gl.GLfloat(loop) / gl.GLfloat(num)
		star.dist -= 0.01

		if star.dist < 0.0 {
			star.dist += 5.0
			star.r = gl.GLubyte(rand.Float32() * 255)
			star.g = gl.GLubyte(rand.Float32() * 255)
			star.b = gl.GLubyte(rand.Float32() * 255)
		}
	}

	// Draw to the screen
	sdl.GL_SwapBuffers()

	// Gather our frames per second
	frames++
	t := sdl.GetTicks()
	if t-t0 >= 5000 {
		seconds := (t - t0) / 1000.0
		fps := frames / seconds
		fmt.Println(frames, "frames in", seconds, "seconds =", fps, "FPS")
		t0 = t
		frames = 0
	}
}
Exemple #22
0
// Here goes our drawing code
func drawGLScene() {
  // Clear the screen and depth buffer
  gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)

  // Move left 1.5 units and into the screen 6.0 units.
  gl.LoadIdentity()
  gl.Translatef(0.0, 0.0, float32(z)) // translate by z

  gl.Rotatef(float32(xrot), 1.0, 0.0, 0.0) /* Rotate On The X Axis */
  gl.Rotatef(float32(yrot), 0.0, 1.0, 0.0) /* Rotate On The Y Axis */

  /* Select Our Texture */
  gl.BindTexture(gl.TEXTURE_2D, uint(textures[filter])) // based on filter

  gl.Begin(gl.QUADS)

  // Front face
  gl.Normal3f(0.0, 0.0, 1.0) // Normal Pointing Towards Viewer
  gl.TexCoord2f(0.0, 1.0); gl.Vertex3f(-1.0, -1.0, 1.0) // Bottom left
  gl.TexCoord2f(1.0, 1.0); gl.Vertex3f( 1.0, -1.0, 1.0) // Bottom right
  gl.TexCoord2f(1.0, 0.0); gl.Vertex3f( 1.0,  1.0, 1.0) // Top right
  gl.TexCoord2f(0.0, 0.0); gl.Vertex3f(-1.0,  1.0, 1.0) // Top left

  // Back Face
  gl.Normal3f(0.0, 0.0, -1.0) // Normal Pointing Away From Viewer
  gl.TexCoord2f(0.0, 0.0); gl.Vertex3f(-1.0, -1.0, -1.0) // Bottom right
  gl.TexCoord2f(0.0, 1.0); gl.Vertex3f(-1.0,  1.0, -1.0) // Top right
  gl.TexCoord2f(1.0, 1.0); gl.Vertex3f( 1.0,  1.0, -1.0) // Top left
  gl.TexCoord2f(1.0, 0.0); gl.Vertex3f( 1.0, -1.0, -1.0) // Bottom left

  // Top Face
  gl.Normal3f(0.0, 1.0, 0.0) // Normal Pointing Up
  gl.TexCoord2f(1.0, 1.0); gl.Vertex3f(-1.0,  1.0, -1.0) // Top left
  gl.TexCoord2f(1.0, 0.0); gl.Vertex3f(-1.0,  1.0,  1.0) // Bottom left
  gl.TexCoord2f(0.0, 0.0); gl.Vertex3f( 1.0,  1.0,  1.0) // Bottom right
  gl.TexCoord2f(0.0, 1.0); gl.Vertex3f( 1.0,  1.0, -1.0) // Top right

  // Bottom Face
  gl.Normal3f(0.0, -1.0, 0.0) // Normal Pointing Down
  gl.TexCoord2f(0.0, 1.0); gl.Vertex3f(-1.0, -1.0, -1.0) // Top right
  gl.TexCoord2f(1.0, 1.0); gl.Vertex3f( 1.0, -1.0, -1.0) // Top left
  gl.TexCoord2f(1.0, 0.0); gl.Vertex3f( 1.0, -1.0,  1.0) // Bottom left
  gl.TexCoord2f(0.0, 0.0); gl.Vertex3f(-1.0, -1.0,  1.0) // Bottom right

  // Right face
  gl.Normal3f(1.0, 0.0, 0.0) // Normal Pointing Right
  gl.TexCoord2f(0.0, 0.0); gl.Vertex3f(1.0, -1.0, -1.0) // Bottom right
  gl.TexCoord2f(0.0, 1.0); gl.Vertex3f(1.0,  1.0, -1.0) // Top right
  gl.TexCoord2f(1.0, 1.0); gl.Vertex3f(1.0,  1.0,  1.0) // Top left
  gl.TexCoord2f(1.0, 0.0); gl.Vertex3f(1.0, -1.0,  1.0) // Bottom left

  // Left Face
  gl.Normal3f(-1.0, 0.0, 0.0) // Normal Pointing Left
  gl.TexCoord2f(1.0, 0.0); gl.Vertex3f(-1.0, -1.0, -1.0) // Bottom left
  gl.TexCoord2f(0.0, 0.0); gl.Vertex3f(-1.0, -1.0,  1.0) // Bottom right
  gl.TexCoord2f(0.0, 1.0); gl.Vertex3f(-1.0,  1.0,  1.0) // Top right
  gl.TexCoord2f(1.0, 1.0); gl.Vertex3f(-1.0,  1.0, -1.0) // Top left

  gl.End()

  sdl.GL_SwapBuffers()

  xrot += xspeed
  yrot += yspeed

  // Gather our frames per second
  frames++
  t := sdl.GetTicks()
  if t-t0 >= 5000 {
    seconds := (t - t0) / 1000.0
    fps := frames / seconds
    fmt.Println(frames, "frames in", seconds, "seconds =", fps, "FPS")
    t0 = t
    frames = 0
  }
}
Exemple #23
0
// Here goes our drawing code
func drawGLScene() {
	// Clear the screen and depth buffer
	gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)

	// Move left 1.5 units and into the screen 6.0 units.
	gl.LoadIdentity()
	gl.Translatef(-1.5, 0.0, -6.0)
	gl.Rotatef(float32(rtri), 0.0, 1.0, 0.0) // Rotate the triangle on the Y axis

	gl.Begin(gl.TRIANGLES) // Draw triangles

	gl.Color3f(1.0, 0.0, 0.0)    /* Red                           */
	gl.Vertex3f(0.0, 1.0, 0.0)   /* Top Of Triangle (Front)       */
	gl.Color3f(0.0, 1.0, 0.0)    /* Green                         */
	gl.Vertex3f(-1.0, -1.0, 1.0) /* Left Of Triangle (Front)      */
	gl.Color3f(0.0, 0.0, 1.0)    /* Blue                          */
	gl.Vertex3f(1.0, -1.0, 1.0)  /* Right Of Triangle (Front)     */

	gl.Color3f(1.0, 0.0, 0.0)    /* Red                           */
	gl.Vertex3f(0.0, 1.0, 0.0)   /* Top Of Triangle (Right)       */
	gl.Color3f(0.0, 0.0, 1.0)    /* Blue                          */
	gl.Vertex3f(1.0, -1.0, 1.0)  /* Left Of Triangle (Right)      */
	gl.Color3f(0.0, 1.0, 0.0)    /* Green                         */
	gl.Vertex3f(1.0, -1.0, -1.0) /* Right Of Triangle (Right)     */

	gl.Color3f(1.0, 0.0, 0.0)     /* Red                           */
	gl.Vertex3f(0.0, 1.0, 0.0)    /* Top Of Triangle (Back)        */
	gl.Color3f(0.0, 1.0, 0.0)     /* Green                         */
	gl.Vertex3f(1.0, -1.0, -1.0)  /* Left Of Triangle (Back)       */
	gl.Color3f(0.0, 0.0, 1.0)     /* Blue                          */
	gl.Vertex3f(-1.0, -1.0, -1.0) /* Right Of Triangle (Back)      */

	gl.Color3f(1.0, 0.0, 0.0)     /* Red                           */
	gl.Vertex3f(0.0, 1.0, 0.0)    /* Top Of Triangle (Left)        */
	gl.Color3f(0.0, 0.0, 1.0)     /* Blue                          */
	gl.Vertex3f(-1.0, -1.0, -1.0) /* Left Of Triangle (Left)       */
	gl.Color3f(0.0, 1.0, 0.0)     /* Green                         */
	gl.Vertex3f(-1.0, -1.0, 1.0)  /* Right Of Triangle (Left)      */

	gl.End() // finish drawing the triangle

	// Move right 3 units
	gl.LoadIdentity()
	gl.Translatef(1.5, 0.0, -7.0)
	gl.Rotatef(float32(rquad), 1.0, 1.0, 1.0) // rotate the quad on the X axis

	gl.Begin(gl.QUADS)            // draw quads
	gl.Color3f(0.0, 1.0, 0.0)     // Set The Color To Green
	gl.Vertex3f(1.0, 1.0, -1.0)   // Top Right Of The Quad (Top)
	gl.Vertex3f(-1.0, 1.0, -1.0)  // Top Left Of The Quad (Top)
	gl.Vertex3f(-1.0, 1.0, 1.0)   // Bottom Left Of The Quad (Top)
	gl.Vertex3f(1.0, 1.0, 1.0)    // Bottom Right Of The Quad (Top)
	gl.Color3f(1.0, 0.5, 0.0)     // Set The Color To Orange
	gl.Vertex3f(1.0, -1.0, 1.0)   // Top Right Of The Quad (Bottom)
	gl.Vertex3f(-1.0, -1.0, 1.0)  // Top Left Of The Quad (Bottom)
	gl.Vertex3f(-1.0, -1.0, -1.0) // Bottom Left Of The Quad (Bottom)
	gl.Vertex3f(1.0, -1.0, -1.0)  // Bottom Right Of The Quad (Bottom)
	gl.Color3f(1.0, 0.0, 0.0)     // Set The Color To Red
	gl.Vertex3f(1.0, 1.0, 1.0)    // Top Right Of The Quad (Front)
	gl.Vertex3f(-1.0, 1.0, 1.0)   // Top Left Of The Quad (Front)
	gl.Vertex3f(-1.0, -1.0, 1.0)  // Bottom Left Of The Quad (Front)
	gl.Vertex3f(1.0, -1.0, 1.0)   // Bottom Right Of The Quad (Front)
	gl.Color3f(1.0, 1.0, 0.0)     // Set The Color To Yellow
	gl.Vertex3f(1.0, -1.0, -1.0)  // Bottom Left Of The Quad (Back)
	gl.Vertex3f(-1.0, -1.0, -1.0) // Bottom Right Of The Quad (Back)
	gl.Vertex3f(-1.0, 1.0, -1.0)  // Top Right Of The Quad (Back)
	gl.Vertex3f(1.0, 1.0, -1.0)   // Top Left Of The Quad (Back)
	gl.Color3f(0.0, 0.0, 1.0)     // Set The Color To Blue
	gl.Vertex3f(-1.0, 1.0, 1.0)   // Top Right Of The Quad (Left)
	gl.Vertex3f(-1.0, 1.0, -1.0)  // Top Left Of The Quad (Left)
	gl.Vertex3f(-1.0, -1.0, -1.0) // Bottom Left Of The Quad (Left)
	gl.Vertex3f(-1.0, -1.0, 1.0)  // Bottom Right Of The Quad (Left)
	gl.Color3f(1.0, 0.0, 1.0)     // Set The Color To Violet
	gl.Vertex3f(1.0, 1.0, -1.0)   // Top Right Of The Quad (Right)
	gl.Vertex3f(1.0, 1.0, 1.0)    // Top Left Of The Quad (Right)
	gl.Vertex3f(1.0, -1.0, 1.0)   // Bottom Left Of The Quad (Right)
	gl.Vertex3f(1.0, -1.0, -1.0)  // Bottom Right Of The Quad (Right)
	gl.End()                      // done drawing the quad

	// Draw to the screen
	sdl.GL_SwapBuffers()

	rtri += 0.2   // Increase The Rotation Variable For The Triangle
	rquad -= 0.15 // Decrease The Rotation Variable For The Quad

	// Gather our frames per second
	frames++
	t := sdl.GetTicks()
	if t-t0 >= 5000 {
		seconds := (t - t0) / 1000.0
		fps := frames / seconds
		fmt.Println(frames, "frames in", seconds, "seconds =", fps, "FPS")
		t0 = t
		frames = 0
	}
}
Exemple #24
0
func drawCubes(v *Vector3) {

	gl.LoadIdentity()
	//	gl.Translatef( -1.5, 0.0, -6.0 )
	gl.Translatef(gl.GLfloat(v.X), gl.GLfloat(v.Y), gl.GLfloat(v.Z))

	/* Rotate The Triangle On The Y axis ( NEW ) */
	gl.Rotatef(rtri, 0.0, 1.0, 0.0)

	gl.Begin(gl.TRIANGLES)       /* Drawing Using Triangles       */
	gl.Color3f(1.0, 0.0, 0.0)    /* Red                           */
	gl.Vertex3f(0.0, 1.0, 0.0)   /* Top Of Triangle (Front)       */
	gl.Color3f(0.0, 1.0, 0.0)    /* Green                         */
	gl.Vertex3f(-1.0, -1.0, 1.0) /* Left Of Triangle (Front)      */
	gl.Color3f(0.0, 0.0, 1.0)    /* Blue                          */
	gl.Vertex3f(1.0, -1.0, 1.0)  /* Right Of Triangle (Front)     */

	gl.Color3f(1.0, 0.0, 0.0)    /* Red                           */
	gl.Vertex3f(0.0, 1.0, 0.0)   /* Top Of Triangle (Right)       */
	gl.Color3f(0.0, 0.0, 1.0)    /* Blue                          */
	gl.Vertex3f(1.0, -1.0, 1.0)  /* Left Of Triangle (Right)      */
	gl.Color3f(0.0, 1.0, 0.0)    /* Green                         */
	gl.Vertex3f(1.0, -1.0, -1.0) /* Right Of Triangle (Right)     */

	gl.Color3f(1.0, 0.0, 0.0)     /* Red                           */
	gl.Vertex3f(0.0, 1.0, 0.0)    /* Top Of Triangle (Back)        */
	gl.Color3f(0.0, 1.0, 0.0)     /* Green                         */
	gl.Vertex3f(1.0, -1.0, -1.0)  /* Left Of Triangle (Back)       */
	gl.Color3f(0.0, 0.0, 1.0)     /* Blue                          */
	gl.Vertex3f(-1.0, -1.0, -1.0) /* Right Of Triangle (Back)      */

	gl.Color3f(1.0, 0.0, 0.0)     /* Red                           */
	gl.Vertex3f(0.0, 1.0, 0.0)    /* Top Of Triangle (Left)        */
	gl.Color3f(0.0, 0.0, 1.0)     /* Blue                          */
	gl.Vertex3f(-1.0, -1.0, -1.0) /* Left Of Triangle (Left)       */
	gl.Color3f(0.0, 1.0, 0.0)     /* Green                         */
	gl.Vertex3f(-1.0, -1.0, 1.0)  /* Right Of Triangle (Left)      */
	gl.End()                      /* Finished Drawing The Triangle */

	rtri = rtri + 0.2

	return

	/* Move Right 3 Units */
	gl.LoadIdentity()
	gl.Translatef(1.5, 0.0, -6.0)

	/* Rotate The Quad On The X axis ( NEW ) */
	gl.Rotatef(rquad, 1.0, 0.0, 0.0)

	/* Set The Color To Blue One Time Only */
	gl.Color3f(0.5, 0.5, 1.0)

	gl.Begin(gl.QUADS)           /* Draw A Quad                      */
	gl.Color3f(0.0, 1.0, 0.0)    /* Set The Color To Green           */
	gl.Vertex3f(1.0, 1.0, -1.0)  /* Top Right Of The Quad (Top)      */
	gl.Vertex3f(-1.0, 1.0, -1.0) /* Top Left Of The Quad (Top)       */
	gl.Vertex3f(-1.0, 1.0, 1.0)  /* Bottom Left Of The Quad (Top)    */
	gl.Vertex3f(1.0, 1.0, 1.0)   /* Bottom Right Of The Quad (Top)   */

	gl.Color3f(1.0, 0.5, 0.0)     /* Set The Color To Orange          */
	gl.Vertex3f(1.0, -1.0, 1.0)   /* Top Right Of The Quad (Botm)     */
	gl.Vertex3f(-1.0, -1.0, 1.0)  /* Top Left Of The Quad (Botm)      */
	gl.Vertex3f(-1.0, -1.0, -1.0) /* Bottom Left Of The Quad (Botm)   */
	gl.Vertex3f(1.0, -1.0, -1.0)  /* Bottom Right Of The Quad (Botm)  */

	gl.Color3f(1.0, 0.0, 0.0)    /* Set The Color To Red             */
	gl.Vertex3f(1.0, 1.0, 1.0)   /* Top Right Of The Quad (Front)    */
	gl.Vertex3f(-1.0, 1.0, 1.0)  /* Top Left Of The Quad (Front)     */
	gl.Vertex3f(-1.0, -1.0, 1.0) /* Bottom Left Of The Quad (Front)  */
	gl.Vertex3f(1.0, -1.0, 1.0)  /* Bottom Right Of The Quad (Front) */

	gl.Color3f(1.0, 1.0, 0.0)     /* Set The Color To Yellow          */
	gl.Vertex3f(1.0, -1.0, -1.0)  /* Bottom Left Of The Quad (Back)   */
	gl.Vertex3f(-1.0, -1.0, -1.0) /* Bottom Right Of The Quad (Back)  */
	gl.Vertex3f(-1.0, 1.0, -1.0)  /* Top Right Of The Quad (Back)     */
	gl.Vertex3f(1.0, 1.0, -1.0)   /* Top Left Of The Quad (Back)      */

	gl.Color3f(0.0, 0.0, 1.0)     /* Set The Color To Blue            */
	gl.Vertex3f(-1.0, 1.0, 1.0)   /* Top Right Of The Quad (Left)     */
	gl.Vertex3f(-1.0, 1.0, -1.0)  /* Top Left Of The Quad (Left)      */
	gl.Vertex3f(-1.0, -1.0, -1.0) /* Bottom Left Of The Quad (Left)   */
	gl.Vertex3f(-1.0, -1.0, 1.0)  /* Bottom Right Of The Quad (Left)  */

	gl.Color3f(1.0, 0.0, 1.0)    /* Set The Color To Violet          */
	gl.Vertex3f(1.0, 1.0, -1.0)  /* Top Right Of The Quad (Right)    */
	gl.Vertex3f(1.0, 1.0, 1.0)   /* Top Left Of The Quad (Right)     */
	gl.Vertex3f(1.0, -1.0, 1.0)  /* Bottom Left Of The Quad (Right)  */
	gl.Vertex3f(1.0, -1.0, -1.0) /* Bottom Right Of The Quad (Right) */
	gl.End()                     /* Done Drawing The Quad            */

	rquad -= 0.15
}