本文整理匯總了Golang中github.com/banthar/gl.Disable函數的典型用法代碼示例。如果您正苦於以下問題:Golang Disable函數的具體用法?Golang Disable怎麽用?Golang Disable使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了Disable函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Draw
func (s *Sprite) Draw(x, y, angle, scale float32, blend bool) {
gl.Enable(gl.TEXTURE_2D)
gl.Disable(gl.COLOR_MATERIAL)
if blend {
gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
gl.Enable(gl.BLEND)
} else {
gl.Disable(gl.BLEND)
gl.BlendFunc(gl.ONE, gl.ZERO)
}
gl.MatrixMode(gl.MODELVIEW)
gl.LoadIdentity()
gl.Translatef(x, y, 0)
gl.Rotatef(angle*360/(2*math.Pi), 0, 0, 1)
gl.Scalef(scale, scale, 1)
s.tex.Bind(gl.TEXTURE_2D)
gl.Begin(gl.QUADS)
gl.Color3f(1, 1, 1)
gl.TexCoord2d(0, 0)
gl.Vertex3f(-0.5*s.width, -0.5*s.height, 0)
gl.TexCoord2d(1, 0)
gl.Vertex3f(0.5*s.width, -0.5*s.height, 0)
gl.TexCoord2d(1, 1)
gl.Vertex3f(0.5*s.width, 0.5*s.height, 0)
gl.TexCoord2d(0, 1)
gl.Vertex3f(-0.5*s.width, 0.5*s.height, 0)
gl.End()
gl.Disable(gl.TEXTURE_2D)
gl.Disable(gl.BLEND)
}
示例2: Draw
func (self *Picker) Draw(t int64) {
gl.MatrixMode(gl.MODELVIEW)
gl.PushMatrix()
gl.LoadIdentity()
gl.Disable(gl.DEPTH_TEST)
gl.Disable(gl.LIGHTING)
gl.Disable(gl.LIGHT0)
gl.Disable(gl.LIGHT1)
gl.Begin(gl.TRIANGLE_FAN)
gl.Color4ub(0, 0, 0, 128)
gl.Vertex2f(self.x, self.y)
for angle := float64(0); angle <= 2*math.Pi; angle += math.Pi / 2 / 10 {
gl.Vertex2f(self.x-float32(math.Sin(angle))*self.radius, self.y+float32(math.Cos(angle))*self.radius)
}
gl.End()
self.DrawItemHighlight(t, ThePlayer.currentAction)
self.DrawPlayerItems(t, true)
gl.PopMatrix()
}
示例3: Draw
func (self *Pause) Draw(t int64) {
gl.MatrixMode(gl.MODELVIEW)
gl.PushMatrix()
gl.LoadIdentity()
gl.Disable(gl.DEPTH_TEST)
gl.Disable(gl.LIGHTING)
gl.Disable(gl.LIGHT0)
gl.Disable(gl.LIGHT1)
gl.Color4ub(0, 0, 0, 240)
gl.Begin(gl.QUADS)
gl.Vertex2f(float32(viewport.lplane), float32(viewport.bplane))
gl.Vertex2f(float32(viewport.rplane), float32(viewport.bplane))
gl.Vertex2f(float32(viewport.rplane), float32(viewport.tplane))
gl.Vertex2f(float32(viewport.lplane), float32(viewport.tplane))
gl.End()
str := "paused"
h, w := pauseFont.Measure(str)
// x := (viewport.rplane - viewport.lplane - w) / 2
// y := (viewport.tplane - viewport.bplane - h) / 2
gl.Translated(-w/2, -h/2, 0)
pauseFont.Print(str)
gl.PopMatrix()
}
示例4: Draw
func (self *Console) Draw(t int64) {
gl.MatrixMode(gl.MODELVIEW)
gl.PushMatrix()
gl.LoadIdentity()
gl.Disable(gl.DEPTH_TEST)
gl.Disable(gl.LIGHTING)
gl.Disable(gl.LIGHT0)
gl.Disable(gl.LIGHT1)
h := float32(consoleFont.height) * PIXEL_SCALE
margin := float32(3.0) * PIXEL_SCALE
consoleHeight := 3 * h
gl.MatrixMode(gl.MODELVIEW)
gl.LoadIdentity()
gl.Color4ub(0, 0, 0, 208)
gl.Begin(gl.QUADS)
gl.Vertex2f(float32(viewport.lplane), float32(viewport.bplane)+consoleHeight+margin*2) // Bottom Left Of The Texture and Quad
gl.Vertex2f(float32(viewport.rplane), float32(viewport.bplane)+consoleHeight+margin*2) // Bottom Right Of The Texture and Quad
gl.Vertex2f(float32(viewport.rplane), float32(viewport.bplane)) // Top Right Of The Texture and Quad
gl.Vertex2f(float32(viewport.lplane), float32(viewport.bplane)) // Top Left Of The Texture and Quad
gl.End()
gl.Translatef(float32(viewport.lplane)+margin, float32(viewport.bplane)+consoleHeight+margin-h, 0)
consoleFont.Print(fmt.Sprintf("FPS: %5.2f V: %d (%d) CH: %d M: %d", self.fps, self.vertices, self.culledVertices, len(TheWorld.chunks), len(TheWorld.mobs)))
gl.LoadIdentity()
gl.Translatef(float32(viewport.lplane)+margin, float32(viewport.bplane)+consoleHeight+margin-2*h, 0)
consoleFont.Print(fmt.Sprintf("X: %5.2f Y: %4.2f Z: %5.2f H: %5.2f (%s) D: %0.1f (%d)", ThePlayer.position[XAXIS], ThePlayer.position[YAXIS], ThePlayer.position[ZAXIS], ThePlayer.heading, HeadingToCompass(ThePlayer.heading), ThePlayer.distanceTravelled, ThePlayer.distanceFromStart))
gl.LoadIdentity()
gl.Translatef(float32(viewport.lplane)+margin, float32(viewport.bplane)+consoleHeight+margin-3*h, 0)
numgc := uint32(0)
avggc := float64(0)
var last3 [3]float64
if self.mem.NumGC > 3 {
numgc = self.mem.NumGC
avggc = float64(self.mem.PauseTotalNs) / float64(self.mem.NumGC) / 1e6
index := int(numgc) - 1
if index > 255 {
index = 255
}
last3[0] = float64(self.mem.PauseNs[index]) / 1e6
last3[1] = float64(self.mem.PauseNs[index-1]) / 1e6
last3[2] = float64(self.mem.PauseNs[index-2]) / 1e6
}
consoleFont.Print(fmt.Sprintf("Mem: %.1f/%.1f GC: %.1fms [%d: %.1f, %.1f, %.1f] ChGen: %.1fms | Sc: %.1f TOD: %.1f", float64(self.mem.Alloc)/(1024*1024), float64(self.mem.Sys)/(1024*1024), avggc, numgc, last3[0], last3[1], last3[2], float64(self.chunkGenerationTime)/1e6, viewport.scale, timeOfDay))
gl.PopMatrix()
}
示例5: RenderScaled
func (t *Skybox) RenderScaled(center, scale *Vec3) {
v := []*Vec3{
V3(-1, -1, 1),
V3(1, -1, 1),
V3(1, 1, 1),
V3(-1, 1, 1),
V3(-1, -1, -1),
V3(1, -1, -1),
V3(1, 1, -1),
V3(-1, 1, -1)}
for i := 0; i < 8; i++ {
v[i].Muli(scale).Addi(center)
}
if globals.UseShader {
program.Unuse()
}
//*//save attributes and change them
gl.PushAttrib(gl.ENABLE_BIT | gl.TEXTURE_BIT)
defer gl.PopAttrib() //reset to old attributes
gl.Enable(gl.TEXTURE_2D)
gl.Disable(gl.DEPTH_TEST)
gl.Disable(gl.LIGHTING)
gl.Disable(gl.BLEND) //*/
oneSide := func(tex *texture.Texture, a, b, c, d int, n *Vec3) {
tex.BindForSkybox(color.White)
gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE)
gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE)
gl.Begin(gl.TRIANGLES)
gl.Normal3dv(n.Slc())
gl.TexCoord2i(0, 0)
gl.Vertex3dv(v[a].Slc())
gl.TexCoord2i(1, 0)
gl.Vertex3dv(v[b].Slc())
gl.TexCoord2i(1, 1)
gl.Vertex3dv(v[c].Slc())
gl.TexCoord2i(0, 0)
gl.Vertex3dv(v[a].Slc())
gl.TexCoord2i(1, 1)
gl.Vertex3dv(v[c].Slc())
gl.TexCoord2i(0, 1)
gl.Vertex3dv(v[d].Slc())
gl.End()
}
oneSide(t.up, 2, 3, 7, 6, V3(0, -1, 0))
oneSide(t.dn, 5, 4, 0, 1, V3(0, 1, 0))
oneSide(t.lt, 5, 1, 2, 6, V3(1, 0, 0))
oneSide(t.rt, 0, 4, 7, 3, V3(-1, 0, 0))
oneSide(t.ft, 1, 0, 3, 2, V3(0, 0, -1))
oneSide(t.bk, 4, 5, 6, 7, V3(0, 0, 1))
}
示例6: draw
func (this *App) draw() {
gl.Disable(gl.CULL_FACE)
gl.Disable(gl.LIGHTING)
gl.Disable(gl.DEPTH_TEST)
White.Gl()
var w, h = Double(this.win.Width()), Double(this.win.Height())
drawTexRect(this.texmandel, V2(0, 0), V2(w, h))
var col = color24.NewColor24(0, 0, 0)
this.frac.Gradient().Interpolate(col, this.cursor.Pos.X)
this.cursor.Draw(w, h, col)
this.win.FinishFrame()
}
示例7: main
func main() {
glfw.Init()
defer glfw.Terminate()
glfw.OpenWindow(640, 480, 8, 8, 8, 8, 0, 0, glfw.Windowed)
defer glfw.CloseWindow()
glfw.SetWindowTitle("Tile test")
glfw.Enable(glfw.StickyKeys)
glfw.SetSwapInterval(1)
glfw.SetKeyCallback(inputCallback)
gl.MatrixMode(gl.PROJECTION)
gl.LoadIdentity()
gl.Ortho(0, GridWidth, GridHeight, 0, -1, 1)
gl.MatrixMode(gl.MODELVIEW)
gl.Disable(gl.DEPTH_TEST)
gl.Enable(gl.TEXTURE_2D)
gl.Enable(gl.BLEND)
gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
gl.ClearColor(0.0, 0.0, 0.0, 1.0)
initResources()
initWorld()
for Running {
if (time.Since(DT).Nanoseconds() / 1000000) > 15 { //don't loop faster than every 15ms
DT = time.Now()
gl.Clear(gl.COLOR_BUFFER_BIT)
player.update()
renderScene()
glfw.SwapBuffers()
}
}
}
示例8: handleKeyPress
// handle key press events
func handleKeyPress(keysym sdl.Keysym) {
switch keysym.Sym {
case sdl.K_f: // f key pages through filters
filter = (filter + 1) % 3
p("new filter:", filter)
case sdl.K_l: // l key toggles light
light = !light
if light {
p("light on")
gl.Enable(gl.LIGHTING)
} else {
p("light off")
gl.Disable(gl.LIGHTING)
}
case sdl.K_PAGEUP: // page up zooms into the scene
z -= 0.02
case sdl.K_PAGEDOWN: // zoom out of the scene
z += 0.02
case sdl.K_UP: // up arrow affects x rotation
xspeed -= 0.01
case sdl.K_DOWN: // down arrow affects x rotation
xspeed += 0.01
case sdl.K_RIGHT: // affect y rotation
yspeed += 0.01
case sdl.K_LEFT: // affect y rotation
yspeed -= 0.01
case sdl.K_ESCAPE:
Quit(0)
case sdl.K_F1:
sdl.WM_ToggleFullScreen(surface)
}
}
示例9: Reshape
func (v *Video) Reshape(width int, height int) {
x_offset := 0
y_offset := 0
r := ((float64)(height)) / ((float64)(width))
if r > 0.9375 { // Height taller than ratio
h := (int)(math.Floor((float64)(0.9375 * (float64)(width))))
y_offset = (height - h) / 2
height = h
} else if r < 0.9375 { // Width wider
var scrW, scrH float64
if ppu.OverscanEnabled {
scrW = 240.0
scrH = 224.0
} else {
scrW = 256.0
scrH = 240.0
}
w := (int)(math.Floor((float64)((scrH / scrW) * (float64)(height))))
x_offset = (width - w) / 2
width = w
}
gl.Viewport(x_offset, y_offset, width, height)
gl.MatrixMode(gl.PROJECTION)
gl.LoadIdentity()
gl.Ortho(-1, 1, -1, 1, -1, 1)
gl.MatrixMode(gl.MODELVIEW)
gl.LoadIdentity()
gl.Disable(gl.DEPTH_TEST)
}
示例10: onKey
func onKey(key, state int) {
switch key {
case glfw.KeyEsc:
running = false
case 76: // L
if state == 1 {
if light = !light; !light {
gl.Disable(gl.LIGHTING)
} else {
gl.Enable(gl.LIGHTING)
}
}
case 70: // F
if state == 1 {
if filter++; filter >= len(textures) {
filter = 0
}
}
case glfw.KeyPageup:
z -= 0.2
case glfw.KeyPagedown:
z += 0.2
case glfw.KeyUp:
speed[0] -= 0.1
case glfw.KeyDown:
speed[0] += 0.1
case glfw.KeyLeft:
speed[1] -= 0.1
case glfw.KeyRight:
speed[1] += 0.1
}
}
示例11: onKey
func onKey(key, state int) {
switch key {
case glfw.KeyEsc:
running = false
case 'L':
if state == 1 {
if light = !light; !light {
gl.Disable(gl.LIGHTING)
} else {
gl.Enable(gl.LIGHTING)
}
}
case 'F':
if state == 1 {
if filter++; filter >= len(textures) {
filter = 0
}
}
case 'B': // B
if state == 1 {
if blend = !blend; blend {
gl.Enable(gl.BLEND)
gl.Disable(gl.DEPTH_TEST)
} else {
gl.Disable(gl.BLEND)
gl.Enable(gl.DEPTH_TEST)
}
}
case glfw.KeyPageup:
z -= 0.2
case glfw.KeyPagedown:
z += 0.2
case glfw.KeyUp:
speed[0] -= 0.1
case glfw.KeyDown:
speed[0] += 0.1
case glfw.KeyLeft:
speed[1] -= 0.1
case glfw.KeyRight:
speed[1] += 0.1
}
}
示例12: uploadTexture
func uploadTexture(img *image.RGBA) gl.Texture {
gl.Enable(gl.TEXTURE_2D)
tex := gl.GenTexture()
tex.Bind(gl.TEXTURE_2D)
gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST)
gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST)
gl.TexImage2D(gl.TEXTURE_2D, 0, 4, img.Bounds().Max.X, img.Bounds().Max.Y,
0, gl.RGBA, gl.UNSIGNED_BYTE, img.Pix)
gl.Disable(gl.TEXTURE_2D)
return tex
}
示例13: main
func main() {
var err error
if err = glfw.Init(); err != nil {
fmt.Fprintf(os.Stderr, "[e] %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, "[e] %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()
}
}
示例14: initialize
func initialize(WIDTH, HEIGHT int) {
gl.MatrixMode(gl.PROJECTION)
gl.LoadIdentity()
gl.Ortho(0, float64(WIDTH), float64(HEIGHT), 0, 0, 1)
gl.MatrixMode(gl.MODELVIEW)
gl.Disable(gl.DEPTH_TEST)
}
示例15: Draw
func (this *Cursor) Draw(w, h Double, col *color24.Color24) {
var p = this.Pos.Mul(V2(w, h))
var a = p.Add(V2(-10, -10))
var b = p.Add(V2(10, -10))
gl.Disable(gl.TEXTURE_2D)
col.Gl()
gl.Begin(gl.TRIANGLES)
p.Gl()
a.Gl()
b.Gl()
gl.End()
gl.Enable(gl.TEXTURE_2D)
}