本文整理汇总了Golang中github.com/chsc/gogl/gl21.Enable函数的典型用法代码示例。如果您正苦于以下问题:Golang Enable函数的具体用法?Golang Enable怎么用?Golang Enable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Enable函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: run
func (w *Window) run(init func(w *Window)) {
runtime.LockOSThread()
glfw.MakeContextCurrent(w.w)
defer glfw.MakeContextCurrent(nil)
init(w)
// glfw should fire initial resize events to avoid this duplication (https://github.com/glfw/glfw/issues/62)
w.resized(w.w.Size())
w.framebufferResized(w.w.FramebufferSize())
gl.Enable(gl.SCISSOR_TEST)
gl.Enable(gl.BLEND)
gl.Enable(gl.POINT_SMOOTH)
gl.Enable(gl.LINE_SMOOTH)
gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
for !w.close {
select {
case f := <-w.do:
f()
case <-w.paint:
gl.MatrixMode(gl.MODELVIEW)
gl.LoadIdentity()
gl.Scissor(0, 0, w.bufWidth, w.bufHeight)
gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)
w.base().paint()
w.w.SwapBuffers()
}
}
}
开发者ID:gordonklaus,项目名称:gui,代码行数:32,代码来源:window.go
示例2: run
func (w *Window) run() {
runtime.LockOSThread()
glfw.MakeContextCurrent(w.w)
defer glfw.MakeContextCurrent(nil)
// glfw should fire initial resize events to avoid this duplication (https://github.com/glfw/glfw/issues/62)
width, height := w.w.Size()
gl.MatrixMode(gl.PROJECTION)
gl.LoadIdentity()
gl.Ortho(0, gl.Double(width), 0, gl.Double(height), -1, 1)
Resize(w, Pt(float64(width), float64(height)))
width, height = w.w.FramebufferSize()
gl.Viewport(0, 0, gl.Sizei(width), gl.Sizei(height))
gl.Enable(gl.BLEND)
gl.Enable(gl.POINT_SMOOTH)
gl.Enable(gl.LINE_SMOOTH)
gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
for !w.close {
select {
case f := <-w.do:
f()
case <-w.paint:
gl.MatrixMode(gl.MODELVIEW)
gl.LoadIdentity()
gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)
w.base().paint()
w.w.SwapBuffers()
}
}
}
开发者ID:gordonklaus,项目名称:flux,代码行数:33,代码来源:window.go
示例3: PushClipPlanes
func (r Region) PushClipPlanes() {
if len(clippers) == 0 {
gl.Enable(gl.CLIP_PLANE0)
gl.Enable(gl.CLIP_PLANE1)
gl.Enable(gl.CLIP_PLANE2)
gl.Enable(gl.CLIP_PLANE3)
r.setClipPlanes()
clippers = append(clippers, r)
} else {
cur := clippers[len(clippers)-1]
clippers = append(clippers, r.Isect(cur))
clippers[len(clippers)-1].setClipPlanes()
}
}
开发者ID:dgthunder,项目名称:glop,代码行数:14,代码来源:gui.go
示例4: set3dView
func (o *OpenGl) set3dView() {
gl.Enable(gl.TEXTURE_2D)
gl.Enable(gl.DEPTH_TEST)
gl.Enable(gl.LIGHTING)
gl.Enable(gl.LIGHT0)
gl.MatrixMode(gl.PROJECTION)
gl.LoadIdentity()
//gl.Perspective(cam.Zoom(), o.mW / o.mH, cam.Near(), cam.Far())
gl.MatrixMode(gl.MODELVIEW)
//e := o.Camera.EYE()
//a := o.Camera.AT()
//u := o.Camera.UP()
//gl.LookAt(e.X, e.Y, e.Z, a.X, a.Y, a.Z, u.X, u.Y, u.Z)
}
开发者ID:knickers,项目名称:GOpenGL,代码行数:14,代码来源:GOpenGL.go
示例5: Init
func (s *Scene) Init() (err error) {
runtime.LockOSThread()
gl.Enable(gl.TEXTURE_2D)
gl.Enable(gl.DEPTH_TEST)
gl.ClearColor(0.0, 0.0, 0.0, 0.0)
gl.ClearDepth(1)
//gl.DepthFunc(gl.LEQUAL)
gl.Viewport(0, 0, Width, Height)
mm.init()
return
}
开发者ID:drasich,项目名称:ridley,代码行数:15,代码来源:scene.go
示例6: RenderAdvanced
func RenderAdvanced(x, y, dx, dy, rot float64, flip bool) {
setupTextureList()
if textureList == 0 {
return
}
var run, op mathgl.Mat4
run.Identity()
op.Translation(float32(x), float32(y), 0)
run.Multiply(&op)
op.Translation(float32(dx/2), float32(dy/2), 0)
run.Multiply(&op)
op.RotationZ(float32(rot))
run.Multiply(&op)
if flip {
op.Translation(float32(-dx/2), float32(-dy/2), 0)
run.Multiply(&op)
op.Scaling(float32(dx), float32(dy), 1)
run.Multiply(&op)
} else {
op.Translation(float32(dx/2), float32(-dy/2), 0)
run.Multiply(&op)
op.Scaling(float32(-dx), float32(dy), 1)
run.Multiply(&op)
}
gl.PushMatrix()
gl.MultMatrixf((*gl.Float)(&run[0]))
gl.Enable(gl.TEXTURE_2D)
gl.CallList(textureList)
gl.PopMatrix()
}
开发者ID:runningwild,项目名称:jbot,代码行数:30,代码来源:manager.go
示例7: Draw
func (tsm *ThunderSubMenu) Draw(region Region, style StyleStack) {
gl.Disable(gl.TEXTURE_2D)
gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
gl.Enable(gl.BLEND)
base.EnableShader("marble")
offset, ok := style.Get("offset").(linear.Vec2)
if ok {
base.SetUniformV2("marble", "offset", offset)
} else {
base.SetUniformV2("marble", "offset", linear.Vec2{})
}
gl.Color4ub(255, 255, 255, 255)
gl.Begin(gl.QUADS)
x := gl.Int(region.X)
y := gl.Int(region.Y)
dx := gl.Int(region.Dx)
dy := gl.Int(region.Dy)
gl.Vertex2i(x, y)
gl.Vertex2i(x, y+dy)
gl.Vertex2i(x+dx, y+dy)
gl.Vertex2i(x+dx, y)
gl.End()
base.EnableShader("")
for i, option := range tsm.Options {
region.Dy = tsm.requests[option].Dy
if i == tsm.selected {
style.PushStyle(map[string]interface{}{"selected": true})
} else {
style.PushStyle(map[string]interface{}{"selected": false})
}
option.Draw(region, style)
style.Pop()
region.Y += tsm.requests[option].Dy
}
}
开发者ID:runningwild,项目名称:magnus,代码行数:35,代码来源:thunder_menu.go
示例8: InitGL
func InitGL(smooth bool, multisample int) {
core.Fatal(gl.Init())
gl.Enable(gl.LIGHTING)
gl.Enable(gl.CULL_FACE)
gl.CullFace(gl.BACK)
if multisample != 0 {
gl.Enable(gl.MULTISAMPLE)
}
if smooth {
gl.ShadeModel(gl.SMOOTH)
}
}
开发者ID:shenyp09,项目名称:mx3,代码行数:16,代码来源:init.go
示例9: Draw
func (ms *ManaSource) Draw(local *LocalData, zoom float64, dx float64, dy float64) {
if local.nodeTextureData == nil {
// gl.Enable(gl.TEXTURE_2D)
local.nodeTextureData = make([]byte, ms.options.NumNodeRows*ms.options.NumNodeCols*3)
gl.GenTextures(1, &local.nodeTextureId)
gl.BindTexture(gl.TEXTURE_2D, local.nodeTextureId)
gl.TexEnvf(gl.TEXTURE_ENV, gl.TEXTURE_ENV_MODE, gl.MODULATE)
gl.TexParameterf(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR)
gl.TexParameterf(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR)
gl.TexParameterf(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.REPEAT)
gl.TexParameterf(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT)
gl.TexImage2D(
gl.TEXTURE_2D,
0,
gl.RGB,
gl.Sizei(ms.options.NumNodeRows),
gl.Sizei(ms.options.NumNodeCols),
0,
gl.RGB,
gl.UNSIGNED_BYTE,
gl.Pointer(&local.nodeTextureData[0]))
}
for i := range ms.rawNodes {
for c := 0; c < 3; c++ {
color_frac := ms.rawNodes[i].Mana[c] * 1.0 / ms.options.NodeMagnitude
color_range := float64(ms.options.MaxNodeBrightness - ms.options.MinNodeBrightness)
local.nodeTextureData[i*3+c] = byte(
color_frac*color_range + float64(ms.options.MinNodeBrightness))
}
}
gl.Enable(gl.TEXTURE_2D)
//gl.ActiveTexture(gl.TEXTURE0)
gl.BindTexture(gl.TEXTURE_2D, local.nodeTextureId)
gl.TexSubImage2D(
gl.TEXTURE_2D,
0,
0,
0,
gl.Sizei(ms.options.NumNodeRows),
gl.Sizei(ms.options.NumNodeCols),
gl.RGB,
gl.UNSIGNED_BYTE,
gl.Pointer(&local.nodeTextureData[0]))
base.EnableShader("nodes")
base.SetUniformI("nodes", "width", ms.options.NumNodeRows*3)
base.SetUniformI("nodes", "height", ms.options.NumNodeCols*3)
base.SetUniformI("nodes", "drains", 1)
base.SetUniformI("nodes", "tex0", 0)
base.SetUniformI("nodes", "tex1", 1)
base.SetUniformF("nodes", "zoom", float32(zoom))
gl.ActiveTexture(gl.TEXTURE0)
gl.BindTexture(gl.TEXTURE_2D, local.nodeTextureId)
// I have no idea why this value for move works, but it does. So, hooray.
move := (dx - dy) / 2
texture.RenderAdvanced(move, -move, dy, dx, 3.1415926535/2, true)
base.EnableShader("")
gl.Disable(gl.TEXTURE_2D)
}
开发者ID:runningwild,项目名称:magnus,代码行数:60,代码来源:mana_source.go
示例10: initWindow
func initWindow(sys system.System, width int, height int) {
sys.CreateWindow(10, 10, width, height)
sys.EnableVSync(false)
err := gl.Init()
if err != nil {
panic(err)
}
gl.Enable(gl.BLEND)
gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
gl.EnableClientState(gl.VERTEX_ARRAY)
gl.EnableClientState(gl.COLOR_ARRAY)
gl.Enable(gl.CULL_FACE)
gl.FrontFace(gl.CW)
gl.ClearColor(0, 0, 0, 1)
}
开发者ID:runningwild,项目名称:arkanoid,代码行数:18,代码来源:main.go
示例11: glInit
func glInit(width, height int) {
gl.Init()
gl.Enable(gl.TEXTURE_2D)
gl.PixelStorei(gl.UNPACK_ALIGNMENT, 1)
gl.Viewport(0, 0, gl.Sizei(width), gl.Sizei(height))
gl.MatrixMode(gl.PROJECTION)
gl.LoadIdentity()
gl.Ortho(0, gl.Double(width), gl.Double(height), 0, -1, 1)
gl.MatrixMode(gl.MODELVIEW)
gl.LoadIdentity()
gl.Enable(gl.BLEND)
gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
gl.EnableClientState(gl.VERTEX_ARRAY)
gl.EnableClientState(gl.COLOR_ARRAY)
gl.EnableClientState(gl.TEXTURE_COORD_ARRAY)
gl.VertexPointer(2, gl.FLOAT, 0, gl.Pointer(&vs[0]))
gl.ColorPointer(3, gl.UNSIGNED_BYTE, 0, gl.Pointer(&cs[0]))
gl.TexCoordPointer(2, gl.FLOAT, 0, gl.Pointer(&ts[0]))
}
开发者ID:ajhager,项目名称:rog,代码行数:20,代码来源:backend.go
示例12: initScene
func initScene() {
gl.Disable(gl.TEXTURE_2D)
gl.Disable(gl.DEPTH_TEST)
gl.Enable(gl.BLEND)
gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
gl.Disable(gl.ALPHA_TEST)
gl.Enable(gl.LINE_SMOOTH)
gl.Hint(gl.LINE_SMOOTH_HINT, gl.NICEST)
gl.PolygonMode(gl.FRONT_AND_BACK, gl.LINE)
gl.LineWidth(1.0)
gl.ClearColor(0.0, 0.0, 0.0, 0.0)
gl.ClearDepth(1)
//gl.DepthFunc(gl.LEQUAL)
gl.Viewport(0, 0, Width, Height)
gl.MatrixMode(gl.PROJECTION)
gl.LoadIdentity()
perspective(110.0, 1.0, 4, 8192)
}
开发者ID:jayschwa,项目名称:groke,代码行数:20,代码来源:bspview.go
示例13: ClearScene
func ClearScene() {
ambient := []gl.Float{0.7, 0.7, 0.7, 1}
diffuse := []gl.Float{0.9, 0.9, 0.9, 1}
lightpos := []gl.Float{0.2, 0.5, 1, 1}
gl.Lightfv(gl.LIGHT0, gl.AMBIENT, &ambient[0])
gl.Lightfv(gl.LIGHT0, gl.DIFFUSE, &diffuse[0])
gl.Lightfv(gl.LIGHT0, gl.POSITION, &lightpos[0])
gl.Enable(gl.LIGHT0)
gl.ClearColor(1, 1, 1, 1)
gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)
}
开发者ID:shenyp09,项目名称:mx3,代码行数:11,代码来源:magnetization.go
示例14: Text
func Text(x, y, z float32, str string) {
gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
gl.Enable(gl.BLEND)
gl.RasterPos3f(x, y, z)
for _, ch := range str {
//glut.BitmapCharacter(glut.BITMAP_9_BY_15, string(ch))
}
gl.Disable(gl.BLEND)
}
开发者ID:knickers,项目名称:GOpenGL,代码行数:11,代码来源:text.go
示例15: makeErrorTexture
func makeErrorTexture() {
gl.Enable(gl.TEXTURE_2D)
gl.GenTextures(1, (*gl.Uint)(&error_texture))
gl.BindTexture(gl.TEXTURE_2D, error_texture)
gl.TexEnvf(gl.TEXTURE_ENV, gl.TEXTURE_ENV_MODE, gl.MODULATE)
gl.TexParameterf(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR)
gl.TexParameterf(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR)
gl.TexParameterf(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.REPEAT)
gl.TexParameterf(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT)
pink := []byte{255, 0, 255, 255}
gl.TexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.BYTE, gl.Pointer(&pink[0]))
}
开发者ID:runningwild,项目名称:jbot,代码行数:12,代码来源:texture_devel.go
示例16: RenderLocalEditor
func (g *Game) RenderLocalEditor(region g2.Region) {
g.editor.Lock()
defer g.editor.Unlock()
g.editor.region = region
g.editor.camera.regionDims = linear.Vec2{float64(region.Dims.Dx), float64(region.Dims.Dy)}
levelDims := linear.Vec2{float64(g.Level.Room.Dx), float64(g.Level.Room.Dy)}
g.editor.camera.StandardRegion(levelDims.Scale(0.5), levelDims)
g.editor.camera.approachTarget()
gl.MatrixMode(gl.PROJECTION)
gl.PushMatrix()
gl.LoadIdentity()
defer gl.PopMatrix()
gl.PushAttrib(gl.VIEWPORT_BIT)
gl.Viewport(gl.Int(region.X), gl.Int(region.Y), gl.Sizei(region.Dx), gl.Sizei(region.Dy))
defer gl.PopAttrib()
current := &g.editor.camera.current
gl.Ortho(
gl.Double(current.mid.X-current.dims.X/2),
gl.Double(current.mid.X+current.dims.X/2),
gl.Double(current.mid.Y+current.dims.Y/2),
gl.Double(current.mid.Y-current.dims.Y/2),
gl.Double(1000),
gl.Double(-1000),
)
defer func() {
gl.MatrixMode(gl.PROJECTION)
gl.PopMatrix()
gl.MatrixMode(gl.MODELVIEW)
}()
gl.MatrixMode(gl.MODELVIEW)
gl.Enable(gl.BLEND)
gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
g.renderWalls()
g.renderEdges()
g.renderBases()
g.renderEntsAndAbilities()
g.renderProcesses()
g.editor.renderPathing(&g.Level.Room, g.local.pathingData)
switch g.editor.action {
case editorActionNone:
case editorActionPlaceBlock:
g.editor.renderPlaceBlock(g)
default:
base.Error().Printf("Unexpected editorAction: %v", g.editor.action)
}
}
开发者ID:runningwild,项目名称:jota,代码行数:53,代码来源:editor_graphics.go
示例17: Number
func Number(x, y, z, n float32) {
gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
gl.Enable(gl.BLEND)
s := ""
fmt.Fprintf(s, "%f", n)
gl.RasterPos3f(x, y, z)
for _, ch := range s {
//glut.BitmapCharacter(glut.BITMAP_9_BY_15, string(ch))
}
gl.Disable(gl.BLEND)
}
开发者ID:knickers,项目名称:GOpenGL,代码行数:13,代码来源:text.go
示例18: Render
func Render(x, y, dx, dy float64) {
var run, op mathgl.Mat4
run.Identity()
op.Translation(float32(x), float32(y), 0)
run.Multiply(&op)
op.Scaling(float32(dx), float32(dy), 1)
run.Multiply(&op)
gl.PushMatrix()
gl.Enable(gl.TEXTURE_2D)
gl.MultMatrixf((*gl.Float)(&run[0]))
gl.CallList(textureList)
gl.PopMatrix()
}
开发者ID:dgthunder,项目名称:magnus,代码行数:14,代码来源:manager.go
示例19: Draw
func (sb *spriteBox) Draw(region gui.Region) {
gl.Disable(gl.TEXTURE_2D)
gl.Color4d(sb.r, sb.g, sb.b, 1)
gl.Begin(gl.QUADS)
gl.Vertex2i(int32(region.X+region.Dx/3), int32(region.Y))
gl.Vertex2i(int32(region.X+region.Dx/3), int32(region.Y+region.Dy))
gl.Vertex2i(int32(region.X+region.Dx/3*2), int32(region.Y+region.Dy))
gl.Vertex2i(int32(region.X+region.Dx/3*2), int32(region.Y))
gl.End()
if sb.s != nil {
gl.Enable(gl.TEXTURE_2D)
tx, ty, tx2, ty2 := sb.s.Bind()
// fmt.Printf("Tex: %f %f %f %f\n", tx, ty, tx2, ty2)
gl.Enable(gl.BLEND)
gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
gl.Color4f(1, 1, 1, 1)
gl.Begin(gl.QUADS)
x := int32(region.X + region.Dx/2)
y := int32(region.Y + region.Dy/2)
gl.TexCoord2d(tx, -ty)
gl.Vertex2i(x-50, y-75)
gl.TexCoord2d(tx, -ty2)
gl.Vertex2i(x-50, y+75)
gl.TexCoord2d(tx2, -ty2)
gl.Vertex2i(x+50, y+75)
gl.TexCoord2d(tx2, -ty)
gl.Vertex2i(x+50, y-75)
gl.End()
gl.Color4d(1, 1, 1, 1)
text := fmt.Sprintf("%d : %s : %s", sb.s.Facing(), sb.s.Anim(), sb.s.AnimState())
if sb.top {
dict.RenderString(text, float64(region.X), float64(region.Y+region.Dy)-dict.MaxHeight(), 0, dict.MaxHeight(), gui.Left)
} else {
dict.RenderString(text, float64(region.X), float64(region.Y), 0, dict.MaxHeight(), gui.Left)
}
}
}
开发者ID:runningwild,项目名称:tester,代码行数:37,代码来源:main.go
示例20: initScene
func initScene() (err error) {
gl.Enable(gl.TEXTURE_2D)
gl.Enable(gl.DEPTH_TEST)
gl.Enable(gl.LIGHTING)
gl.ClearColor(0.5, 0.5, 0.5, 0.0)
gl.ClearDepth(1)
gl.DepthFunc(gl.LEQUAL)
gl.Lightfv(gl.LIGHT0, gl.AMBIENT, &ambient[0])
gl.Lightfv(gl.LIGHT0, gl.DIFFUSE, &diffuse[0])
gl.Lightfv(gl.LIGHT0, gl.POSITION, &lightpos[0])
gl.Enable(gl.LIGHT0)
gl.Viewport(0, 0, Width, Height)
gl.MatrixMode(gl.PROJECTION)
gl.LoadIdentity()
gl.Frustum(-1, 1, -1, 1, 1.0, 10.0)
gl.MatrixMode(gl.MODELVIEW)
gl.LoadIdentity()
texture, err = createTextureFromBytes(gopher_png[:])
return
}
开发者ID:sserafimescu,项目名称:gogl,代码行数:24,代码来源:gopher.go
注:本文中的github.com/chsc/gogl/gl21.Enable函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论