Skip to content

Commit

Permalink
Use Go ints for EGLint.
Browse files Browse the repository at this point in the history
  • Loading branch information
xlab committed Jan 6, 2017
1 parent da429bc commit d60f843
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions egl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ TRANSLATOR:
- {target: ^eglCreatePbufferSurface$, tips: [0,0,arr]}
- {target: ^eglCreatePixmapSurface$, tips: [0,0,0,arr]}
- {target: ^eglCreatePbufferFromClientBuffer$, tips: [0,0,0,0,arr]}
- {target: ^eglCreateContext$, tips: [0,0,0,arr]}
- {target: ^egl, tips: [ref,ref,ref,ref]} # covers the rest
TypeTips:
type:
- {target: EGLint$, self: plain}
function:
- {target: ^eglGetError$, self: plain}
Rules:
global:
- {action: accept, from: "^EGL"}
Expand Down
8 changes: 4 additions & 4 deletions example-egl/display.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func NewDisplayHandle(activity *android.NativeActivity,
// Here specify the attributes of the desired configuration.
// Below, we select an egl.Config with at least 8 bits per color
// component compatible with on-screen windows
attribs := []egl.Int{
attribs := []int32{
egl.SurfaceType, egl.WindowBit,
egl.BlueSize, 8,
egl.GreenSize, 8,
Expand All @@ -55,7 +55,7 @@ func NewDisplayHandle(activity *android.NativeActivity,
// sample, we have a very simplified selection process, where we pick
// the first egl.Config that matches our criteria
configs := make([]egl.Config, 1)
var numConfigs egl.Int
var numConfigs int32
if egl.ChooseConfig(display, attribs, configs, 1, &numConfigs) == egl.False {
egl.Terminate(display)
err := fmt.Errorf("eglChooseConfig failed: %v", egl.Error())
Expand All @@ -66,7 +66,7 @@ func NewDisplayHandle(activity *android.NativeActivity,
// guaranteed to be accepted by android.NativeWindowSetBuffersGeometry().
// As soon as we picked a egl.Config, we can safely reconfigure the
// NativeWindow buffers to match, using egl.NativeVisualId.
var format egl.Int
var format int32
if egl.GetConfigAttrib(display, configs[0], egl.NativeVisualId, &format) == egl.False {
egl.Terminate(display)
err := fmt.Errorf("eglGetConfigAttrib failed: %v", egl.Error())
Expand Down Expand Up @@ -94,7 +94,7 @@ func NewDisplayHandle(activity *android.NativeActivity,
}

func (d *DisplayHandle) UpdateDimensions() {
var width, height egl.Int
var width, height int32
egl.QuerySurface(d.display, d.surface, egl.Width, &width)
egl.QuerySurface(d.display, d.surface, egl.Height, &height)
d.Width = int(width)
Expand Down

0 comments on commit d60f843

Please sign in to comment.