示例#1
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)
}
示例#2
0
func stroke_output(x, y float32, 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()
}
示例#3
0
文件: main.go 项目: pwaller/examples
func main() {
	err := initGL()
	if err != nil {
		log.Printf("InitGL: %v", err)
		return
	}

	defer glfw.Terminate()

	mb := createBuffer()
	defer mb.Release()

	// Perform the rendering.
	var angle float32
	for glfw.WindowParam(glfw.Opened) > 0 {
		gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)
		gl.LoadIdentity()
		gl.Translatef(0, 0, -6)
		gl.Rotatef(angle, 1, 1, 1)

		// Render a solid cube at half the scale.
		gl.Scalef(0.2, 0.2, 0.2)
		gl.Enable(gl.COLOR_MATERIAL)
		gl.Enable(gl.POLYGON_OFFSET_FILL)
		gl.PolygonMode(gl.FRONT_AND_BACK, gl.FILL)
		mb.Render(gl.QUADS)

		// Render wireframe cubes, with incremental size.
		gl.Disable(gl.COLOR_MATERIAL)
		gl.Disable(gl.POLYGON_OFFSET_FILL)
		gl.PolygonMode(gl.FRONT_AND_BACK, gl.LINE)

		for i := 0; i < 50; i++ {
			scale := 0.004*float32(i) + 1.0
			gl.Scalef(scale, scale, scale)
			mb.Render(gl.QUADS)
		}

		angle += 0.5
		glfw.SwapBuffers()
	}
}
示例#4
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. */
}
示例#5
0
文件: main.go 项目: nzlov/examples
func main() {
	err := initGL()
	if err != nil {
		log.Printf("InitGL: %v", err)
		return
	}

	defer glfw.Terminate()

	mb := createBuffer()
	defer mb.Release()

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

	f, err := os.Create("test.mpeg")
	if err != nil {
		log.Panicf("Unable to open output file: %q", err)
	}

	im := image.NewRGBA(image.Rect(0, 0, 512, 512))
	e, err := ffmpeg.NewEncoder(ffmpeg.CODEC_ID_H264, im, f)
	if err != nil {
		log.Panicf("Unable to start encoder: %q", err)
	}

	// Perform the rendering.
	var angle float64
	for glfw.WindowParam(glfw.Opened) > 0 {
		gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)
		gl.LoadIdentity()
		gl.Translatef(0, 0, -6)
		gl.Rotated(angle/10, 0, 1, 0)
		gl.Rotated(angle, 1, 1, 1)

		// Render a solid cube at half the scale.
		gl.Scalef(0.1, 0.1, 0.1)
		gl.Enable(gl.COLOR_MATERIAL)
		gl.Enable(gl.POLYGON_OFFSET_FILL)
		gl.PolygonMode(gl.FRONT_AND_BACK, gl.FILL)
		mb.Render(gl.QUADS)

		// Render wireframe cubes, with incremental size.
		gl.Disable(gl.COLOR_MATERIAL)
		gl.Disable(gl.POLYGON_OFFSET_FILL)
		gl.PolygonMode(gl.FRONT_AND_BACK, gl.FILL)

		for i := 0; i < 1000; i++ {
			ifl := float64(i)
			scale := 0.000005*ifl + 1.0 + 0.01*math.Sin(angle/10+ifl/10)
			gl.Scaled(scale, scale, scale)
			gl.Rotated((ifl+angle)/1000, 1, 1, 1)
			gl.Rotated((ifl+angle)/1100, -1, 1, 1)

			mb.Render(gl.QUADS)
		}

		glh.ClearAlpha(1)
		glh.CaptureRGBA(im)

		err := e.WriteFrame()
		if err != nil {
			panic(err)
		}

		angle += 0.5
		//glh.CaptureToPng("test.png")
		glfw.SwapBuffers()
	}
	e.Close()
}
示例#6
0
func (r *AnimateRotate) AnimateAndExecute() {
	if len(r.SelectedHex) == 0 {
		return
	}
	gl.PushMatrix()
	var p Point
	for _, hex := range r.SelectedHex {
		p.X += hexMap2.GetCenter(hex.Pos.X, hex.Pos.Y).X
		p.Y += hexMap2.GetCenter(hex.Pos.X, hex.Pos.Y).Y
	}
	p.X /= 3
	p.Y /= 3
	x, y := p.WithOffset()
	gl.Translatef(float32(x), float32(y), 0)
	if r.PauseTicks == 0 {
		gl.Scalef(1.3, 1.3, 1)
		gl.Rotatef(r.RotateAngle, 0, 0, 1)
	} else {
		r.PauseTicks--
	}
	for _, hex := range r.SelectedHex {
		gl.PushMatrix()
		x2, y2 := hexMap2.GetTopLeft(hex.Pos.X, hex.Pos.Y).WithOffset()
		gl.Translatef(float32(x2-x), float32(y2-y), 0)
		hex.Hex.Render(1, false)
		gl.PopMatrix()
	}
	gl.PopMatrix()
	if r.PauseTicks > 0 {
		return
	}
	if r.RotateAngle < 120 {
		r.RotateAngle += 20
	} else {
		fmt.Println(r.SelectedHex[0].Hex, r.SelectedHex[1].Hex, r.SelectedHex[2].Hex)
		hexMap2[r.SelectedHex[0].Pos.X][r.SelectedHex[0].Pos.Y], hexMap2[r.SelectedHex[1].Pos.X][r.SelectedHex[1].Pos.Y], hexMap2[r.SelectedHex[2].Pos.X][r.SelectedHex[2].Pos.Y] = hexMap2[r.SelectedHex[2].Pos.X][r.SelectedHex[2].Pos.Y], hexMap2[r.SelectedHex[0].Pos.X][r.SelectedHex[0].Pos.Y], hexMap2[r.SelectedHex[1].Pos.X][r.SelectedHex[1].Pos.Y]
		r.SelectedHex[0].Hex, r.SelectedHex[1].Hex, r.SelectedHex[2].Hex = r.SelectedHex[2].Hex, r.SelectedHex[0].Hex, r.SelectedHex[1].Hex
		collide := hexMap2.CheckCollision()
		if r.TimesToRotate == 0 || collide {
			for _, hex := range r.SelectedHex {
				if hex.Hex.State == StateRotating {
					hex.Hex.State = StateNormal
				}
			}
			r.SelectedHex = nil
			r.SelectedHex = make([]SelectedHex, 0)
			if collide {
				hexShrink.InitAnimation()
				if r.postHook != nil {
					hexShrink.postHook = r.postHook
				}
			} else {
				if r.postHook != nil {
					r.postHook()
				}
			}
		} else {
			r.TimesToRotate--
			r.RotateAngle = 0
			r.PauseTicks = 5
		}
	}
}
示例#7
0
func (s *ShrinkHex) AnimateAndExecute() {
	if len(s.SelectedHex) == 0 {
		return
	}
	if s.Scale > 0.2 {
		s.Scale -= 0.15
		fmt.Println(s.Scale)
		for _, hex := range s.SelectedHex {
			gl.PushMatrix()
			x, y := hexMap2.GetCenter(hex.Pos.X, hex.Pos.Y).WithOffset()
			gl.Translatef(float32(x), float32(y), 0)
			gl.Scalef(s.Scale, s.Scale, 1)
			hex.Hex.Render(1, true)
			gl.PopMatrix()
		}
	} else {
		fallHexes := make([]FallHex, 0)
		for x := 0; x < 11; x++ {
			maxy := 7
			if x%2 == 1 {
				maxy = 8
			}
			fell := false
			for y := maxy; y >= 0; y-- {
				if hexMap2[x][y].State == StateShrinking && !fell {
					hexMap2[x][y] = nil
					for y2 := y; y2 > 0; y2-- {
						hexMap2[x][y2] = hexMap2[x][y2-1]
						if hexMap2[x][y2].State == StateShrinking {
							continue
						}
						hexMap2[x][y2].State = StateFalling
						fallHexes = append(fallHexes, FallHex{hexMap2[x][y2], FieldPoint{x, y2}, FieldPoint{x, y2 - 1}, 0})
						fmt.Println(1, x, y2, x, y2-1)
					}
					hexMap2[x][0] = &Hex{HexType(rand.Intn(int(HexFlower)-1) + 1), StateFalling}
					fallHexes = append(fallHexes, FallHex{hexMap2[x][0], FieldPoint{x, 0}, FieldPoint{x, -1}, 0})
					fell = true
				} else if hexMap2[x][y].State == StateShrinking && fell {
					hexMap2[x][y] = nil
					for y2 := y; y2 > 0; y2-- {
						hexMap2[x][y2] = hexMap2[x][y2-1]
						if hexMap2[x][y2].State == StateShrinking {
							continue
						}
						hexMap2[x][y2].State = StateFalling
						// found := false
						// for i, hex := range fallHexes {
						// 	if hex.Hex == hexMap2[x][y2] {
						// 		found = true
						// 		fallHexes[i].Target.Y++
						// 		break
						// 	}
						// }
						fmt.Println(2, x, y2, x, y2-1)
					}
					miny := 0
					for i, hex := range fallHexes {
						if hex.Pos.X == x {
							fallHexes[i].Target.Y++
							if hex.Pos.Y < miny {
								miny = hex.Pos.Y
							}
						}
					}
					hexMap2[x][0] = &Hex{HexType(rand.Intn(int(HexFlower)-1) + 1), StateFalling}
					fallHexes = append(fallHexes, FallHex{hexMap2[x][0], FieldPoint{x, 0}, FieldPoint{x, miny - 1}, 0})
				}
				if hexMap2[x][y].State == StateShrinking {
					y = maxy + 1
				}
			}
		}
		hexFall.InitAnimation(fallHexes)
		if s.postHook != nil {
			hexFall.SetPostHook(s.postHook)
		}
		s.SelectedHex = nil
		s.SelectedHex = make([]SelectedHex, 0)
	}
}
示例#8
0
文件: main.go 项目: TheOnly92/gexic
func renderHexMap() {
	gl.Enable(gl.TEXTURE_2D)
	gl.Enable(gl.BLEND)
	gl.Disable(gl.DEPTH_TEST)
	wallpaper.Bind(gl.TEXTURE_2D)
	gl.TexEnvf(gl.TEXTURE_ENV, gl.TEXTURE_ENV_MODE, gl.REPLACE)
	gl.Begin(gl.QUADS)
	gl.TexCoord2f(0, 0)
	gl.Vertex2i(0, 0)
	gl.TexCoord2f(0, 1)
	gl.Vertex2i(0, 768)
	gl.TexCoord2f(1, 1)
	gl.Vertex2i(1024, 768)
	gl.TexCoord2f(1, 0)
	gl.Vertex2i(1024, 0)
	gl.End()
	gl.TexEnvf(gl.TEXTURE_ENV, gl.TEXTURE_ENV_MODE, gl.DECAL)
	gl.TexEnvf(gl.TEXTURE_ENV, gl.TEXTURE_ENV_MODE, gl.MODULATE)
	gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
	gl.PushMatrix()
	gl.Translatef(80, 80, 0)
	for x := 0; x < 10; x++ {
		maxy := 8
		topy := 19
		if x%2 == 1 {
			maxy = 9
			topy = 0
		}
		starty := 0
		for y := starty; y < maxy; y++ {
			if currExX > -1 && currExY > -1 && starRotate {
				if y == currExY && x == currExX || y == currExY+1 && x == currExX || y == currExY-1 && x == currExX || currExX%2 == 0 && ((currExX == x-1 || currExX == x+1) && currExY == y-1 || (currExX == x-1 || currExX == x+1) && currExY == y) || currExX%2 == 1 && ((currExX == x-1 || currExX == x+1) && currExY == y || (currExX == x-1 || currExX == x+1) && currExY == y+1) {
					continue
				}
			} else if timesToRotate > 0 {
				// if y == currExY && x == currExX || currExX%2 == 0 && (x == currExX+1 && y == currExY || x == currExX+1 && y == currExY+1) || currExX%2 == 1 && (x == currExX+1 && y == currExY || x == currExX+1 && y == currExY-1) {
				// 	continue
				// }
				found := false
				for _, v := range selectedHex {
					if y == v[1] && x == v[0] {
						found = true
						break
					}
				}
				if found {
					continue
				}
			}
			found := false
			for _, v := range currentMatches {
				if scale > 0 && v[0] == x && v[1] == y || scale <= 0 && v[0] == x && v[1] >= y {
					found = true
					break
				}
			}
			for _, v := range starMatches {
				if starAlpha > 0 && v[0] == x && v[1] == y || starAlpha <= 0 && v[0] == x && v[1] >= y {
					found = true
					break
				}
			}
			if found || len(currStarCenter) > 0 && currStarCenter[0] == x && currStarCenter[1] == y {
				continue
			}
			gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
			drawHex(x*33, topy+y*38, hexMap[x][y], 1)
		}
	}
	gl.PopMatrix()
	if len(currentMatches) > 0 || len(starMatches) > 0 {
		mouseLock = true
		if len(currentMatches) > 0 && scale > 0 {
			scale -= 0.1
			for _, v := range currentMatches {
				gl.PushMatrix()
				topy := 19
				if v[0]%2 == 1 {
					topy = 0
				}
				gl.Translatef(float32(v[0]*33+102), float32(v[1]*38+topy+94), 0)
				gl.Scalef(scale, scale, 1)
				gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
				drawHex(-22, -14, hexMap[v[0]][v[1]], 1)
				gl.PopMatrix()
			}
		} else if len(starMatches) > 0 && starAlpha > 0 {
			starAlpha -= 0.05
			// starAlpha = 0.7
			starScale += 0.05
			// starScale = 1.4
			gl.PushMatrix()
			topy := 19
			pm := 0
			if currStarCenter[0]%2 == 1 {
				topy = 0
				pm = -1
			}
			gl.Translatef(float32(currStarCenter[0]*33+102), float32(currStarCenter[1]*38+topy+94), 0)
			drawHex(-22, -14, 6, 1)
			gl.PopMatrix()
			gl.PushMatrix()
			gl.Translatef(float32(currStarCenter[0]*33+102), float32(currStarCenter[1]*38+topy+94), 0)
			gl.Scalef(starScale, starScale, 1)
			drawHex(-22, -14-HEX_HEIGHT, hexMap[currStarCenter[0]][currStarCenter[1]-1], starAlpha)
			drawHex(-22, -20+HEX_HEIGHT, hexMap[currStarCenter[0]][currStarCenter[1]+1], starAlpha)
			drawHex(-52, -36, hexMap[currStarCenter[0]-1][currStarCenter[1]+pm], starAlpha)
			drawHex(-52, -40+HEX_HEIGHT, hexMap[currStarCenter[0]-1][currStarCenter[1]+pm+1], starAlpha)
			drawHex(8, -36, hexMap[currStarCenter[0]+1][currStarCenter[1]+pm], starAlpha)
			drawHex(8, -40+HEX_HEIGHT, hexMap[currStarCenter[0]+1][currStarCenter[1]+pm+1], starAlpha)
			gl.PopMatrix()
		} else {
			if fallticks == 0 {
				animateFall = make([]*freefall, 0)
				for x := 0; x < 10; x++ {
					topy := 19
					if x%2 == 1 {
						topy = 0
					}
					fromy := -1
					for _, v := range currentMatches {
						if v[0] != x {
							continue
						}
						if v[1] > fromy {
							fromy = v[1]
						}
					}
					for _, v := range starMatches {
						if v[0] != x {
							continue
						}
						if v[1] > fromy {
							fromy = v[1]
						}
					}
					if fromy == -1 {
						continue
					}
					for y := fromy; y >= 0; y-- {
						found := false
						for _, v := range currentMatches {
							if v[0] == x && v[1] == y {
								found = true
								break
							}
						}
						for _, v := range starMatches {
							if v[0] == x && v[1] == y {
								found = true
								break
							}
						}
						if found {
							continue
						}
						animateFall = append(animateFall, &freefall{x, y, getFallTargetY(x, y), math.Pow(float64(y), 2)/16 + 0.5})
						gl.PushMatrix()
						gl.Translatef(float32(x*33+102), float32(y*38+topy+94), 0)
						gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
						drawHex(-22, -14, hexMap[x][y], 1)
						gl.PopMatrix()
					}
				}
				fallticks++
			} else {
				stillFalling := 0
				for _, v := range animateFall {
					topy := 19
					if v.x%2 == 1 {
						topy = 0
					}
					newy := v.accel * math.Pow(float64(fallticks), 2) / 2
					gl.PushMatrix()
					gl.Translatef(float32(v.x*33+102), float32(math.Min(float64(v.y*38+topy+94)+newy, float64(v.targetY*38+topy+94))), 0)
					gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
					drawHex(-22, -14, hexMap[v.x][v.y], 1)
					gl.PopMatrix()
					if float64(v.y*38+topy+94)+newy < float64(v.targetY*38+topy+94) {
						stillFalling++
					}
				}
				fallticks++
				if stillFalling == 0 {
					starScale = 1
					starAlpha = 0
					removeHexAndGenNew(currentMatches)
					makeStarAndGenNew(starMatches)
					currentMatches = checkHexMap()
					starMatches = checkHexStar()
					currStarCenter = []int{}
					scale = 1
					fallticks = 0
					mouseLock = false
					fmt.Println("Mouse unlocked 1")
					animateFall = nil
				}
			}
		}
	}
	if currExX > -1 && currExY > -1 {
		gl.PushMatrix()
		topy := 19
		if currExX%2 == 1 {
			topy = 0
		}
		if starRotate {
			timesToRotate = 0
			gl.Translatef(float32(currExX*33+102), float32(currExY*38+topy+94), 0)
			gl.Scalef(1.3, 1.3, 1)
			gl.Rotatef(rotate, 0, 0, 1)
			drawHex(-22, -14, 6, 1)
			drawHex(-22, -14-HEX_HEIGHT, hexMap[currExX][currExY-1], 1)
			drawHex(-22, -20+HEX_HEIGHT, hexMap[currExX][currExY+1], 1)
			pm := 0
			if currExX%2 == 1 {
				pm = -1
			}
			drawHex(-52, -36, hexMap[currExX-1][currExY+pm], 1)
			drawHex(-52, -40+HEX_HEIGHT, hexMap[currExX-1][currExY+pm+1], 1)
			drawHex(8, -36, hexMap[currExX+1][currExY+pm], 1)
			drawHex(8, -40+HEX_HEIGHT, hexMap[currExX+1][currExY+pm+1], 1)
		} else {
			// gl.Translatef(float32(currExX*33+HEX_WIDTH+80), float32(currExxY*38+topy+20+80), 0)
			gl.Translatef(float32(prevSelectPos[0]), float32(prevSelectPos[1]), 0)
			gl.Scalef(1.3, 1.3, 1)
			gl.Rotatef(rotate, 0, 0, 1)
			for _, v := range selectedHex {
				switch v[2] {
				case 1:
					drawHex(-32, -34, hexMap[v[0]][v[1]], 1)
				case 2:
					drawHex(0, -17, hexMap[v[0]][v[1]], 1)
				case 3:
					drawHex(-32, 0, hexMap[v[0]][v[1]], 1)
				case 4:
					drawHex(-44, -19, hexMap[v[0]][v[1]], 1)
				case 5:
					drawHex(-12, -36, hexMap[v[0]][v[1]], 1)
				case 6:
					drawHex(-12, -2, hexMap[v[0]][v[1]], 1)
				}
			}
			// if currExX%2 == 0 {
			// 	gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
			// 	drawHex(-12, -36, hexMap[currExX+1][currExY], 1)
			// } else {
			// 	gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
			// 	drawHex(-12, -36, hexMap[currExX+1][currExY-1], 1)
			// }
			// gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
			// drawHex(-44, -19, hexMap[currExX][currExY], 1)
			// if currExX%2 == 0 {
			// 	gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
			// 	drawHex(-12, -2, hexMap[currExX+1][currExY+1], 1)
			// } else {
			// 	gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
			// 	drawHex(-12, -2, hexMap[currExX+1][currExY], 1)
			// }
		}
		gl.PopMatrix()
		if !starRotate && rotate < 120 {
			rotate += 15
			// rotate = 15
		} else if starRotate && rotate < 60 {
			rotate += 6
		} else {
			if starRotate {
				if currExX%2 == 0 {
					hexMap[currExX][currExY-1], hexMap[currExX+1][currExY], hexMap[currExX+1][currExY+1], hexMap[currExX][currExY+1], hexMap[currExX-1][currExY+1], hexMap[currExX-1][currExY] = hexMap[currExX-1][currExY], hexMap[currExX][currExY-1], hexMap[currExX+1][currExY], hexMap[currExX+1][currExY+1], hexMap[currExX][currExY+1], hexMap[currExX-1][currExY+1]
				} else {
					hexMap[currExX][currExY-1], hexMap[currExX+1][currExY-1], hexMap[currExX+1][currExY], hexMap[currExX][currExY+1], hexMap[currExX-1][currExY], hexMap[currExX-1][currExY-1] = hexMap[currExX-1][currExY-1], hexMap[currExX][currExY-1], hexMap[currExX+1][currExY-1], hexMap[currExX+1][currExY], hexMap[currExX][currExY+1], hexMap[currExX-1][currExY]
				}
			} else {
				v2 := make([][]int, 3)
				for _, v := range selectedHex {
					idx := 0
					switch v[2] {
					case 1, 4:
						idx = 0
					case 2, 5:
						idx = 1
					case 3, 6:
						idx = 2
					}
					v2[idx] = []int{v[0], v[1]}
					fmt.Println(idx, v[0], v[1])
				}
				hexMap[v2[0][0]][v2[0][1]], hexMap[v2[1][0]][v2[1][1]], hexMap[v2[2][0]][v2[2][1]] = hexMap[v2[2][0]][v2[2][1]], hexMap[v2[0][0]][v2[0][1]], hexMap[v2[1][0]][v2[1][1]]
			}
			starMatches = checkHexStar()
			if len(starMatches) > 6 {
				fmt.Println(starMatches)
			}
			if len(starMatches) >= 6 {
				timesToRotate = 0
				rotate = 0
				currExX = -1
				currExY = -1
				starScale = 1
				starAlpha = 1
				starRotate = false
				currStarCenter = getStarCenter(starMatches)
				hexMap[currStarCenter[0]][currStarCenter[1]] = 6
				// makeStarAndGenNew(starMatches)
			} else {
				matches := checkHexMap()
				if len(matches) > 0 {
					currentMatches = matches
					scale = 1
					currExX = -1
					currExY = -1
					rotate = 0
					timesToRotate = 0
					starRotate = false
				} else {
					if timesToRotate == 0 {
						currExX = -1
						currExY = -1
						rotate = 0
						timesToRotate = 0
						starRotate = false
						mouseLock = false
						fmt.Println("Mouse unlocked 3")
					}
					rotate = 0
					timesToRotate--
				}
			}
		}
	}
	if !mouseLock {
		prevSelectPos = calcClosestCenter(posX, posY)
		drawBorderAtXY(float32(prevSelectPos[0]), float32(prevSelectPos[1]), prevSelectPos[2])
	}
	gl.Flush()
	gl.Disable(gl.TEXTURE_2D)
	gl.Disable(gl.BLEND)
}