2014-08-25 16:17:08 +04:00
|
|
|
// Copyright 2014 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2015-01-15 22:32:55 +03:00
|
|
|
// +build linux darwin
|
2014-08-26 18:03:00 +04:00
|
|
|
// +build !gldebug
|
|
|
|
|
2014-08-25 16:17:08 +04:00
|
|
|
package gl
|
|
|
|
|
|
|
|
// TODO(crawshaw): build on more host platforms (makes it easier to gobind).
|
|
|
|
// TODO(crawshaw): expand to cover OpenGL ES 3.
|
|
|
|
// TODO(crawshaw): should functions on specific types become methods? E.g.
|
|
|
|
// func (t Texture) Bind(target Enum)
|
|
|
|
// this seems natural in Go, but moves us slightly
|
|
|
|
// further away from the underlying OpenGL spec.
|
|
|
|
|
2015-05-28 13:08:52 +03:00
|
|
|
// #include "work.h"
|
2014-12-05 18:14:12 +03:00
|
|
|
import "C"
|
|
|
|
|
2015-05-28 13:08:52 +03:00
|
|
|
import (
|
|
|
|
"math"
|
|
|
|
"unsafe"
|
|
|
|
)
|
2014-12-05 18:14:12 +03:00
|
|
|
|
2014-08-25 16:17:08 +04:00
|
|
|
// ActiveTexture sets the active texture unit.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glActiveTexture.xhtml
|
|
|
|
func ActiveTexture(texture Enum) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnActiveTexture,
|
|
|
|
a0: texture.c(),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// AttachShader attaches a shader to a program.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glAttachShader.xhtml
|
|
|
|
func AttachShader(p Program, s Shader) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnAttachShader,
|
|
|
|
a0: p.c(),
|
|
|
|
a1: s.c(),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// BindAttribLocation binds a vertex attribute index with a named
|
|
|
|
// variable.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glBindAttribLocation.xhtml
|
|
|
|
func BindAttribLocation(p Program, a Attrib, name string) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnBindAttribLocation,
|
|
|
|
a0: p.c(),
|
|
|
|
a1: a.c(),
|
|
|
|
a2: C.uintptr_t(uintptr(unsafe.Pointer(C.CString(name)))),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// BindBuffer binds a buffer.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glBindBuffer.xhtml
|
|
|
|
func BindBuffer(target Enum, b Buffer) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnBindBuffer,
|
|
|
|
a0: target.c(),
|
|
|
|
a1: b.c(),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// BindFramebuffer binds a framebuffer.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glBindFramebuffer.xhtml
|
|
|
|
func BindFramebuffer(target Enum, fb Framebuffer) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnBindFramebuffer,
|
|
|
|
a0: target.c(),
|
|
|
|
a1: fb.c(),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// BindRenderbuffer binds a render buffer.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glBindRenderbuffer.xhtml
|
|
|
|
func BindRenderbuffer(target Enum, rb Renderbuffer) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnBindRenderbuffer,
|
|
|
|
a0: target.c(),
|
|
|
|
a1: rb.c(),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// BindTexture binds a texture.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glBindTexture.xhtml
|
|
|
|
func BindTexture(target Enum, t Texture) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnBindTexture,
|
|
|
|
a0: target.c(),
|
|
|
|
a1: t.c(),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// BlendColor sets the blend color.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glBlendColor.xhtml
|
|
|
|
func BlendColor(red, green, blue, alpha float32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnBlendColor,
|
|
|
|
a0: C.uintptr_t(math.Float32bits(red)),
|
|
|
|
a1: C.uintptr_t(math.Float32bits(green)),
|
|
|
|
a2: C.uintptr_t(math.Float32bits(blue)),
|
|
|
|
a3: C.uintptr_t(math.Float32bits(alpha)),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// BlendEquation sets both RGB and alpha blend equations.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glBlendEquation.xhtml
|
|
|
|
func BlendEquation(mode Enum) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnBlendEquation,
|
|
|
|
a0: mode.c(),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// BlendEquationSeparate sets RGB and alpha blend equations separately.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glBlendEquationSeparate.xhtml
|
|
|
|
func BlendEquationSeparate(modeRGB, modeAlpha Enum) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnBlendEquationSeparate,
|
|
|
|
a0: modeRGB.c(),
|
|
|
|
a1: modeAlpha.c(),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// BlendFunc sets the pixel blending factors.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glBlendFunc.xhtml
|
|
|
|
func BlendFunc(sfactor, dfactor Enum) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnBlendFunc,
|
|
|
|
a0: sfactor.c(),
|
|
|
|
a1: dfactor.c(),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// BlendFunc sets the pixel RGB and alpha blending factors separately.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glBlendFuncSeparate.xhtml
|
|
|
|
func BlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha Enum) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnBlendFuncSeparate,
|
|
|
|
a0: sfactorRGB.c(),
|
|
|
|
a1: dfactorRGB.c(),
|
|
|
|
a2: sfactorAlpha.c(),
|
|
|
|
a3: dfactorAlpha.c(),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// BufferData creates a new data store for the bound buffer object.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glBufferData.xhtml
|
2015-03-24 06:18:30 +03:00
|
|
|
func BufferData(target Enum, src []byte, usage Enum) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnBufferData,
|
|
|
|
a0: target.c(),
|
|
|
|
a1: C.uintptr_t(len(src)),
|
|
|
|
a2: (C.uintptr_t)(uintptr(unsafe.Pointer(&src[0]))),
|
|
|
|
a3: usage.c(),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
2015-05-28 13:08:52 +03:00
|
|
|
// BufferInit creates a new uninitialized data store for the bound buffer object.
|
2014-08-25 16:17:08 +04:00
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glBufferData.xhtml
|
|
|
|
func BufferInit(target Enum, size int, usage Enum) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnBufferData,
|
|
|
|
a0: target.c(),
|
|
|
|
a1: C.uintptr_t(size),
|
|
|
|
a2: 0,
|
|
|
|
a3: usage.c(),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// BufferSubData sets some of data in the bound buffer object.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glBufferSubData.xhtml
|
|
|
|
func BufferSubData(target Enum, offset int, data []byte) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnBufferSubData,
|
|
|
|
a0: target.c(),
|
|
|
|
a1: C.uintptr_t(offset),
|
|
|
|
a2: C.uintptr_t(len(data)),
|
|
|
|
a3: (C.uintptr_t)(uintptr(unsafe.Pointer(&data[0]))),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// CheckFramebufferStatus reports the completeness status of the
|
|
|
|
// active framebuffer.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glCheckFramebufferStatus.xhtml
|
|
|
|
func CheckFramebufferStatus(target Enum) Enum {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
return Enum(enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnCheckFramebufferStatus,
|
|
|
|
a0: target.c(),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
}))
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Clear clears the window.
|
|
|
|
//
|
|
|
|
// The behavior of Clear is influenced by the pixel ownership test,
|
|
|
|
// the scissor test, dithering, and the buffer writemasks.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glClear.xhtml
|
|
|
|
func Clear(mask Enum) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnClear,
|
|
|
|
a0: C.uintptr_t(mask),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// ClearColor specifies the RGBA values used to clear color buffers.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glClearColor.xhtml
|
|
|
|
func ClearColor(red, green, blue, alpha float32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnClearColor,
|
|
|
|
a0: C.uintptr_t(math.Float32bits(red)),
|
|
|
|
a1: C.uintptr_t(math.Float32bits(green)),
|
|
|
|
a2: C.uintptr_t(math.Float32bits(blue)),
|
|
|
|
a3: C.uintptr_t(math.Float32bits(alpha)),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// ClearDepthf sets the depth value used to clear the depth buffer.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glClearDepthf.xhtml
|
|
|
|
func ClearDepthf(d float32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnClearDepthf,
|
|
|
|
a0: C.uintptr_t(math.Float32bits(d)),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// ClearStencil sets the index used to clear the stencil buffer.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glClearStencil.xhtml
|
|
|
|
func ClearStencil(s int) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnClearStencil,
|
|
|
|
a0: C.uintptr_t(s),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// ColorMask specifies whether color components in the framebuffer
|
|
|
|
// can be written.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glColorMask.xhtml
|
|
|
|
func ColorMask(red, green, blue, alpha bool) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnColorMask,
|
|
|
|
a0: glBoolean(red),
|
|
|
|
a1: glBoolean(green),
|
|
|
|
a2: glBoolean(blue),
|
|
|
|
a3: glBoolean(alpha),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// CompileShader compiles the source code of s.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glCompileShader.xhtml
|
|
|
|
func CompileShader(s Shader) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnCompileShader,
|
|
|
|
a0: s.c(),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// CompressedTexImage2D writes a compressed 2D texture.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glCompressedTexImage2D.xhtml
|
|
|
|
func CompressedTexImage2D(target Enum, level int, internalformat Enum, width, height, border int, data []byte) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnCompressedTexImage2D,
|
|
|
|
a0: target.c(),
|
|
|
|
a1: C.uintptr_t(level),
|
|
|
|
a2: internalformat.c(),
|
|
|
|
a3: C.uintptr_t(width),
|
|
|
|
a4: C.uintptr_t(height),
|
|
|
|
a5: C.uintptr_t(border),
|
|
|
|
a6: C.uintptr_t(len(data)),
|
|
|
|
a7: C.uintptr_t(uintptr(unsafe.Pointer(&data[0]))),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// CompressedTexSubImage2D writes a subregion of a compressed 2D texture.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glCompressedTexSubImage2D.xhtml
|
|
|
|
func CompressedTexSubImage2D(target Enum, level, xoffset, yoffset, width, height int, format Enum, data []byte) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnCompressedTexSubImage2D,
|
|
|
|
a0: target.c(),
|
|
|
|
a1: C.uintptr_t(level),
|
|
|
|
a2: C.uintptr_t(xoffset),
|
|
|
|
a3: C.uintptr_t(yoffset),
|
|
|
|
a4: C.uintptr_t(width),
|
|
|
|
a5: C.uintptr_t(height),
|
|
|
|
a6: format.c(),
|
|
|
|
a7: C.uintptr_t(len(data)),
|
|
|
|
a8: C.uintptr_t(uintptr(unsafe.Pointer(&data[0]))),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// CopyTexImage2D writes a 2D texture from the current framebuffer.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glCopyTexImage2D.xhtml
|
|
|
|
func CopyTexImage2D(target Enum, level int, internalformat Enum, x, y, width, height, border int) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnCopyTexImage2D,
|
|
|
|
a0: target.c(),
|
|
|
|
a1: C.uintptr_t(level),
|
|
|
|
a2: internalformat.c(),
|
|
|
|
a3: C.uintptr_t(x),
|
|
|
|
a4: C.uintptr_t(y),
|
|
|
|
a5: C.uintptr_t(width),
|
|
|
|
a6: C.uintptr_t(height),
|
|
|
|
a7: C.uintptr_t(border),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// CopyTexSubImage2D writes a 2D texture subregion from the
|
|
|
|
// current framebuffer.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glCopyTexSubImage2D.xhtml
|
|
|
|
func CopyTexSubImage2D(target Enum, level, xoffset, yoffset, x, y, width, height int) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnCopyTexSubImage2D,
|
|
|
|
a0: target.c(),
|
|
|
|
a1: C.uintptr_t(level),
|
|
|
|
a2: C.uintptr_t(xoffset),
|
|
|
|
a3: C.uintptr_t(yoffset),
|
|
|
|
a4: C.uintptr_t(x),
|
|
|
|
a5: C.uintptr_t(y),
|
|
|
|
a6: C.uintptr_t(width),
|
|
|
|
a7: C.uintptr_t(height),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
2015-03-24 06:18:30 +03:00
|
|
|
// CreateBuffer creates a buffer object.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glGenBuffers.xhtml
|
|
|
|
func CreateBuffer() Buffer {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
return Buffer{Value: uint32(enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnGenBuffer,
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
}))}
|
2015-03-24 06:18:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// CreateFramebuffer creates a framebuffer object.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glGenFramebuffers.xhtml
|
|
|
|
func CreateFramebuffer() Framebuffer {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
return Framebuffer{Value: uint32(enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnGenFramebuffer,
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
}))}
|
2015-03-24 06:18:30 +03:00
|
|
|
}
|
|
|
|
|
2014-08-25 16:17:08 +04:00
|
|
|
// CreateProgram creates a new empty program object.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glCreateProgram.xhtml
|
|
|
|
func CreateProgram() Program {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
return Program{Value: uint32(enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnCreateProgram,
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
}))}
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
2015-03-24 06:18:30 +03:00
|
|
|
// CreateRenderbuffer create a renderbuffer object.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glGenRenderbuffers.xhtml
|
|
|
|
func CreateRenderbuffer() Renderbuffer {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
return Renderbuffer{Value: uint32(enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnGenRenderbuffer,
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
}))}
|
2015-03-24 06:18:30 +03:00
|
|
|
}
|
|
|
|
|
2014-08-25 16:17:08 +04:00
|
|
|
// CreateShader creates a new empty shader object.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glCreateShader.xhtml
|
|
|
|
func CreateShader(ty Enum) Shader {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
return Shader{Value: uint32(enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnCreateShader,
|
|
|
|
a0: C.uintptr_t(ty),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
}))}
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
2015-03-24 06:18:30 +03:00
|
|
|
// CreateTexture creates a texture object.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glGenTextures.xhtml
|
|
|
|
func CreateTexture() Texture {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
return Texture{Value: uint32(enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnGenTexture,
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
}))}
|
2015-03-24 06:18:30 +03:00
|
|
|
}
|
|
|
|
|
2014-08-25 16:17:08 +04:00
|
|
|
// CullFace specifies which polygons are candidates for culling.
|
|
|
|
//
|
|
|
|
// Valid modes: FRONT, BACK, FRONT_AND_BACK.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glCullFace.xhtml
|
|
|
|
func CullFace(mode Enum) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnCullFace,
|
|
|
|
a0: mode.c(),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
2014-09-18 02:07:50 +04:00
|
|
|
// DeleteBuffer deletes the given buffer object.
|
2014-08-25 16:17:08 +04:00
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glDeleteBuffers.xhtml
|
2014-09-18 02:07:50 +04:00
|
|
|
func DeleteBuffer(v Buffer) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnDeleteBuffer,
|
|
|
|
a0: C.uintptr_t(v.Value),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
2014-09-18 02:07:50 +04:00
|
|
|
// DeleteFramebuffer deletes the given framebuffer object.
|
2014-08-25 16:17:08 +04:00
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glDeleteFramebuffers.xhtml
|
2014-09-18 02:07:50 +04:00
|
|
|
func DeleteFramebuffer(v Framebuffer) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnDeleteFramebuffer,
|
|
|
|
a0: C.uintptr_t(v.Value),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// DeleteProgram deletes the given program object.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glDeleteProgram.xhtml
|
|
|
|
func DeleteProgram(p Program) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnDeleteProgram,
|
|
|
|
a0: p.c(),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
2014-09-18 02:07:50 +04:00
|
|
|
// DeleteRenderbuffer deletes the given render buffer object.
|
2014-08-25 16:17:08 +04:00
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glDeleteRenderbuffers.xhtml
|
2014-09-18 02:07:50 +04:00
|
|
|
func DeleteRenderbuffer(v Renderbuffer) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnDeleteRenderbuffer,
|
|
|
|
a0: v.c(),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// DeleteShader deletes shader s.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glDeleteShader.xhtml
|
|
|
|
func DeleteShader(s Shader) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnDeleteShader,
|
|
|
|
a0: s.c(),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
2014-09-18 02:07:50 +04:00
|
|
|
// DeleteTexture deletes the given texture object.
|
2014-08-25 16:17:08 +04:00
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glDeleteTextures.xhtml
|
2014-09-18 02:07:50 +04:00
|
|
|
func DeleteTexture(v Texture) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnDeleteTexture,
|
|
|
|
a0: v.c(),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// DepthFunc sets the function used for depth buffer comparisons.
|
|
|
|
//
|
|
|
|
// Valid fn values:
|
|
|
|
// NEVER
|
|
|
|
// LESS
|
|
|
|
// EQUAL
|
|
|
|
// LEQUAL
|
|
|
|
// GREATER
|
|
|
|
// NOTEQUAL
|
|
|
|
// GEQUAL
|
|
|
|
// ALWAYS
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glDepthFunc.xhtml
|
|
|
|
func DepthFunc(fn Enum) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnDepthFunc,
|
|
|
|
a0: fn.c(),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// DepthMask sets the depth buffer enabled for writing.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glDepthMask.xhtml
|
|
|
|
func DepthMask(flag bool) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnDepthMask,
|
|
|
|
a0: glBoolean(flag),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// DepthRangef sets the mapping from normalized device coordinates to
|
|
|
|
// window coordinates.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glDepthRangef.xhtml
|
|
|
|
func DepthRangef(n, f float32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnDepthRangef,
|
|
|
|
a0: C.uintptr_t(math.Float32bits(n)),
|
|
|
|
a1: C.uintptr_t(math.Float32bits(f)),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// DetachShader detaches the shader s from the program p.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glDetachShader.xhtml
|
|
|
|
func DetachShader(p Program, s Shader) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnDetachShader,
|
|
|
|
a0: p.c(),
|
|
|
|
a1: s.c(),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Disable disables various GL capabilities.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glDisable.xhtml
|
|
|
|
func Disable(cap Enum) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnDisable,
|
|
|
|
a0: cap.c(),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
2015-05-28 13:08:52 +03:00
|
|
|
// DisableVertexAttribArray disables a vertex attribute array.
|
|
|
|
//
|
2014-08-25 16:17:08 +04:00
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glDisableVertexAttribArray.xhtml
|
gl: Improve API signatures to match spec, improve docs.
Reorder DrawElements arguments to match OpenGL spec order:
DrawElements(mode, ty, offset, count) -> (mode, count, ty, offset)
GetActiveAttrib, GetActiveUniform are defined by spec to accept
corresponding integer _index_, not location type. Change their
signature to do that:
GetActiveAttrib(p Program, a Attrib) -> (p Program, index uint32)
GetActiveUniform(p Program, u Uniform) -> (p Program, index uint32)
Clarify and make documentation, parameter names more clear for Uniform
(uniform location), Attrib (attribute location) types,
EnableVertexAttribArray, DisableVertexAttribArray, GetAttribLocation,
GetUniformLocation funcs.
Resolves golang/go#10218 again.
Change-Id: I5b822235d9485701186a43dae0b9fd898cc6a3d8
Reviewed-on: https://go-review.googlesource.com/8166
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-03-29 08:53:36 +03:00
|
|
|
func DisableVertexAttribArray(a Attrib) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnDisableVertexAttribArray,
|
|
|
|
a0: a.c(),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// DrawArrays renders geometric primitives from the bound data.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glDrawArrays.xhtml
|
|
|
|
func DrawArrays(mode Enum, first, count int) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnDrawArrays,
|
|
|
|
a0: mode.c(),
|
|
|
|
a1: C.uintptr_t(first),
|
|
|
|
a2: C.uintptr_t(count),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// DrawElements renders primitives from a bound buffer.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glDrawElements.xhtml
|
gl: Improve API signatures to match spec, improve docs.
Reorder DrawElements arguments to match OpenGL spec order:
DrawElements(mode, ty, offset, count) -> (mode, count, ty, offset)
GetActiveAttrib, GetActiveUniform are defined by spec to accept
corresponding integer _index_, not location type. Change their
signature to do that:
GetActiveAttrib(p Program, a Attrib) -> (p Program, index uint32)
GetActiveUniform(p Program, u Uniform) -> (p Program, index uint32)
Clarify and make documentation, parameter names more clear for Uniform
(uniform location), Attrib (attribute location) types,
EnableVertexAttribArray, DisableVertexAttribArray, GetAttribLocation,
GetUniformLocation funcs.
Resolves golang/go#10218 again.
Change-Id: I5b822235d9485701186a43dae0b9fd898cc6a3d8
Reviewed-on: https://go-review.googlesource.com/8166
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-03-29 08:53:36 +03:00
|
|
|
func DrawElements(mode Enum, count int, ty Enum, offset int) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnDrawElements,
|
|
|
|
a0: mode.c(),
|
|
|
|
a1: C.uintptr_t(count),
|
|
|
|
a2: ty.c(),
|
|
|
|
a3: C.uintptr_t(offset),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// TODO(crawshaw): consider DrawElements8 / DrawElements16 / DrawElements32
|
|
|
|
|
|
|
|
// Enable enables various GL capabilities.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glEnable.xhtml
|
|
|
|
func Enable(cap Enum) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnEnable,
|
|
|
|
a0: cap.c(),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// EnableVertexAttribArray enables a vertex attribute array.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glEnableVertexAttribArray.xhtml
|
gl: Improve API signatures to match spec, improve docs.
Reorder DrawElements arguments to match OpenGL spec order:
DrawElements(mode, ty, offset, count) -> (mode, count, ty, offset)
GetActiveAttrib, GetActiveUniform are defined by spec to accept
corresponding integer _index_, not location type. Change their
signature to do that:
GetActiveAttrib(p Program, a Attrib) -> (p Program, index uint32)
GetActiveUniform(p Program, u Uniform) -> (p Program, index uint32)
Clarify and make documentation, parameter names more clear for Uniform
(uniform location), Attrib (attribute location) types,
EnableVertexAttribArray, DisableVertexAttribArray, GetAttribLocation,
GetUniformLocation funcs.
Resolves golang/go#10218 again.
Change-Id: I5b822235d9485701186a43dae0b9fd898cc6a3d8
Reviewed-on: https://go-review.googlesource.com/8166
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-03-29 08:53:36 +03:00
|
|
|
func EnableVertexAttribArray(a Attrib) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnEnableVertexAttribArray,
|
|
|
|
a0: a.c(),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Finish blocks until the effects of all previously called GL
|
|
|
|
// commands are complete.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glFinish.xhtml
|
|
|
|
func Finish() {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnFinish,
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Flush empties all buffers. It does not block.
|
|
|
|
//
|
|
|
|
// An OpenGL implementation may buffer network communication,
|
|
|
|
// the command stream, or data inside the graphics accelerator.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glFlush.xhtml
|
|
|
|
func Flush() {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnFlush,
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// FramebufferRenderbuffer attaches rb to the current frame buffer.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glFramebufferRenderbuffer.xhtml
|
|
|
|
func FramebufferRenderbuffer(target, attachment, rbTarget Enum, rb Renderbuffer) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnFramebufferRenderbuffer,
|
|
|
|
a0: target.c(),
|
|
|
|
a1: attachment.c(),
|
|
|
|
a2: rbTarget.c(),
|
|
|
|
a3: rb.c(),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// FramebufferTexture2D attaches the t to the current frame buffer.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glFramebufferTexture2D.xhtml
|
|
|
|
func FramebufferTexture2D(target, attachment, texTarget Enum, t Texture, level int) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnFramebufferTexture2D,
|
|
|
|
a0: target.c(),
|
|
|
|
a1: attachment.c(),
|
|
|
|
a2: texTarget.c(),
|
|
|
|
a3: t.c(),
|
|
|
|
a4: C.uintptr_t(level),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// FrontFace defines which polygons are front-facing.
|
|
|
|
//
|
|
|
|
// Valid modes: CW, CCW.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glFrontFace.xhtml
|
|
|
|
func FrontFace(mode Enum) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnFrontFace,
|
|
|
|
a0: mode.c(),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// GenerateMipmap generates mipmaps for the current texture.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glGenerateMipmap.xhtml
|
|
|
|
func GenerateMipmap(target Enum) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnGenerateMipmap,
|
|
|
|
a0: target.c(),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
gl: Improve API signatures to match spec, improve docs.
Reorder DrawElements arguments to match OpenGL spec order:
DrawElements(mode, ty, offset, count) -> (mode, count, ty, offset)
GetActiveAttrib, GetActiveUniform are defined by spec to accept
corresponding integer _index_, not location type. Change their
signature to do that:
GetActiveAttrib(p Program, a Attrib) -> (p Program, index uint32)
GetActiveUniform(p Program, u Uniform) -> (p Program, index uint32)
Clarify and make documentation, parameter names more clear for Uniform
(uniform location), Attrib (attribute location) types,
EnableVertexAttribArray, DisableVertexAttribArray, GetAttribLocation,
GetUniformLocation funcs.
Resolves golang/go#10218 again.
Change-Id: I5b822235d9485701186a43dae0b9fd898cc6a3d8
Reviewed-on: https://go-review.googlesource.com/8166
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-03-29 08:53:36 +03:00
|
|
|
// GetActiveAttrib returns details about an active attribute variable.
|
|
|
|
// A value of 0 for index selects the first active attribute variable.
|
|
|
|
// Permissible values for index range from 0 to the number of active
|
|
|
|
// attribute variables minus 1.
|
2014-08-25 16:17:08 +04:00
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetActiveAttrib.xhtml
|
gl: Improve API signatures to match spec, improve docs.
Reorder DrawElements arguments to match OpenGL spec order:
DrawElements(mode, ty, offset, count) -> (mode, count, ty, offset)
GetActiveAttrib, GetActiveUniform are defined by spec to accept
corresponding integer _index_, not location type. Change their
signature to do that:
GetActiveAttrib(p Program, a Attrib) -> (p Program, index uint32)
GetActiveUniform(p Program, u Uniform) -> (p Program, index uint32)
Clarify and make documentation, parameter names more clear for Uniform
(uniform location), Attrib (attribute location) types,
EnableVertexAttribArray, DisableVertexAttribArray, GetAttribLocation,
GetUniformLocation funcs.
Resolves golang/go#10218 again.
Change-Id: I5b822235d9485701186a43dae0b9fd898cc6a3d8
Reviewed-on: https://go-review.googlesource.com/8166
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-03-29 08:53:36 +03:00
|
|
|
func GetActiveAttrib(p Program, index uint32) (name string, size int, ty Enum) {
|
2014-08-25 16:17:08 +04:00
|
|
|
bufSize := GetProgrami(p, ACTIVE_ATTRIBUTE_MAX_LENGTH)
|
|
|
|
buf := C.malloc(C.size_t(bufSize))
|
|
|
|
defer C.free(buf)
|
|
|
|
var cSize C.GLint
|
|
|
|
var cType C.GLenum
|
2015-05-28 13:08:52 +03:00
|
|
|
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnGetActiveAttrib,
|
|
|
|
a0: p.c(),
|
|
|
|
a1: C.uintptr_t(index),
|
|
|
|
a2: C.uintptr_t(bufSize),
|
|
|
|
a3: 0,
|
|
|
|
a4: C.uintptr_t(uintptr(unsafe.Pointer(&cSize))),
|
|
|
|
a5: C.uintptr_t(uintptr(unsafe.Pointer(&cType))),
|
|
|
|
a6: C.uintptr_t(uintptr(unsafe.Pointer(buf))),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2015-05-28 13:08:52 +03:00
|
|
|
|
2014-08-25 16:17:08 +04:00
|
|
|
return C.GoString((*C.char)(buf)), int(cSize), Enum(cType)
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetActiveUniform returns details about an active uniform variable.
|
gl: Improve API signatures to match spec, improve docs.
Reorder DrawElements arguments to match OpenGL spec order:
DrawElements(mode, ty, offset, count) -> (mode, count, ty, offset)
GetActiveAttrib, GetActiveUniform are defined by spec to accept
corresponding integer _index_, not location type. Change their
signature to do that:
GetActiveAttrib(p Program, a Attrib) -> (p Program, index uint32)
GetActiveUniform(p Program, u Uniform) -> (p Program, index uint32)
Clarify and make documentation, parameter names more clear for Uniform
(uniform location), Attrib (attribute location) types,
EnableVertexAttribArray, DisableVertexAttribArray, GetAttribLocation,
GetUniformLocation funcs.
Resolves golang/go#10218 again.
Change-Id: I5b822235d9485701186a43dae0b9fd898cc6a3d8
Reviewed-on: https://go-review.googlesource.com/8166
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-03-29 08:53:36 +03:00
|
|
|
// A value of 0 for index selects the first active uniform variable.
|
|
|
|
// Permissible values for index range from 0 to the number of active
|
|
|
|
// uniform variables minus 1.
|
2014-08-25 16:17:08 +04:00
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetActiveUniform.xhtml
|
gl: Improve API signatures to match spec, improve docs.
Reorder DrawElements arguments to match OpenGL spec order:
DrawElements(mode, ty, offset, count) -> (mode, count, ty, offset)
GetActiveAttrib, GetActiveUniform are defined by spec to accept
corresponding integer _index_, not location type. Change their
signature to do that:
GetActiveAttrib(p Program, a Attrib) -> (p Program, index uint32)
GetActiveUniform(p Program, u Uniform) -> (p Program, index uint32)
Clarify and make documentation, parameter names more clear for Uniform
(uniform location), Attrib (attribute location) types,
EnableVertexAttribArray, DisableVertexAttribArray, GetAttribLocation,
GetUniformLocation funcs.
Resolves golang/go#10218 again.
Change-Id: I5b822235d9485701186a43dae0b9fd898cc6a3d8
Reviewed-on: https://go-review.googlesource.com/8166
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-03-29 08:53:36 +03:00
|
|
|
func GetActiveUniform(p Program, index uint32) (name string, size int, ty Enum) {
|
2014-08-25 16:17:08 +04:00
|
|
|
bufSize := GetProgrami(p, ACTIVE_UNIFORM_MAX_LENGTH)
|
|
|
|
buf := C.malloc(C.size_t(bufSize))
|
|
|
|
defer C.free(buf)
|
|
|
|
var cSize C.GLint
|
|
|
|
var cType C.GLenum
|
|
|
|
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnGetActiveUniform,
|
|
|
|
a0: p.c(),
|
|
|
|
a1: C.uintptr_t(index),
|
|
|
|
a2: C.uintptr_t(bufSize),
|
|
|
|
a3: 0,
|
|
|
|
a4: C.uintptr_t(uintptr(unsafe.Pointer(&cSize))),
|
|
|
|
a5: C.uintptr_t(uintptr(unsafe.Pointer(&cType))),
|
|
|
|
a6: C.uintptr_t(uintptr(unsafe.Pointer(buf))),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2015-05-28 13:08:52 +03:00
|
|
|
|
2014-08-25 16:17:08 +04:00
|
|
|
return C.GoString((*C.char)(buf)), int(cSize), Enum(cType)
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetAttachedShaders returns the shader objects attached to program p.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetAttachedShaders.xhtml
|
|
|
|
func GetAttachedShaders(p Program) []Shader {
|
|
|
|
shadersLen := GetProgrami(p, ATTACHED_SHADERS)
|
2015-08-04 02:25:58 +03:00
|
|
|
if shadersLen == 0 {
|
|
|
|
return nil
|
|
|
|
}
|
2014-08-25 16:17:08 +04:00
|
|
|
var n C.GLsizei
|
2014-09-18 02:07:50 +04:00
|
|
|
buf := make([]C.GLuint, shadersLen)
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
|
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnGetAttachedShaders,
|
|
|
|
a0: p.c(),
|
|
|
|
a1: C.uintptr_t(shadersLen),
|
|
|
|
a2: C.uintptr_t(uintptr(unsafe.Pointer(&n))),
|
|
|
|
a3: C.uintptr_t(uintptr(unsafe.Pointer(&buf[0]))),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2015-05-28 13:08:52 +03:00
|
|
|
|
2014-09-18 02:07:50 +04:00
|
|
|
buf = buf[:int(n)]
|
|
|
|
shaders := make([]Shader, len(buf))
|
|
|
|
for i, s := range buf {
|
|
|
|
shaders[i] = Shader{Value: uint32(s)}
|
|
|
|
}
|
|
|
|
return shaders
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
gl: Improve API signatures to match spec, improve docs.
Reorder DrawElements arguments to match OpenGL spec order:
DrawElements(mode, ty, offset, count) -> (mode, count, ty, offset)
GetActiveAttrib, GetActiveUniform are defined by spec to accept
corresponding integer _index_, not location type. Change their
signature to do that:
GetActiveAttrib(p Program, a Attrib) -> (p Program, index uint32)
GetActiveUniform(p Program, u Uniform) -> (p Program, index uint32)
Clarify and make documentation, parameter names more clear for Uniform
(uniform location), Attrib (attribute location) types,
EnableVertexAttribArray, DisableVertexAttribArray, GetAttribLocation,
GetUniformLocation funcs.
Resolves golang/go#10218 again.
Change-Id: I5b822235d9485701186a43dae0b9fd898cc6a3d8
Reviewed-on: https://go-review.googlesource.com/8166
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-03-29 08:53:36 +03:00
|
|
|
// GetAttribLocation returns the location of an attribute variable.
|
2014-08-25 16:17:08 +04:00
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetAttribLocation.xhtml
|
|
|
|
func GetAttribLocation(p Program, name string) Attrib {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
return Attrib{Value: uint(enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnGetAttribLocation,
|
|
|
|
a0: p.c(),
|
|
|
|
a1: C.uintptr_t(uintptr(unsafe.Pointer(C.CString(name)))),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
}))}
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetBooleanv returns the boolean values of parameter pname.
|
|
|
|
//
|
|
|
|
// Many boolean parameters can be queried more easily using IsEnabled.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glGet.xhtml
|
|
|
|
func GetBooleanv(dst []bool, pname Enum) {
|
|
|
|
buf := make([]C.GLboolean, len(dst))
|
2015-05-28 13:08:52 +03:00
|
|
|
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnGetBooleanv,
|
|
|
|
a0: pname.c(),
|
|
|
|
a1: C.uintptr_t(uintptr(unsafe.Pointer(&buf[0]))),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2015-05-28 13:08:52 +03:00
|
|
|
|
2014-08-25 16:17:08 +04:00
|
|
|
for i, v := range buf {
|
|
|
|
dst[i] = v != 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetFloatv returns the float values of parameter pname.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glGet.xhtml
|
|
|
|
func GetFloatv(dst []float32, pname Enum) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnGetFloatv,
|
|
|
|
a0: pname.c(),
|
|
|
|
a1: C.uintptr_t(uintptr(unsafe.Pointer(&dst[0]))),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetIntegerv returns the int values of parameter pname.
|
|
|
|
//
|
|
|
|
// Single values may be queried more easily using GetInteger.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glGet.xhtml
|
2015-05-28 13:08:52 +03:00
|
|
|
func GetIntegerv(dst []int32, pname Enum) {
|
|
|
|
buf := make([]C.GLint, len(dst))
|
|
|
|
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnGetIntegerv,
|
|
|
|
a0: pname.c(),
|
|
|
|
a1: C.uintptr_t(uintptr(unsafe.Pointer(&buf[0]))),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2015-05-28 13:08:52 +03:00
|
|
|
|
2014-08-25 16:17:08 +04:00
|
|
|
for i, v := range buf {
|
2015-05-28 13:08:52 +03:00
|
|
|
dst[i] = int32(v)
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetInteger returns the int value of parameter pname.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glGet.xhtml
|
|
|
|
func GetInteger(pname Enum) int {
|
2015-05-28 13:08:52 +03:00
|
|
|
var v [1]int32
|
|
|
|
GetIntegerv(v[:], pname)
|
|
|
|
return int(v[0])
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetBufferParameteri returns a parameter for the active buffer.
|
|
|
|
//
|
2015-05-28 13:08:52 +03:00
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetBufferParameter.xhtml
|
|
|
|
func GetBufferParameteri(target, value Enum) int {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
return int(enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnGetBufferParameteri,
|
|
|
|
a0: target.c(),
|
|
|
|
a1: value.c(),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
}))
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetError returns the next error.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetError.xhtml
|
|
|
|
func GetError() Enum {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
return Enum(enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnGetError,
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
}))
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetFramebufferAttachmentParameteri returns attachment parameters
|
|
|
|
// for the active framebuffer object.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetFramebufferAttachmentParameteriv.xhtml
|
|
|
|
func GetFramebufferAttachmentParameteri(target, attachment, pname Enum) int {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
return int(enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnGetFramebufferAttachmentParameteriv,
|
|
|
|
a0: target.c(),
|
|
|
|
a1: attachment.c(),
|
|
|
|
a2: pname.c(),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
}))
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetProgrami returns a parameter value for a program.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetProgramiv.xhtml
|
|
|
|
func GetProgrami(p Program, pname Enum) int {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
return int(enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnGetProgramiv,
|
|
|
|
a0: p.c(),
|
|
|
|
a1: pname.c(),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
}))
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetProgramInfoLog returns the information log for a program.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetProgramInfoLog.xhtml
|
|
|
|
func GetProgramInfoLog(p Program) string {
|
|
|
|
infoLen := GetProgrami(p, INFO_LOG_LENGTH)
|
|
|
|
buf := C.malloc(C.size_t(infoLen))
|
2015-05-28 13:08:52 +03:00
|
|
|
defer C.free(buf)
|
|
|
|
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnGetProgramInfoLog,
|
|
|
|
a0: p.c(),
|
|
|
|
a1: C.uintptr_t(infoLen),
|
|
|
|
a2: 0,
|
|
|
|
a3: C.uintptr_t(uintptr(buf)),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
|
|
|
|
2014-08-25 16:17:08 +04:00
|
|
|
return C.GoString((*C.char)(buf))
|
|
|
|
}
|
|
|
|
|
2015-02-06 01:55:38 +03:00
|
|
|
// GetRenderbufferParameteri returns a parameter value for a render buffer.
|
2014-08-25 16:17:08 +04:00
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetRenderbufferParameteriv.xhtml
|
|
|
|
func GetRenderbufferParameteri(target, pname Enum) int {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
return int(enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnGetRenderbufferParameteriv,
|
|
|
|
a0: target.c(),
|
|
|
|
a1: pname.c(),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
}))
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
2015-05-28 13:08:52 +03:00
|
|
|
// GetShaderi returns a parameter value for a shader.
|
2014-08-25 16:17:08 +04:00
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetShaderiv.xhtml
|
|
|
|
func GetShaderi(s Shader, pname Enum) int {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
return int(enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnGetShaderiv,
|
|
|
|
a0: s.c(),
|
|
|
|
a1: pname.c(),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
}))
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetShaderInfoLog returns the information log for a shader.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetShaderInfoLog.xhtml
|
|
|
|
func GetShaderInfoLog(s Shader) string {
|
|
|
|
infoLen := GetShaderi(s, INFO_LOG_LENGTH)
|
|
|
|
buf := C.malloc(C.size_t(infoLen))
|
|
|
|
defer C.free(buf)
|
2015-05-28 13:08:52 +03:00
|
|
|
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnGetShaderInfoLog,
|
|
|
|
a0: s.c(),
|
|
|
|
a1: C.uintptr_t(infoLen),
|
|
|
|
a2: 0,
|
|
|
|
a3: C.uintptr_t(uintptr(buf)),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
|
|
|
|
2014-08-25 16:17:08 +04:00
|
|
|
return C.GoString((*C.char)(buf))
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetShaderPrecisionFormat returns range and precision limits for
|
|
|
|
// shader types.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetShaderPrecisionFormat.xhtml
|
|
|
|
func GetShaderPrecisionFormat(shadertype, precisiontype Enum) (rangeLow, rangeHigh, precision int) {
|
|
|
|
var cRange [2]C.GLint
|
|
|
|
var cPrecision C.GLint
|
|
|
|
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnGetShaderPrecisionFormat,
|
|
|
|
a0: shadertype.c(),
|
|
|
|
a1: precisiontype.c(),
|
|
|
|
a2: C.uintptr_t(uintptr(unsafe.Pointer(&cRange[0]))),
|
|
|
|
a3: C.uintptr_t(uintptr(unsafe.Pointer(&cPrecision))),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
|
|
|
|
2014-08-25 16:17:08 +04:00
|
|
|
return int(cRange[0]), int(cRange[1]), int(cPrecision)
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetShaderSource returns source code of shader s.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetShaderSource.xhtml
|
|
|
|
func GetShaderSource(s Shader) string {
|
|
|
|
sourceLen := GetShaderi(s, SHADER_SOURCE_LENGTH)
|
|
|
|
if sourceLen == 0 {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
buf := C.malloc(C.size_t(sourceLen))
|
|
|
|
defer C.free(buf)
|
2015-05-28 13:08:52 +03:00
|
|
|
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnGetShaderSource,
|
|
|
|
a0: s.c(),
|
|
|
|
a1: C.uintptr_t(sourceLen),
|
|
|
|
a2: 0,
|
|
|
|
a3: C.uintptr_t(uintptr(buf)),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
|
|
|
|
2014-08-25 16:17:08 +04:00
|
|
|
return C.GoString((*C.char)(buf))
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetString reports current GL state.
|
|
|
|
//
|
|
|
|
// Valid name values:
|
|
|
|
// EXTENSIONS
|
|
|
|
// RENDERER
|
|
|
|
// SHADING_LANGUAGE_VERSION
|
|
|
|
// VENDOR
|
|
|
|
// VERSION
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetString.xhtml
|
2015-03-24 06:18:30 +03:00
|
|
|
func GetString(pname Enum) string {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
ret := enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnGetString,
|
|
|
|
a0: pname.c(),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
|
|
|
return C.GoString((*C.char)((unsafe.Pointer(uintptr(ret)))))
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetTexParameterfv returns the float values of a texture parameter.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetTexParameter.xhtml
|
|
|
|
func GetTexParameterfv(dst []float32, target, pname Enum) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnGetTexParameterfv,
|
|
|
|
a0: target.c(),
|
|
|
|
a1: pname.c(),
|
|
|
|
a2: C.uintptr_t(uintptr(unsafe.Pointer(&dst[0]))),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetTexParameteriv returns the int values of a texture parameter.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetTexParameter.xhtml
|
|
|
|
func GetTexParameteriv(dst []int32, target, pname Enum) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnGetTexParameteriv,
|
|
|
|
a0: target.c(),
|
|
|
|
a1: pname.c(),
|
|
|
|
a2: C.uintptr_t(uintptr(unsafe.Pointer(&dst[0]))),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetUniformfv returns the float values of a uniform variable.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetUniform.xhtml
|
|
|
|
func GetUniformfv(dst []float32, src Uniform, p Program) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnGetUniformfv,
|
|
|
|
a0: p.c(),
|
|
|
|
a1: src.c(),
|
|
|
|
a2: C.uintptr_t(uintptr(unsafe.Pointer(&dst[0]))),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetUniformiv returns the float values of a uniform variable.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetUniform.xhtml
|
|
|
|
func GetUniformiv(dst []int32, src Uniform, p Program) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnGetUniformiv,
|
|
|
|
a0: p.c(),
|
|
|
|
a1: src.c(),
|
|
|
|
a2: C.uintptr_t(uintptr(unsafe.Pointer(&dst[0]))),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
gl: Improve API signatures to match spec, improve docs.
Reorder DrawElements arguments to match OpenGL spec order:
DrawElements(mode, ty, offset, count) -> (mode, count, ty, offset)
GetActiveAttrib, GetActiveUniform are defined by spec to accept
corresponding integer _index_, not location type. Change their
signature to do that:
GetActiveAttrib(p Program, a Attrib) -> (p Program, index uint32)
GetActiveUniform(p Program, u Uniform) -> (p Program, index uint32)
Clarify and make documentation, parameter names more clear for Uniform
(uniform location), Attrib (attribute location) types,
EnableVertexAttribArray, DisableVertexAttribArray, GetAttribLocation,
GetUniformLocation funcs.
Resolves golang/go#10218 again.
Change-Id: I5b822235d9485701186a43dae0b9fd898cc6a3d8
Reviewed-on: https://go-review.googlesource.com/8166
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-03-29 08:53:36 +03:00
|
|
|
// GetUniformLocation returns the location of a uniform variable.
|
2014-08-25 16:17:08 +04:00
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetUniformLocation.xhtml
|
|
|
|
func GetUniformLocation(p Program, name string) Uniform {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
return Uniform{Value: int32(enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnGetUniformLocation,
|
|
|
|
a0: p.c(),
|
|
|
|
a1: C.uintptr_t(uintptr(unsafe.Pointer(C.CString(name)))),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
}))}
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetVertexAttribf reads the float value of a vertex attribute.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetVertexAttrib.xhtml
|
|
|
|
func GetVertexAttribf(src Attrib, pname Enum) float32 {
|
2015-05-28 13:08:52 +03:00
|
|
|
var params [1]float32
|
|
|
|
GetVertexAttribfv(params[:], src, pname)
|
|
|
|
return params[0]
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetVertexAttribfv reads float values of a vertex attribute.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetVertexAttrib.xhtml
|
|
|
|
func GetVertexAttribfv(dst []float32, src Attrib, pname Enum) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnGetVertexAttribfv,
|
|
|
|
a0: src.c(),
|
|
|
|
a1: pname.c(),
|
|
|
|
a2: C.uintptr_t(uintptr(unsafe.Pointer(&dst[0]))),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetVertexAttribi reads the int value of a vertex attribute.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetVertexAttrib.xhtml
|
|
|
|
func GetVertexAttribi(src Attrib, pname Enum) int32 {
|
2015-05-28 13:08:52 +03:00
|
|
|
var params [1]int32
|
|
|
|
GetVertexAttribiv(params[:], src, pname)
|
|
|
|
return params[0]
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetVertexAttribiv reads int values of a vertex attribute.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetVertexAttrib.xhtml
|
|
|
|
func GetVertexAttribiv(dst []int32, src Attrib, pname Enum) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnGetVertexAttribiv,
|
|
|
|
a0: src.c(),
|
|
|
|
a1: pname.c(),
|
|
|
|
a2: C.uintptr_t(uintptr(unsafe.Pointer(&dst[0]))),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// TODO(crawshaw): glGetVertexAttribPointerv
|
|
|
|
|
|
|
|
// Hint sets implementation-specific modes.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glHint.xhtml
|
|
|
|
func Hint(target, mode Enum) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnHint,
|
|
|
|
a0: target.c(),
|
|
|
|
a1: mode.c(),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// IsBuffer reports if b is a valid buffer.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glIsBuffer.xhtml
|
|
|
|
func IsBuffer(b Buffer) bool {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
return 0 != enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnIsBuffer,
|
|
|
|
a0: b.c(),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// IsEnabled reports if cap is an enabled capability.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glIsEnabled.xhtml
|
|
|
|
func IsEnabled(cap Enum) bool {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
return 0 != enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnIsEnabled,
|
|
|
|
a0: cap.c(),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// IsFramebuffer reports if fb is a valid frame buffer.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glIsFramebuffer.xhtml
|
|
|
|
func IsFramebuffer(fb Framebuffer) bool {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
return 0 != enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnIsFramebuffer,
|
|
|
|
a0: fb.c(),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// IsProgram reports if p is a valid program object.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glIsProgram.xhtml
|
|
|
|
func IsProgram(p Program) bool {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
return 0 != enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnIsProgram,
|
|
|
|
a0: p.c(),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// IsRenderbuffer reports if rb is a valid render buffer.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glIsRenderbuffer.xhtml
|
|
|
|
func IsRenderbuffer(rb Renderbuffer) bool {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
return 0 != enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnIsRenderbuffer,
|
|
|
|
a0: rb.c(),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// IsShader reports if s is valid shader.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glIsShader.xhtml
|
|
|
|
func IsShader(s Shader) bool {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
return 0 != enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnIsShader,
|
|
|
|
a0: s.c(),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// IsTexture reports if t is a valid texture.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glIsTexture.xhtml
|
|
|
|
func IsTexture(t Texture) bool {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
return 0 != enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnIsTexture,
|
|
|
|
a0: t.c(),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// LineWidth specifies the width of lines.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glLineWidth.xhtml
|
|
|
|
func LineWidth(width float32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnLineWidth,
|
|
|
|
a0: C.uintptr_t(math.Float32bits(width)),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// LinkProgram links the specified program.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glLinkProgram.xhtml
|
|
|
|
func LinkProgram(p Program) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnLinkProgram,
|
|
|
|
a0: p.c(),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// PixelStorei sets pixel storage parameters.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glPixelStorei.xhtml
|
|
|
|
func PixelStorei(pname Enum, param int32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnPixelStorei,
|
|
|
|
a0: pname.c(),
|
|
|
|
a1: C.uintptr_t(param),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// PolygonOffset sets the scaling factors for depth offsets.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glPolygonOffset.xhtml
|
|
|
|
func PolygonOffset(factor, units float32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnPolygonOffset,
|
|
|
|
a0: C.uintptr_t(math.Float32bits(factor)),
|
|
|
|
a1: C.uintptr_t(math.Float32bits(units)),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// ReadPixels returns pixel data from a buffer.
|
|
|
|
//
|
|
|
|
// In GLES 3, the source buffer is controlled with ReadBuffer.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glReadPixels.xhtml
|
|
|
|
func ReadPixels(dst []byte, x, y, width, height int, format, ty Enum) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnReadPixels,
|
|
|
|
// TODO(crawshaw): support PIXEL_PACK_BUFFER in GLES3, uses offset.
|
|
|
|
a0: C.uintptr_t(x),
|
|
|
|
a1: C.uintptr_t(y),
|
|
|
|
a2: C.uintptr_t(width),
|
|
|
|
a3: C.uintptr_t(height),
|
|
|
|
a4: format.c(),
|
|
|
|
a5: ty.c(),
|
|
|
|
a6: C.uintptr_t(uintptr(unsafe.Pointer(&dst[0]))),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// ReleaseShaderCompiler frees resources allocated by the shader compiler.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glReleaseShaderCompiler.xhtml
|
|
|
|
func ReleaseShaderCompiler() {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnReleaseShaderCompiler,
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// RenderbufferStorage establishes the data storage, format, and
|
|
|
|
// dimensions of a renderbuffer object's image.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glRenderbufferStorage.xhtml
|
|
|
|
func RenderbufferStorage(target, internalFormat Enum, width, height int) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnRenderbufferStorage,
|
|
|
|
a0: target.c(),
|
|
|
|
a1: internalFormat.c(),
|
|
|
|
a2: C.uintptr_t(width),
|
|
|
|
a3: C.uintptr_t(height),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// SampleCoverage sets multisample coverage parameters.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glSampleCoverage.xhtml
|
|
|
|
func SampleCoverage(value float32, invert bool) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnSampleCoverage,
|
|
|
|
a0: C.uintptr_t(math.Float32bits(value)),
|
|
|
|
a1: glBoolean(invert),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Scissor defines the scissor box rectangle, in window coordinates.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glScissor.xhtml
|
|
|
|
func Scissor(x, y, width, height int32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnScissor,
|
|
|
|
a0: C.uintptr_t(x),
|
|
|
|
a1: C.uintptr_t(y),
|
|
|
|
a2: C.uintptr_t(width),
|
|
|
|
a3: C.uintptr_t(height),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// TODO(crawshaw): ShaderBinary
|
|
|
|
|
|
|
|
// ShaderSource sets the source code of s to the given source code.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glShaderSource.xhtml
|
|
|
|
func ShaderSource(s Shader, src string) {
|
2015-05-28 13:08:52 +03:00
|
|
|
// We are passing a char**. Make sure both the string and its
|
|
|
|
// containing 1-element array are off the stack. Both are freed
|
|
|
|
// in work.c.
|
|
|
|
cstr := C.CString(src)
|
|
|
|
cstrp := (**C.char)(C.malloc(C.size_t(unsafe.Sizeof(cstr))))
|
|
|
|
*cstrp = cstr
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
|
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnShaderSource,
|
|
|
|
a0: s.c(),
|
|
|
|
a1: 1,
|
|
|
|
a2: C.uintptr_t(uintptr(unsafe.Pointer(cstrp))),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
2015-05-28 13:08:52 +03:00
|
|
|
// StencilFunc sets the front and back stencil test reference value.
|
2014-08-25 16:17:08 +04:00
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glStencilFunc.xhtml
|
|
|
|
func StencilFunc(fn Enum, ref int, mask uint32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnStencilFunc,
|
|
|
|
a0: fn.c(),
|
|
|
|
a1: C.uintptr_t(ref),
|
|
|
|
a2: C.uintptr_t(mask),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
2015-05-28 13:08:52 +03:00
|
|
|
// StencilFunc sets the front or back stencil test reference value.
|
2014-08-25 16:17:08 +04:00
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glStencilFuncSeparate.xhtml
|
|
|
|
func StencilFuncSeparate(face, fn Enum, ref int, mask uint32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnStencilFuncSeparate,
|
|
|
|
a0: face.c(),
|
|
|
|
a1: fn.c(),
|
|
|
|
a2: C.uintptr_t(ref),
|
|
|
|
a3: C.uintptr_t(mask),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// StencilMask controls the writing of bits in the stencil planes.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glStencilMask.xhtml
|
|
|
|
func StencilMask(mask uint32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnStencilMask,
|
|
|
|
a0: C.uintptr_t(mask),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// StencilMaskSeparate controls the writing of bits in the stencil planes.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glStencilMaskSeparate.xhtml
|
|
|
|
func StencilMaskSeparate(face Enum, mask uint32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnStencilMaskSeparate,
|
|
|
|
a0: face.c(),
|
|
|
|
a1: C.uintptr_t(mask),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// StencilOp sets front and back stencil test actions.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glStencilOp.xhtml
|
|
|
|
func StencilOp(fail, zfail, zpass Enum) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnStencilOp,
|
|
|
|
a0: fail.c(),
|
|
|
|
a1: zfail.c(),
|
|
|
|
a2: zpass.c(),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// StencilOpSeparate sets front or back stencil tests.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glStencilOpSeparate.xhtml
|
|
|
|
func StencilOpSeparate(face, sfail, dpfail, dppass Enum) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnStencilOpSeparate,
|
|
|
|
a0: face.c(),
|
|
|
|
a1: sfail.c(),
|
|
|
|
a2: dpfail.c(),
|
|
|
|
a3: dppass.c(),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// TexImage2D writes a 2D texture image.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glTexImage2D.xhtml
|
|
|
|
func TexImage2D(target Enum, level int, width, height int, format Enum, ty Enum, data []byte) {
|
2015-05-28 13:08:52 +03:00
|
|
|
// It is common to pass TexImage2D a nil data, indicating that a
|
|
|
|
// bound GL buffer is being used as the source. In that case, it
|
|
|
|
// is not necessary to block.
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
blocking, a7 := false, C.uintptr_t(0)
|
2014-08-25 16:17:08 +04:00
|
|
|
if len(data) > 0 {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
blocking, a7 = true, C.uintptr_t(uintptr(unsafe.Pointer(&data[0])))
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
|
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnTexImage2D,
|
|
|
|
// TODO(crawshaw): GLES3 offset for PIXEL_UNPACK_BUFFER and PIXEL_PACK_BUFFER.
|
|
|
|
a0: target.c(),
|
|
|
|
a1: C.uintptr_t(level),
|
|
|
|
a2: C.uintptr_t(format),
|
|
|
|
a3: C.uintptr_t(width),
|
|
|
|
a4: C.uintptr_t(height),
|
|
|
|
a5: format.c(),
|
|
|
|
a6: ty.c(),
|
|
|
|
a7: a7,
|
|
|
|
},
|
|
|
|
blocking: blocking,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// TexSubImage2D writes a subregion of a 2D texture image.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glTexSubImage2D.xhtml
|
|
|
|
func TexSubImage2D(target Enum, level int, x, y, width, height int, format, ty Enum, data []byte) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnTexSubImage2D,
|
|
|
|
// TODO(crawshaw): GLES3 offset for PIXEL_UNPACK_BUFFER and PIXEL_PACK_BUFFER.
|
|
|
|
a0: target.c(),
|
|
|
|
a1: C.uintptr_t(level),
|
|
|
|
a2: C.uintptr_t(x),
|
|
|
|
a3: C.uintptr_t(y),
|
|
|
|
a4: C.uintptr_t(width),
|
|
|
|
a5: C.uintptr_t(height),
|
|
|
|
a6: format.c(),
|
|
|
|
a7: ty.c(),
|
|
|
|
a8: C.uintptr_t(uintptr(unsafe.Pointer(&data[0]))),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// TexParameterf sets a float texture parameter.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glTexParameter.xhtml
|
|
|
|
func TexParameterf(target, pname Enum, param float32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnTexParameterf,
|
|
|
|
a0: target.c(),
|
|
|
|
a1: pname.c(),
|
|
|
|
a2: C.uintptr_t(math.Float32bits(param)),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// TexParameterfv sets a float texture parameter array.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glTexParameter.xhtml
|
|
|
|
func TexParameterfv(target, pname Enum, params []float32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnTexParameterfv,
|
|
|
|
a0: target.c(),
|
|
|
|
a1: pname.c(),
|
|
|
|
a2: C.uintptr_t(uintptr(unsafe.Pointer(¶ms[0]))),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// TexParameteri sets an integer texture parameter.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glTexParameter.xhtml
|
|
|
|
func TexParameteri(target, pname Enum, param int) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnTexParameteri,
|
|
|
|
a0: target.c(),
|
|
|
|
a1: pname.c(),
|
|
|
|
a2: C.uintptr_t(param),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// TexParameteriv sets an integer texture parameter array.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glTexParameter.xhtml
|
|
|
|
func TexParameteriv(target, pname Enum, params []int32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnTexParameteriv,
|
|
|
|
a0: target.c(),
|
|
|
|
a1: pname.c(),
|
|
|
|
a2: C.uintptr_t(uintptr(unsafe.Pointer(¶ms[0]))),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Uniform1f writes a float uniform variable.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
|
|
|
|
func Uniform1f(dst Uniform, v float32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnUniform1f,
|
|
|
|
a0: dst.c(),
|
|
|
|
a1: C.uintptr_t(math.Float32bits(v)),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Uniform1fv writes a [len(src)]float uniform array.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
|
|
|
|
func Uniform1fv(dst Uniform, src []float32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnUniform1fv,
|
|
|
|
a0: dst.c(),
|
|
|
|
a1: C.uintptr_t(len(src)),
|
|
|
|
a2: C.uintptr_t(uintptr(unsafe.Pointer(&src[0]))),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Uniform1i writes an int uniform variable.
|
|
|
|
//
|
|
|
|
// Uniform1i and Uniform1iv are the only two functions that may be used
|
|
|
|
// to load uniform variables defined as sampler types. Loading samplers
|
|
|
|
// with any other function will result in a INVALID_OPERATION error.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
|
|
|
|
func Uniform1i(dst Uniform, v int) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnUniform1i,
|
|
|
|
a0: dst.c(),
|
|
|
|
a1: C.uintptr_t(v),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Uniform1iv writes a int uniform array of len(src) elements.
|
|
|
|
//
|
|
|
|
// Uniform1i and Uniform1iv are the only two functions that may be used
|
|
|
|
// to load uniform variables defined as sampler types. Loading samplers
|
|
|
|
// with any other function will result in a INVALID_OPERATION error.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
|
|
|
|
func Uniform1iv(dst Uniform, src []int32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnUniform1iv,
|
|
|
|
a0: dst.c(),
|
|
|
|
a1: C.uintptr_t(len(src)),
|
|
|
|
a2: C.uintptr_t(uintptr(unsafe.Pointer(&src[0]))),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Uniform2f writes a vec2 uniform variable.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
|
|
|
|
func Uniform2f(dst Uniform, v0, v1 float32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnUniform2f,
|
|
|
|
a0: dst.c(),
|
|
|
|
a1: C.uintptr_t(math.Float32bits(v0)),
|
|
|
|
a2: C.uintptr_t(math.Float32bits(v1)),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Uniform2fv writes a vec2 uniform array of len(src)/2 elements.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
|
|
|
|
func Uniform2fv(dst Uniform, src []float32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnUniform2fv,
|
|
|
|
a0: dst.c(),
|
|
|
|
a1: C.uintptr_t(len(src) / 2),
|
|
|
|
a2: C.uintptr_t(uintptr(unsafe.Pointer(&src[0]))),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Uniform2i writes an ivec2 uniform variable.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
|
2014-12-15 19:24:15 +03:00
|
|
|
func Uniform2i(dst Uniform, v0, v1 int) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnUniform2i,
|
|
|
|
a0: dst.c(),
|
|
|
|
a1: C.uintptr_t(v0),
|
|
|
|
a2: C.uintptr_t(v1),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Uniform2iv writes an ivec2 uniform array of len(src)/2 elements.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
|
|
|
|
func Uniform2iv(dst Uniform, src []int32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnUniform2iv,
|
|
|
|
a0: dst.c(),
|
|
|
|
a1: C.uintptr_t(len(src) / 2),
|
|
|
|
a2: C.uintptr_t(uintptr(unsafe.Pointer(&src[0]))),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Uniform3f writes a vec3 uniform variable.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
|
|
|
|
func Uniform3f(dst Uniform, v0, v1, v2 float32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnUniform3f,
|
|
|
|
a0: dst.c(),
|
|
|
|
a1: C.uintptr_t(math.Float32bits(v0)),
|
|
|
|
a2: C.uintptr_t(math.Float32bits(v1)),
|
|
|
|
a3: C.uintptr_t(math.Float32bits(v2)),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Uniform3fv writes a vec3 uniform array of len(src)/3 elements.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
|
|
|
|
func Uniform3fv(dst Uniform, src []float32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnUniform3fv,
|
|
|
|
a0: dst.c(),
|
|
|
|
a1: C.uintptr_t(len(src) / 3),
|
|
|
|
a2: C.uintptr_t(uintptr(unsafe.Pointer(&src[0]))),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Uniform3i writes an ivec3 uniform variable.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
|
2014-12-15 19:24:15 +03:00
|
|
|
func Uniform3i(dst Uniform, v0, v1, v2 int32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnUniform3i,
|
|
|
|
a0: dst.c(),
|
|
|
|
a1: C.uintptr_t(v0),
|
|
|
|
a2: C.uintptr_t(v1),
|
|
|
|
a3: C.uintptr_t(v2),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Uniform3iv writes an ivec3 uniform array of len(src)/3 elements.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
|
|
|
|
func Uniform3iv(dst Uniform, src []int32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnUniform3iv,
|
|
|
|
a0: dst.c(),
|
|
|
|
a1: C.uintptr_t(len(src) / 3),
|
|
|
|
a2: C.uintptr_t(uintptr(unsafe.Pointer(&src[0]))),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Uniform4f writes a vec4 uniform variable.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
|
|
|
|
func Uniform4f(dst Uniform, v0, v1, v2, v3 float32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnUniform4f,
|
|
|
|
a0: dst.c(),
|
|
|
|
a1: C.uintptr_t(math.Float32bits(v0)),
|
|
|
|
a2: C.uintptr_t(math.Float32bits(v1)),
|
|
|
|
a3: C.uintptr_t(math.Float32bits(v2)),
|
|
|
|
a4: C.uintptr_t(math.Float32bits(v3)),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Uniform4fv writes a vec4 uniform array of len(src)/4 elements.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
|
|
|
|
func Uniform4fv(dst Uniform, src []float32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnUniform4fv,
|
|
|
|
a0: dst.c(),
|
|
|
|
a1: C.uintptr_t(len(src) / 4),
|
|
|
|
a2: C.uintptr_t(uintptr(unsafe.Pointer(&src[0]))),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Uniform4i writes an ivec4 uniform variable.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
|
|
|
|
func Uniform4i(dst Uniform, v0, v1, v2, v3 int32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnUniform4i,
|
|
|
|
a0: dst.c(),
|
|
|
|
a1: C.uintptr_t(v0),
|
|
|
|
a2: C.uintptr_t(v1),
|
|
|
|
a3: C.uintptr_t(v2),
|
|
|
|
a4: C.uintptr_t(v3),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Uniform4i writes an ivec4 uniform array of len(src)/4 elements.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
|
|
|
|
func Uniform4iv(dst Uniform, src []int32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnUniform4iv,
|
|
|
|
a0: dst.c(),
|
|
|
|
a1: C.uintptr_t(len(src) / 4),
|
|
|
|
a2: C.uintptr_t(uintptr(unsafe.Pointer(&src[0]))),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
2014-10-09 07:00:00 +04:00
|
|
|
// UniformMatrix2fv writes 2x2 matrices. Each matrix uses four
|
|
|
|
// float32 values, so the number of matrices written is len(src)/4.
|
|
|
|
//
|
|
|
|
// Each matrix must be supplied in column major order.
|
2014-08-25 16:17:08 +04:00
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
|
|
|
|
func UniformMatrix2fv(dst Uniform, src []float32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnUniformMatrix2fv,
|
|
|
|
// OpenGL ES 2 does not support transpose.
|
|
|
|
a0: dst.c(),
|
|
|
|
a1: C.uintptr_t(len(src) / 4),
|
|
|
|
a2: C.uintptr_t(uintptr(unsafe.Pointer(&src[0]))),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
2014-10-09 07:00:00 +04:00
|
|
|
// UniformMatrix3fv writes 3x3 matrices. Each matrix uses nine
|
|
|
|
// float32 values, so the number of matrices written is len(src)/9.
|
|
|
|
//
|
|
|
|
// Each matrix must be supplied in column major order.
|
2014-08-25 16:17:08 +04:00
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
|
|
|
|
func UniformMatrix3fv(dst Uniform, src []float32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnUniformMatrix3fv,
|
|
|
|
a0: dst.c(),
|
|
|
|
a1: C.uintptr_t(len(src) / 9),
|
|
|
|
a2: C.uintptr_t(uintptr(unsafe.Pointer(&src[0]))),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
2014-10-09 07:00:00 +04:00
|
|
|
// UniformMatrix4fv writes 4x4 matrices. Each matrix uses 16
|
|
|
|
// float32 values, so the number of matrices written is len(src)/16.
|
|
|
|
//
|
|
|
|
// Each matrix must be supplied in column major order.
|
2014-08-25 16:17:08 +04:00
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
|
|
|
|
func UniformMatrix4fv(dst Uniform, src []float32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnUniformMatrix4fv,
|
|
|
|
a0: dst.c(),
|
|
|
|
a1: C.uintptr_t(len(src) / 16),
|
|
|
|
a2: C.uintptr_t(uintptr(unsafe.Pointer(&src[0]))),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// UseProgram sets the active program.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glUseProgram.xhtml
|
|
|
|
func UseProgram(p Program) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnUseProgram,
|
|
|
|
a0: p.c(),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// ValidateProgram checks to see whether the executables contained in
|
|
|
|
// program can execute given the current OpenGL state.
|
|
|
|
//
|
|
|
|
// Typically only used for debugging.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glValidateProgram.xhtml
|
|
|
|
func ValidateProgram(p Program) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnValidateProgram,
|
|
|
|
a0: p.c(),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// VertexAttrib1f writes a float vertex attribute.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glVertexAttrib.xhtml
|
|
|
|
func VertexAttrib1f(dst Attrib, x float32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnVertexAttrib1f,
|
|
|
|
a0: dst.c(),
|
|
|
|
a1: C.uintptr_t(math.Float32bits(x)),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// VertexAttrib1fv writes a float vertex attribute.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glVertexAttrib.xhtml
|
|
|
|
func VertexAttrib1fv(dst Attrib, src []float32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnVertexAttrib1fv,
|
|
|
|
a0: dst.c(),
|
|
|
|
a1: C.uintptr_t(uintptr(unsafe.Pointer(&src[0]))),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// VertexAttrib2f writes a vec2 vertex attribute.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glVertexAttrib.xhtml
|
|
|
|
func VertexAttrib2f(dst Attrib, x, y float32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnVertexAttrib2f,
|
|
|
|
a0: dst.c(),
|
|
|
|
a1: C.uintptr_t(math.Float32bits(x)),
|
|
|
|
a2: C.uintptr_t(math.Float32bits(y)),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// VertexAttrib2fv writes a vec2 vertex attribute.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glVertexAttrib.xhtml
|
|
|
|
func VertexAttrib2fv(dst Attrib, src []float32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnVertexAttrib2fv,
|
|
|
|
a0: dst.c(),
|
|
|
|
a1: C.uintptr_t(uintptr(unsafe.Pointer(&src[0]))),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// VertexAttrib3f writes a vec3 vertex attribute.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glVertexAttrib.xhtml
|
|
|
|
func VertexAttrib3f(dst Attrib, x, y, z float32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnVertexAttrib3f,
|
|
|
|
a0: dst.c(),
|
|
|
|
a1: C.uintptr_t(math.Float32bits(x)),
|
|
|
|
a2: C.uintptr_t(math.Float32bits(y)),
|
|
|
|
a3: C.uintptr_t(math.Float32bits(z)),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// VertexAttrib3fv writes a vec3 vertex attribute.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glVertexAttrib.xhtml
|
|
|
|
func VertexAttrib3fv(dst Attrib, src []float32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnVertexAttrib3fv,
|
|
|
|
a0: dst.c(),
|
|
|
|
a1: C.uintptr_t(uintptr(unsafe.Pointer(&src[0]))),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// VertexAttrib4f writes a vec4 vertex attribute.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glVertexAttrib.xhtml
|
|
|
|
func VertexAttrib4f(dst Attrib, x, y, z, w float32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnVertexAttrib4f,
|
|
|
|
a0: dst.c(),
|
|
|
|
a1: C.uintptr_t(math.Float32bits(x)),
|
|
|
|
a2: C.uintptr_t(math.Float32bits(y)),
|
|
|
|
a3: C.uintptr_t(math.Float32bits(z)),
|
|
|
|
a4: C.uintptr_t(math.Float32bits(w)),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// VertexAttrib4fv writes a vec4 vertex attribute.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glVertexAttrib.xhtml
|
|
|
|
func VertexAttrib4fv(dst Attrib, src []float32) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnVertexAttrib4fv,
|
|
|
|
a0: dst.c(),
|
|
|
|
a1: C.uintptr_t(uintptr(unsafe.Pointer(&src[0]))),
|
|
|
|
},
|
|
|
|
blocking: true,
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
2015-02-06 01:55:38 +03:00
|
|
|
// VertexAttribPointer uses a bound buffer to define vertex attribute data.
|
2014-08-25 16:17:08 +04:00
|
|
|
//
|
|
|
|
// Direct use of VertexAttribPointer to load data into OpenGL is not
|
|
|
|
// supported via the Go bindings. Instead, use BindBuffer with an
|
|
|
|
// ARRAY_BUFFER and then fill it using BufferData.
|
|
|
|
//
|
|
|
|
// The size argument specifies the number of components per attribute,
|
|
|
|
// between 1-4. The stride argument specifies the byte offset between
|
|
|
|
// consecutive vertex attributes.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glVertexAttribPointer.xhtml
|
|
|
|
func VertexAttribPointer(dst Attrib, size int, ty Enum, normalized bool, stride, offset int) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnVertexAttribPointer,
|
|
|
|
a0: dst.c(),
|
|
|
|
a1: C.uintptr_t(size),
|
|
|
|
a2: ty.c(),
|
|
|
|
a3: glBoolean(normalized),
|
|
|
|
a4: C.uintptr_t(stride),
|
|
|
|
a5: C.uintptr_t(offset),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Viewport sets the viewport, an affine transformation that
|
|
|
|
// normalizes device coordinates to window coordinates.
|
|
|
|
//
|
|
|
|
// http://www.khronos.org/opengles/sdk/docs/man3/html/glViewport.xhtml
|
|
|
|
func Viewport(x, y, width, height int) {
|
app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.
Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.
As side-effects:
- In package app/debug, DrawFPS now takes an explicit Config.
- In package app, some callbacks now take an explicit Config.
- In package exp/sprite, Render now takes an explicit Config.
- In package event, there are new events (Config, Draw, Lifecycle),
and an event filter mechanism to replace multiple app Callbacks.
- In package geom, the deprecated Width, Height and PixelsPerPt global
variables were removed in favor of an event.Config that is
explicitly passed around (and does not require mutex-locking).
Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
- In package gl, the Do, Start and Stop functions are removed, as well
as the need to call Start in its own goroutine. There is no longer a
separate GL thread. Instead, package app explicitly performs any GL
work (gl.DoWork) when some is available (gl.WorkAvailable).
- In package gl/glutil, Image.Draw now takes an explicit Config.
Callbacks are no longer executed on 'the UI thread'.
Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.
Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 09:41:48 +03:00
|
|
|
enqueue(call{
|
|
|
|
args: C.struct_fnargs{
|
|
|
|
fn: C.glfnViewport,
|
|
|
|
a0: C.uintptr_t(x),
|
|
|
|
a1: C.uintptr_t(y),
|
|
|
|
a2: C.uintptr_t(width),
|
|
|
|
a3: C.uintptr_t(height),
|
|
|
|
},
|
|
|
|
})
|
2014-08-25 16:17:08 +04:00
|
|
|
}
|