Skip to content

Commit 6fd4271

Browse files
authored
Merge pull request #13 from Jacalz/modernise
Modernise the package to our current standards
2 parents 1fdaa28 + b43f844 commit 6fd4271

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+95
-40266
lines changed

.github/workflows/analysis.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Static Analysis
2+
on: [push, pull_request]
3+
permissions:
4+
contents: read
5+
6+
jobs:
7+
static_analysis:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v4
12+
with:
13+
persist-credentials: false
14+
- uses: actions/setup-go@v5
15+
with:
16+
go-version: 'stable'
17+
18+
- name: Install analysis tools
19+
run: |
20+
go install golang.org/x/tools/cmd/goimports@latest
21+
go install github.com/fzipp/gocyclo/cmd/gocyclo@latest
22+
go install honnef.co/go/tools/cmd/staticcheck@latest
23+
go install github.com/mattn/goveralls@latest
24+
go install lucor.dev/lian@latest
25+
26+
- name: Get dependencies
27+
run: sudo apt-get update && sudo apt-get install libgles2-mesa-dev
28+
29+
- name: Vet
30+
run: go vet ./...
31+
32+
- name: Goimports
33+
run: test -z "$(goimports -e -d . | tee /dev/stderr)"
34+
35+
- name: Gocyclo
36+
run: gocyclo -over 30 .
37+
38+
- name: Staticcheck
39+
run: staticcheck ./...
40+
41+
- name: Check license of dependencies
42+
run: lian -d --allowed="Apache-2.0, BSD-2-Clause, BSD-3-Clause, MIT, ISC" --excluded=github.com/jsummers/[email protected]
43+

.github/workflows/tests.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Tests
2+
on: [push, pull_request]
3+
permissions:
4+
contents: read
5+
6+
jobs:
7+
static_analysis:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v4
12+
with:
13+
persist-credentials: false
14+
- uses: actions/setup-go@v5
15+
with:
16+
go-version: 'stable'
17+
18+
- name: Get dependencies
19+
run: sudo apt-get update && sudo apt-get install libgles2-mesa-dev xvfb
20+
21+
- name: Test
22+
run: xvfb-run go test -race ./...

.travis.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# gl [![Build Status](https://travis-ci.org/goxjs/gl.svg?branch=master)](https://travis-ci.org/goxjs/gl) [![GoDoc](https://godoc.org/github.com/fyne-io/gl-js?status.svg)](https://godoc.org/github.com/fyne-io/gl-js)
1+
[![Tests](https://github.com/fyne-io/gl-js/actions/workflows/tests.yml/badge.svg)](https://github.com/fyne-io/gl-js/actions/workflows/tests.yml)
2+
[![Static Analysis](https://github.com/fyne-io/gl-js/actions/workflows/analysis.yml/badge.svg)](https://github.com/fyne-io/gl-js/actions/workflows/analysis.yml)
3+
[![GoDoc](https://godoc.org/github.com/fyne-io/gl-js?status.svg)](https://godoc.org/github.com/fyne-io/gl-js)
4+
5+
# GL
26

37
Package gl is a Go cross-platform binding for OpenGL, with an OpenGL ES 2-like API.
48

@@ -14,22 +18,19 @@ This is a fork of golang.org/x/mobile/gl package with [CL 8793](https://go-revie
1418
merged in and Windows support added. This package is fully functional, but may eventually become superceded by
1519
the new x/mobile/gl plan. It will exist and be fully supported until it can be safely replaced by a better package.
1620

17-
Installation
18-
------------
21+
## Installation
1922

2023
```bash
21-
go get -u github.com/fyne-io/gl-js/...
22-
GOARCH=js go get -u -d github.com/fyne-io/gl-js/...
24+
go get github.com/fyne-io/gl-js
2325
```
2426

25-
Usage
26-
-----
27+
## Usage
2728

2829
This OpenGL binding has a ContextWatcher, which implements [glfw.ContextWatcher](https://godoc.org/github.com/goxjs/glfw#ContextWatcher)
2930
interface. Recommended usage is with github.com/fyne-io/glfw-js package, which accepts a ContextWatcher in its Init, and takes on the responsibility
3031
of notifying it when context is made current or detached.
3132

32-
```Go
33+
```go
3334
if err := glfw.Init(gl.ContextWatcher); err != nil {
3435
// Handle error.
3536
}

doc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ This is a fork of golang.org/x/mobile/gl package with [CL 8793](https://go-revie
1717
merged in and Windows support added. This package is fully functional, but may eventually become superceded by
1818
the new x/mobile/gl plan. It will exist and be fully supported until it can be safely replaced by a better package.
1919
20-
Usage
20+
## Usage
2121
2222
This OpenGL binding has a ContextWatcher, which implements [glfw.ContextWatcher](https://godoc.org/github.com/goxjs/glfw#ContextWatcher)
2323
interface. Recommended usage is with github.com/goxjs/glfw package, which accepts a ContextWatcher in its Init, and takes on the responsibility

gl_opengl.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// +build !js
1+
//go:build !js
22

33
package gl
44

@@ -330,6 +330,7 @@ func DeleteTexture(v Texture) {
330330
// DepthFunc sets the function used for depth buffer comparisons.
331331
//
332332
// Valid fn values:
333+
//
333334
// NEVER
334335
// LESS
335336
// EQUAL
@@ -391,7 +392,7 @@ func DrawArrays(mode Enum, first, count int) {
391392
//
392393
// http://www.khronos.org/opengles/sdk/docs/man3/html/glDrawElements.xhtml
393394
func DrawElements(mode Enum, count int, ty Enum, offset int) {
394-
gl.DrawElements(uint32(mode), int32(count), uint32(ty), gl.PtrOffset(offset))
395+
gl.DrawElementsWithOffset(uint32(mode), int32(count), uint32(ty), uintptr(offset))
395396
}
396397

397398
// Enable enables various GL capabilities.
@@ -670,6 +671,7 @@ func GetShaderSource(s Shader) string {
670671
// GetString reports current GL state.
671672
//
672673
// Valid name values:
674+
//
673675
// EXTENSIONS
674676
// RENDERER
675677
// SHADING_LANGUAGE_VERSION
@@ -1215,7 +1217,7 @@ func VertexAttrib4fv(dst Attrib, src []float32) {
12151217
//
12161218
// http://www.khronos.org/opengles/sdk/docs/man3/html/glVertexAttribPointer.xhtml
12171219
func VertexAttribPointer(dst Attrib, size int, ty Enum, normalized bool, stride, offset int) {
1218-
gl.VertexAttribPointer(uint32(dst.Value), int32(size), uint32(ty), normalized, int32(stride), gl.PtrOffset(offset))
1220+
gl.VertexAttribPointerWithOffset(uint32(dst.Value), int32(size), uint32(ty), normalized, int32(stride), uintptr(offset))
12191221
}
12201222

12211223
// Viewport sets the viewport, an affine transformation that

gl_opengles.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// +build ios android
5+
//go:build ios || android
66

77
package gl
88

0 commit comments

Comments
 (0)