mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
all: update OpenGL version from 2.1 to 3.2
'texelFetch' requires OpenGLSL 1.30, which requires OpenGL 3.0+. macOS might not support OpenGL 3.0 and 3.1, so adopt 3.2. Updates #1431
This commit is contained in:
parent
40c38eb9ee
commit
00e45affe9
18
.github/workflows/steam.yml
vendored
18
.github/workflows/steam.yml
vendored
@ -15,27 +15,17 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Docker build (386)
|
|
||||||
run: |
|
|
||||||
curl --location --remote-name https://repo.steampowered.com/steamrt-images-scout/snapshots/latest-public-beta/com.valvesoftware.SteamRuntime.Sdk-i386-scout-sysroot.Dockerfile
|
|
||||||
curl --location --remote-name https://repo.steampowered.com/steamrt-images-scout/snapshots/latest-public-beta/com.valvesoftware.SteamRuntime.Sdk-i386-scout-sysroot.tar.gz
|
|
||||||
docker build -f com.valvesoftware.SteamRuntime.Sdk-i386-scout-sysroot.Dockerfile -t steamrt_scout_i386:latest .
|
|
||||||
|
|
||||||
- name: Docker build (amd64)
|
- name: Docker build (amd64)
|
||||||
run: |
|
run: |
|
||||||
curl --location --remote-name https://repo.steampowered.com/steamrt-images-scout/snapshots/latest-public-beta/com.valvesoftware.SteamRuntime.Sdk-amd64,i386-scout-sysroot.Dockerfile
|
curl --location --remote-name https://repo.steampowered.com/steamrt-images-sniper/snapshots/latest-container-runtime-public-beta/com.valvesoftware.SteamRuntime.Sdk-amd64,i386-sniper-sysroot.Dockerfile
|
||||||
curl --location --remote-name https://repo.steampowered.com/steamrt-images-scout/snapshots/latest-public-beta/com.valvesoftware.SteamRuntime.Sdk-amd64,i386-scout-sysroot.tar.gz
|
curl --location --remote-name https://repo.steampowered.com/steamrt-images-sniper/snapshots/latest-container-runtime-public-beta/com.valvesoftware.SteamRuntime.Sdk-amd64,i386-sniper-sysroot.tar.gz
|
||||||
docker build -f com.valvesoftware.SteamRuntime.Sdk-amd64,i386-scout-sysroot.Dockerfile -t steamrt_scout_amd64:latest .
|
docker build -f com.valvesoftware.SteamRuntime.Sdk-amd64,i386-sniper-sysroot.Dockerfile -t steamrt_sniper_amd64:latest .
|
||||||
|
|
||||||
- name: Go version
|
- name: Go version
|
||||||
id: go
|
id: go
|
||||||
run: |
|
run: |
|
||||||
echo "::set-output name=version::$(curl --location https://go.dev/VERSION?m=text)"
|
echo "::set-output name=version::$(curl --location https://go.dev/VERSION?m=text)"
|
||||||
|
|
||||||
- name: Docker run (386)
|
|
||||||
run: |
|
|
||||||
docker run --rm --workdir=/work --volume $(pwd):/work --env GO_FILENAME=${{ steps.go.outputs.version }}.linux-386.tar.gz steamrt_scout_i386:latest /bin/sh .github/workflows/steam.sh
|
|
||||||
|
|
||||||
- name: Docker run (amd64)
|
- name: Docker run (amd64)
|
||||||
run: |
|
run: |
|
||||||
docker run --rm --workdir=/work --volume $(pwd):/work --env GO_FILENAME=${{ steps.go.outputs.version }}.linux-amd64.tar.gz steamrt_scout_amd64:latest /bin/sh .github/workflows/steam.sh
|
docker run --rm --workdir=/work --volume $(pwd):/work --env GO_FILENAME=${{ steps.go.outputs.version }}.linux-amd64.tar.gz steamrt_sniper_amd64:latest /bin/sh .github/workflows/steam.sh
|
||||||
|
@ -59,20 +59,22 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
AutoIconify = Hint(0x00020006)
|
AutoIconify = Hint(0x00020006)
|
||||||
ClientAPI = Hint(0x00022001)
|
ClientAPI = Hint(0x00022001)
|
||||||
ContextCreationAPI = Hint(0x0002200B)
|
ContextCreationAPI = Hint(0x0002200B)
|
||||||
ContextVersionMajor = Hint(0x00022002)
|
ContextVersionMajor = Hint(0x00022002)
|
||||||
ContextVersionMinor = Hint(0x00022003)
|
ContextVersionMinor = Hint(0x00022003)
|
||||||
Decorated = Hint(0x00020005)
|
Decorated = Hint(0x00020005)
|
||||||
Floating = Hint(0x00020007)
|
Floating = Hint(0x00020007)
|
||||||
Focused = Hint(0x00020001)
|
Focused = Hint(0x00020001)
|
||||||
FocusOnShow = Hint(0x0002000C)
|
FocusOnShow = Hint(0x0002000C)
|
||||||
Iconified = Hint(0x00020002)
|
Iconified = Hint(0x00020002)
|
||||||
Maximized = Hint(0x00020008)
|
Maximized = Hint(0x00020008)
|
||||||
Resizable = Hint(0x00020003)
|
OpenGLForwardCompatible = Hint(0x00022006)
|
||||||
TransparentFramebuffer = Hint(0x0002000A)
|
OpenGLProfile = Hint(0x00022008)
|
||||||
Visible = Hint(0x00020004)
|
Resizable = Hint(0x00020003)
|
||||||
|
TransparentFramebuffer = Hint(0x0002000A)
|
||||||
|
Visible = Hint(0x00020004)
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -82,13 +84,14 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
CursorDisabled = 0x00034003
|
CursorDisabled = 0x00034003
|
||||||
CursorHidden = 0x00034002
|
CursorHidden = 0x00034002
|
||||||
CursorNormal = 0x00034001
|
CursorNormal = 0x00034001
|
||||||
EGLContextAPI = 0x00036002
|
EGLContextAPI = 0x00036002
|
||||||
NoAPI = 0
|
NoAPI = 0
|
||||||
OpenGLAPI = 0x00030001
|
OpenGLAPI = 0x00030001
|
||||||
OpenGLESAPI = 0x00030002
|
OpenGLCoreProfile = 0x00032001
|
||||||
|
OpenGLESAPI = 0x00030002
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -81,6 +81,14 @@ func (d *DebugContext) BindTexture(arg0 uint32, arg1 uint32) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d *DebugContext) BindVertexArray(arg0 uint32) {
|
||||||
|
d.Context.BindVertexArray(arg0)
|
||||||
|
fmt.Fprintln(os.Stderr, "BindVertexArray")
|
||||||
|
if e := d.Context.GetError(); e != NO_ERROR {
|
||||||
|
panic(fmt.Sprintf("gl: GetError() returned %d at BindVertexArray", e))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (d *DebugContext) BlendEquationSeparate(arg0 uint32, arg1 uint32) {
|
func (d *DebugContext) BlendEquationSeparate(arg0 uint32, arg1 uint32) {
|
||||||
d.Context.BlendEquationSeparate(arg0, arg1)
|
d.Context.BlendEquationSeparate(arg0, arg1)
|
||||||
fmt.Fprintln(os.Stderr, "BlendEquationSeparate")
|
fmt.Fprintln(os.Stderr, "BlendEquationSeparate")
|
||||||
@ -200,6 +208,15 @@ func (d *DebugContext) CreateTexture() uint32 {
|
|||||||
return out0
|
return out0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d *DebugContext) CreateVertexArray() uint32 {
|
||||||
|
out0 := d.Context.CreateVertexArray()
|
||||||
|
fmt.Fprintln(os.Stderr, "CreateVertexArray")
|
||||||
|
if e := d.Context.GetError(); e != NO_ERROR {
|
||||||
|
panic(fmt.Sprintf("gl: GetError() returned %d at CreateVertexArray", e))
|
||||||
|
}
|
||||||
|
return out0
|
||||||
|
}
|
||||||
|
|
||||||
func (d *DebugContext) DeleteBuffer(arg0 uint32) {
|
func (d *DebugContext) DeleteBuffer(arg0 uint32) {
|
||||||
d.Context.DeleteBuffer(arg0)
|
d.Context.DeleteBuffer(arg0)
|
||||||
fmt.Fprintln(os.Stderr, "DeleteBuffer")
|
fmt.Fprintln(os.Stderr, "DeleteBuffer")
|
||||||
@ -248,6 +265,14 @@ func (d *DebugContext) DeleteTexture(arg0 uint32) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d *DebugContext) DeleteVertexArray(arg0 uint32) {
|
||||||
|
d.Context.DeleteVertexArray(arg0)
|
||||||
|
fmt.Fprintln(os.Stderr, "DeleteVertexArray")
|
||||||
|
if e := d.Context.GetError(); e != NO_ERROR {
|
||||||
|
panic(fmt.Sprintf("gl: GetError() returned %d at DeleteVertexArray", e))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (d *DebugContext) Disable(arg0 uint32) {
|
func (d *DebugContext) Disable(arg0 uint32) {
|
||||||
d.Context.Disable(arg0)
|
d.Context.Disable(arg0)
|
||||||
fmt.Fprintln(os.Stderr, "Disable")
|
fmt.Fprintln(os.Stderr, "Disable")
|
||||||
|
@ -35,11 +35,11 @@ package gl
|
|||||||
// typedef void (*fn)(GLenum target, GLuint buffer);
|
// typedef void (*fn)(GLenum target, GLuint buffer);
|
||||||
// ((fn)(fnptr))(target, buffer);
|
// ((fn)(fnptr))(target, buffer);
|
||||||
// }
|
// }
|
||||||
// static void glowBindFramebufferEXT(uintptr_t fnptr, GLenum target, GLuint framebuffer) {
|
// static void glowBindFramebuffer(uintptr_t fnptr, GLenum target, GLuint framebuffer) {
|
||||||
// typedef void (*fn)(GLenum target, GLuint framebuffer);
|
// typedef void (*fn)(GLenum target, GLuint framebuffer);
|
||||||
// ((fn)(fnptr))(target, framebuffer);
|
// ((fn)(fnptr))(target, framebuffer);
|
||||||
// }
|
// }
|
||||||
// static void glowBindRenderbufferEXT(uintptr_t fnptr, GLenum target, GLuint renderbuffer) {
|
// static void glowBindRenderbuffer(uintptr_t fnptr, GLenum target, GLuint renderbuffer) {
|
||||||
// typedef void (*fn)(GLenum target, GLuint renderbuffer);
|
// typedef void (*fn)(GLenum target, GLuint renderbuffer);
|
||||||
// ((fn)(fnptr))(target, renderbuffer);
|
// ((fn)(fnptr))(target, renderbuffer);
|
||||||
// }
|
// }
|
||||||
@ -47,6 +47,10 @@ package gl
|
|||||||
// typedef void (*fn)(GLenum target, GLuint texture);
|
// typedef void (*fn)(GLenum target, GLuint texture);
|
||||||
// ((fn)(fnptr))(target, texture);
|
// ((fn)(fnptr))(target, texture);
|
||||||
// }
|
// }
|
||||||
|
// static void glowBindVertexArray(uintptr_t fnptr, GLuint array) {
|
||||||
|
// typedef void (*fn)(GLuint array);
|
||||||
|
// ((fn)(fnptr))(array);
|
||||||
|
// }
|
||||||
// static void glowBlendEquationSeparate(uintptr_t fnptr, GLenum modeRGB, GLenum modeAlpha) {
|
// static void glowBlendEquationSeparate(uintptr_t fnptr, GLenum modeRGB, GLenum modeAlpha) {
|
||||||
// typedef void (*fn)(GLenum modeRGB, GLenum modeAlpha);
|
// typedef void (*fn)(GLenum modeRGB, GLenum modeAlpha);
|
||||||
// ((fn)(fnptr))(modeRGB, modeAlpha);
|
// ((fn)(fnptr))(modeRGB, modeAlpha);
|
||||||
@ -63,7 +67,7 @@ package gl
|
|||||||
// typedef void (*fn)(GLenum target, GLintptr offset, GLsizeiptr size, const void* data);
|
// typedef void (*fn)(GLenum target, GLintptr offset, GLsizeiptr size, const void* data);
|
||||||
// ((fn)(fnptr))(target, offset, size, data);
|
// ((fn)(fnptr))(target, offset, size, data);
|
||||||
// }
|
// }
|
||||||
// static GLenum glowCheckFramebufferStatusEXT(uintptr_t fnptr, GLenum target) {
|
// static GLenum glowCheckFramebufferStatus(uintptr_t fnptr, GLenum target) {
|
||||||
// typedef GLenum (*fn)(GLenum target);
|
// typedef GLenum (*fn)(GLenum target);
|
||||||
// return ((fn)(fnptr))(target);
|
// return ((fn)(fnptr))(target);
|
||||||
// }
|
// }
|
||||||
@ -91,7 +95,7 @@ package gl
|
|||||||
// typedef void (*fn)(GLsizei n, const GLuint* buffers);
|
// typedef void (*fn)(GLsizei n, const GLuint* buffers);
|
||||||
// ((fn)(fnptr))(n, buffers);
|
// ((fn)(fnptr))(n, buffers);
|
||||||
// }
|
// }
|
||||||
// static void glowDeleteFramebuffersEXT(uintptr_t fnptr, GLsizei n, const GLuint* framebuffers) {
|
// static void glowDeleteFramebuffers(uintptr_t fnptr, GLsizei n, const GLuint* framebuffers) {
|
||||||
// typedef void (*fn)(GLsizei n, const GLuint* framebuffers);
|
// typedef void (*fn)(GLsizei n, const GLuint* framebuffers);
|
||||||
// ((fn)(fnptr))(n, framebuffers);
|
// ((fn)(fnptr))(n, framebuffers);
|
||||||
// }
|
// }
|
||||||
@ -99,7 +103,7 @@ package gl
|
|||||||
// typedef void (*fn)(GLuint program);
|
// typedef void (*fn)(GLuint program);
|
||||||
// ((fn)(fnptr))(program);
|
// ((fn)(fnptr))(program);
|
||||||
// }
|
// }
|
||||||
// static void glowDeleteRenderbuffersEXT(uintptr_t fnptr, GLsizei n, const GLuint* renderbuffers) {
|
// static void glowDeleteRenderbuffers(uintptr_t fnptr, GLsizei n, const GLuint* renderbuffers) {
|
||||||
// typedef void (*fn)(GLsizei n, const GLuint* renderbuffers);
|
// typedef void (*fn)(GLsizei n, const GLuint* renderbuffers);
|
||||||
// ((fn)(fnptr))(n, renderbuffers);
|
// ((fn)(fnptr))(n, renderbuffers);
|
||||||
// }
|
// }
|
||||||
@ -111,6 +115,10 @@ package gl
|
|||||||
// typedef void (*fn)(GLsizei n, const GLuint* textures);
|
// typedef void (*fn)(GLsizei n, const GLuint* textures);
|
||||||
// ((fn)(fnptr))(n, textures);
|
// ((fn)(fnptr))(n, textures);
|
||||||
// }
|
// }
|
||||||
|
// static void glowDeleteVertexArrays(uintptr_t fnptr, GLsizei n, const GLuint* arrays) {
|
||||||
|
// typedef void (*fn)(GLsizei n, const GLuint* arrays);
|
||||||
|
// ((fn)(fnptr))(n, arrays);
|
||||||
|
// }
|
||||||
// static void glowDisable(uintptr_t fnptr, GLenum cap) {
|
// static void glowDisable(uintptr_t fnptr, GLenum cap) {
|
||||||
// typedef void (*fn)(GLenum cap);
|
// typedef void (*fn)(GLenum cap);
|
||||||
// ((fn)(fnptr))(cap);
|
// ((fn)(fnptr))(cap);
|
||||||
@ -135,11 +143,11 @@ package gl
|
|||||||
// typedef void (*fn)();
|
// typedef void (*fn)();
|
||||||
// ((fn)(fnptr))();
|
// ((fn)(fnptr))();
|
||||||
// }
|
// }
|
||||||
// static void glowFramebufferRenderbufferEXT(uintptr_t fnptr, GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) {
|
// static void glowFramebufferRenderbuffer(uintptr_t fnptr, GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) {
|
||||||
// typedef void (*fn)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
// typedef void (*fn)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
||||||
// ((fn)(fnptr))(target, attachment, renderbuffertarget, renderbuffer);
|
// ((fn)(fnptr))(target, attachment, renderbuffertarget, renderbuffer);
|
||||||
// }
|
// }
|
||||||
// static void glowFramebufferTexture2DEXT(uintptr_t fnptr, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) {
|
// static void glowFramebufferTexture2D(uintptr_t fnptr, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) {
|
||||||
// typedef void (*fn)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
// typedef void (*fn)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||||
// ((fn)(fnptr))(target, attachment, textarget, texture, level);
|
// ((fn)(fnptr))(target, attachment, textarget, texture, level);
|
||||||
// }
|
// }
|
||||||
@ -147,11 +155,11 @@ package gl
|
|||||||
// typedef void (*fn)(GLsizei n, GLuint* buffers);
|
// typedef void (*fn)(GLsizei n, GLuint* buffers);
|
||||||
// ((fn)(fnptr))(n, buffers);
|
// ((fn)(fnptr))(n, buffers);
|
||||||
// }
|
// }
|
||||||
// static void glowGenFramebuffersEXT(uintptr_t fnptr, GLsizei n, GLuint* framebuffers) {
|
// static void glowGenFramebuffers(uintptr_t fnptr, GLsizei n, GLuint* framebuffers) {
|
||||||
// typedef void (*fn)(GLsizei n, GLuint* framebuffers);
|
// typedef void (*fn)(GLsizei n, GLuint* framebuffers);
|
||||||
// ((fn)(fnptr))(n, framebuffers);
|
// ((fn)(fnptr))(n, framebuffers);
|
||||||
// }
|
// }
|
||||||
// static void glowGenRenderbuffersEXT(uintptr_t fnptr, GLsizei n, GLuint* renderbuffers) {
|
// static void glowGenRenderbuffers(uintptr_t fnptr, GLsizei n, GLuint* renderbuffers) {
|
||||||
// typedef void (*fn)(GLsizei n, GLuint* renderbuffers);
|
// typedef void (*fn)(GLsizei n, GLuint* renderbuffers);
|
||||||
// ((fn)(fnptr))(n, renderbuffers);
|
// ((fn)(fnptr))(n, renderbuffers);
|
||||||
// }
|
// }
|
||||||
@ -159,6 +167,10 @@ package gl
|
|||||||
// typedef void (*fn)(GLsizei n, GLuint* textures);
|
// typedef void (*fn)(GLsizei n, GLuint* textures);
|
||||||
// ((fn)(fnptr))(n, textures);
|
// ((fn)(fnptr))(n, textures);
|
||||||
// }
|
// }
|
||||||
|
// static void glowGenVertexArrays(uintptr_t fnptr, GLsizei n, GLuint* arrays) {
|
||||||
|
// typedef void (*fn)(GLsizei n, GLuint* arrays);
|
||||||
|
// ((fn)(fnptr))(n, arrays);
|
||||||
|
// }
|
||||||
// static GLenum glowGetError(uintptr_t fnptr) {
|
// static GLenum glowGetError(uintptr_t fnptr) {
|
||||||
// typedef GLenum (*fn)();
|
// typedef GLenum (*fn)();
|
||||||
// return ((fn)(fnptr))();
|
// return ((fn)(fnptr))();
|
||||||
@ -187,7 +199,7 @@ package gl
|
|||||||
// typedef GLint (*fn)(GLuint program, const GLchar* name);
|
// typedef GLint (*fn)(GLuint program, const GLchar* name);
|
||||||
// return ((fn)(fnptr))(program, name);
|
// return ((fn)(fnptr))(program, name);
|
||||||
// }
|
// }
|
||||||
// static GLboolean glowIsFramebufferEXT(uintptr_t fnptr, GLuint framebuffer) {
|
// static GLboolean glowIsFramebuffer(uintptr_t fnptr, GLuint framebuffer) {
|
||||||
// typedef GLboolean (*fn)(GLuint framebuffer);
|
// typedef GLboolean (*fn)(GLuint framebuffer);
|
||||||
// return ((fn)(fnptr))(framebuffer);
|
// return ((fn)(fnptr))(framebuffer);
|
||||||
// }
|
// }
|
||||||
@ -195,7 +207,7 @@ package gl
|
|||||||
// typedef GLboolean (*fn)(GLuint program);
|
// typedef GLboolean (*fn)(GLuint program);
|
||||||
// return ((fn)(fnptr))(program);
|
// return ((fn)(fnptr))(program);
|
||||||
// }
|
// }
|
||||||
// static GLboolean glowIsRenderbufferEXT(uintptr_t fnptr, GLuint renderbuffer) {
|
// static GLboolean glowIsRenderbuffer(uintptr_t fnptr, GLuint renderbuffer) {
|
||||||
// typedef GLboolean (*fn)(GLuint renderbuffer);
|
// typedef GLboolean (*fn)(GLuint renderbuffer);
|
||||||
// return ((fn)(fnptr))(renderbuffer);
|
// return ((fn)(fnptr))(renderbuffer);
|
||||||
// }
|
// }
|
||||||
@ -215,7 +227,7 @@ package gl
|
|||||||
// typedef void (*fn)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels);
|
// typedef void (*fn)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels);
|
||||||
// ((fn)(fnptr))(x, y, width, height, format, type, pixels);
|
// ((fn)(fnptr))(x, y, width, height, format, type, pixels);
|
||||||
// }
|
// }
|
||||||
// static void glowRenderbufferStorageEXT(uintptr_t fnptr, GLenum target, GLenum internalformat, GLsizei width, GLsizei height) {
|
// static void glowRenderbufferStorage(uintptr_t fnptr, GLenum target, GLenum internalformat, GLsizei width, GLsizei height) {
|
||||||
// typedef void (*fn)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
|
// typedef void (*fn)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
|
||||||
// ((fn)(fnptr))(target, internalformat, width, height);
|
// ((fn)(fnptr))(target, internalformat, width, height);
|
||||||
// }
|
// }
|
||||||
@ -315,78 +327,81 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type defaultContext struct {
|
type defaultContext struct {
|
||||||
gpActiveTexture C.uintptr_t
|
gpActiveTexture C.uintptr_t
|
||||||
gpAttachShader C.uintptr_t
|
gpAttachShader C.uintptr_t
|
||||||
gpBindAttribLocation C.uintptr_t
|
gpBindAttribLocation C.uintptr_t
|
||||||
gpBindBuffer C.uintptr_t
|
gpBindBuffer C.uintptr_t
|
||||||
gpBindFramebufferEXT C.uintptr_t
|
gpBindFramebuffer C.uintptr_t
|
||||||
gpBindRenderbufferEXT C.uintptr_t
|
gpBindRenderbuffer C.uintptr_t
|
||||||
gpBindTexture C.uintptr_t
|
gpBindTexture C.uintptr_t
|
||||||
gpBlendEquationSeparate C.uintptr_t
|
gpBindVertexArray C.uintptr_t
|
||||||
gpBlendFuncSeparate C.uintptr_t
|
gpBlendEquationSeparate C.uintptr_t
|
||||||
gpBufferData C.uintptr_t
|
gpBlendFuncSeparate C.uintptr_t
|
||||||
gpBufferSubData C.uintptr_t
|
gpBufferData C.uintptr_t
|
||||||
gpCheckFramebufferStatusEXT C.uintptr_t
|
gpBufferSubData C.uintptr_t
|
||||||
gpClear C.uintptr_t
|
gpCheckFramebufferStatus C.uintptr_t
|
||||||
gpColorMask C.uintptr_t
|
gpClear C.uintptr_t
|
||||||
gpCompileShader C.uintptr_t
|
gpColorMask C.uintptr_t
|
||||||
gpCreateProgram C.uintptr_t
|
gpCompileShader C.uintptr_t
|
||||||
gpCreateShader C.uintptr_t
|
gpCreateProgram C.uintptr_t
|
||||||
gpDeleteBuffers C.uintptr_t
|
gpCreateShader C.uintptr_t
|
||||||
gpDeleteFramebuffersEXT C.uintptr_t
|
gpDeleteBuffers C.uintptr_t
|
||||||
gpDeleteProgram C.uintptr_t
|
gpDeleteFramebuffers C.uintptr_t
|
||||||
gpDeleteRenderbuffersEXT C.uintptr_t
|
gpDeleteProgram C.uintptr_t
|
||||||
gpDeleteShader C.uintptr_t
|
gpDeleteRenderbuffers C.uintptr_t
|
||||||
gpDeleteTextures C.uintptr_t
|
gpDeleteShader C.uintptr_t
|
||||||
gpDisable C.uintptr_t
|
gpDeleteTextures C.uintptr_t
|
||||||
gpDisableVertexAttribArray C.uintptr_t
|
gpDeleteVertexArrays C.uintptr_t
|
||||||
gpDrawElements C.uintptr_t
|
gpDisable C.uintptr_t
|
||||||
gpEnable C.uintptr_t
|
gpDisableVertexAttribArray C.uintptr_t
|
||||||
gpEnableVertexAttribArray C.uintptr_t
|
gpDrawElements C.uintptr_t
|
||||||
gpFlush C.uintptr_t
|
gpEnable C.uintptr_t
|
||||||
gpFramebufferRenderbufferEXT C.uintptr_t
|
gpEnableVertexAttribArray C.uintptr_t
|
||||||
gpFramebufferTexture2DEXT C.uintptr_t
|
gpFlush C.uintptr_t
|
||||||
gpGenBuffers C.uintptr_t
|
gpFramebufferRenderbuffer C.uintptr_t
|
||||||
gpGenFramebuffersEXT C.uintptr_t
|
gpFramebufferTexture2D C.uintptr_t
|
||||||
gpGenRenderbuffersEXT C.uintptr_t
|
gpGenBuffers C.uintptr_t
|
||||||
gpGenTextures C.uintptr_t
|
gpGenFramebuffers C.uintptr_t
|
||||||
gpGetError C.uintptr_t
|
gpGenRenderbuffers C.uintptr_t
|
||||||
gpGetIntegerv C.uintptr_t
|
gpGenTextures C.uintptr_t
|
||||||
gpGetProgramInfoLog C.uintptr_t
|
gpGenVertexArrays C.uintptr_t
|
||||||
gpGetProgramiv C.uintptr_t
|
gpGetError C.uintptr_t
|
||||||
gpGetShaderInfoLog C.uintptr_t
|
gpGetIntegerv C.uintptr_t
|
||||||
gpGetShaderiv C.uintptr_t
|
gpGetProgramInfoLog C.uintptr_t
|
||||||
gpGetUniformLocation C.uintptr_t
|
gpGetProgramiv C.uintptr_t
|
||||||
gpIsFramebufferEXT C.uintptr_t
|
gpGetShaderInfoLog C.uintptr_t
|
||||||
gpIsProgram C.uintptr_t
|
gpGetShaderiv C.uintptr_t
|
||||||
gpIsRenderbufferEXT C.uintptr_t
|
gpGetUniformLocation C.uintptr_t
|
||||||
gpIsTexture C.uintptr_t
|
gpIsFramebuffer C.uintptr_t
|
||||||
gpLinkProgram C.uintptr_t
|
gpIsProgram C.uintptr_t
|
||||||
gpPixelStorei C.uintptr_t
|
gpIsRenderbuffer C.uintptr_t
|
||||||
gpReadPixels C.uintptr_t
|
gpIsTexture C.uintptr_t
|
||||||
gpRenderbufferStorageEXT C.uintptr_t
|
gpLinkProgram C.uintptr_t
|
||||||
gpScissor C.uintptr_t
|
gpPixelStorei C.uintptr_t
|
||||||
gpShaderSource C.uintptr_t
|
gpReadPixels C.uintptr_t
|
||||||
gpStencilFunc C.uintptr_t
|
gpRenderbufferStorage C.uintptr_t
|
||||||
gpStencilOp C.uintptr_t
|
gpScissor C.uintptr_t
|
||||||
gpTexImage2D C.uintptr_t
|
gpShaderSource C.uintptr_t
|
||||||
gpTexParameteri C.uintptr_t
|
gpStencilFunc C.uintptr_t
|
||||||
gpTexSubImage2D C.uintptr_t
|
gpStencilOp C.uintptr_t
|
||||||
gpUniform1fv C.uintptr_t
|
gpTexImage2D C.uintptr_t
|
||||||
gpUniform1i C.uintptr_t
|
gpTexParameteri C.uintptr_t
|
||||||
gpUniform1iv C.uintptr_t
|
gpTexSubImage2D C.uintptr_t
|
||||||
gpUniform2fv C.uintptr_t
|
gpUniform1fv C.uintptr_t
|
||||||
gpUniform2iv C.uintptr_t
|
gpUniform1i C.uintptr_t
|
||||||
gpUniform3fv C.uintptr_t
|
gpUniform1iv C.uintptr_t
|
||||||
gpUniform3iv C.uintptr_t
|
gpUniform2fv C.uintptr_t
|
||||||
gpUniform4fv C.uintptr_t
|
gpUniform2iv C.uintptr_t
|
||||||
gpUniform4iv C.uintptr_t
|
gpUniform3fv C.uintptr_t
|
||||||
gpUniformMatrix2fv C.uintptr_t
|
gpUniform3iv C.uintptr_t
|
||||||
gpUniformMatrix3fv C.uintptr_t
|
gpUniform4fv C.uintptr_t
|
||||||
gpUniformMatrix4fv C.uintptr_t
|
gpUniform4iv C.uintptr_t
|
||||||
gpUseProgram C.uintptr_t
|
gpUniformMatrix2fv C.uintptr_t
|
||||||
gpVertexAttribPointer C.uintptr_t
|
gpUniformMatrix3fv C.uintptr_t
|
||||||
gpViewport C.uintptr_t
|
gpUniformMatrix4fv C.uintptr_t
|
||||||
|
gpUseProgram C.uintptr_t
|
||||||
|
gpVertexAttribPointer C.uintptr_t
|
||||||
|
gpViewport C.uintptr_t
|
||||||
|
|
||||||
isES bool
|
isES bool
|
||||||
}
|
}
|
||||||
@ -429,17 +444,21 @@ func (c *defaultContext) BindBuffer(target uint32, buffer uint32) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *defaultContext) BindFramebuffer(target uint32, framebuffer uint32) {
|
func (c *defaultContext) BindFramebuffer(target uint32, framebuffer uint32) {
|
||||||
C.glowBindFramebufferEXT(c.gpBindFramebufferEXT, C.GLenum(target), C.GLuint(framebuffer))
|
C.glowBindFramebuffer(c.gpBindFramebuffer, C.GLenum(target), C.GLuint(framebuffer))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *defaultContext) BindRenderbuffer(target uint32, renderbuffer uint32) {
|
func (c *defaultContext) BindRenderbuffer(target uint32, renderbuffer uint32) {
|
||||||
C.glowBindRenderbufferEXT(c.gpBindRenderbufferEXT, C.GLenum(target), C.GLuint(renderbuffer))
|
C.glowBindRenderbuffer(c.gpBindRenderbuffer, C.GLenum(target), C.GLuint(renderbuffer))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *defaultContext) BindTexture(target uint32, texture uint32) {
|
func (c *defaultContext) BindTexture(target uint32, texture uint32) {
|
||||||
C.glowBindTexture(c.gpBindTexture, C.GLenum(target), C.GLuint(texture))
|
C.glowBindTexture(c.gpBindTexture, C.GLenum(target), C.GLuint(texture))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *defaultContext) BindVertexArray(array uint32) {
|
||||||
|
C.glowBindVertexArray(c.gpBindVertexArray, C.GLuint(array))
|
||||||
|
}
|
||||||
|
|
||||||
func (c *defaultContext) BlendEquationSeparate(modeRGB uint32, modeAlpha uint32) {
|
func (c *defaultContext) BlendEquationSeparate(modeRGB uint32, modeAlpha uint32) {
|
||||||
C.glowBlendEquationSeparate(c.gpBlendEquationSeparate, C.GLenum(modeRGB), C.GLenum(modeAlpha))
|
C.glowBlendEquationSeparate(c.gpBlendEquationSeparate, C.GLenum(modeRGB), C.GLenum(modeAlpha))
|
||||||
}
|
}
|
||||||
@ -458,7 +477,7 @@ func (c *defaultContext) BufferSubData(target uint32, offset int, data []byte) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *defaultContext) CheckFramebufferStatus(target uint32) uint32 {
|
func (c *defaultContext) CheckFramebufferStatus(target uint32) uint32 {
|
||||||
ret := C.glowCheckFramebufferStatusEXT(c.gpCheckFramebufferStatusEXT, C.GLenum(target))
|
ret := C.glowCheckFramebufferStatus(c.gpCheckFramebufferStatus, C.GLenum(target))
|
||||||
return uint32(ret)
|
return uint32(ret)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -482,7 +501,7 @@ func (c *defaultContext) CreateBuffer() uint32 {
|
|||||||
|
|
||||||
func (c *defaultContext) CreateFramebuffer() uint32 {
|
func (c *defaultContext) CreateFramebuffer() uint32 {
|
||||||
var framebuffer uint32
|
var framebuffer uint32
|
||||||
C.glowGenFramebuffersEXT(c.gpGenFramebuffersEXT, 1, (*C.GLuint)(unsafe.Pointer(&framebuffer)))
|
C.glowGenFramebuffers(c.gpGenFramebuffers, 1, (*C.GLuint)(unsafe.Pointer(&framebuffer)))
|
||||||
return framebuffer
|
return framebuffer
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -493,7 +512,7 @@ func (c *defaultContext) CreateProgram() uint32 {
|
|||||||
|
|
||||||
func (c *defaultContext) CreateRenderbuffer() uint32 {
|
func (c *defaultContext) CreateRenderbuffer() uint32 {
|
||||||
var renderbuffer uint32
|
var renderbuffer uint32
|
||||||
C.glowGenRenderbuffersEXT(c.gpGenRenderbuffersEXT, 1, (*C.GLuint)(unsafe.Pointer(&renderbuffer)))
|
C.glowGenRenderbuffers(c.gpGenRenderbuffers, 1, (*C.GLuint)(unsafe.Pointer(&renderbuffer)))
|
||||||
return renderbuffer
|
return renderbuffer
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -508,12 +527,18 @@ func (c *defaultContext) CreateTexture() uint32 {
|
|||||||
return texture
|
return texture
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *defaultContext) CreateVertexArray() uint32 {
|
||||||
|
var array uint32
|
||||||
|
C.glowGenVertexArrays(c.gpGenVertexArrays, 1, (*C.GLuint)(unsafe.Pointer(&array)))
|
||||||
|
return array
|
||||||
|
}
|
||||||
|
|
||||||
func (c *defaultContext) DeleteBuffer(buffer uint32) {
|
func (c *defaultContext) DeleteBuffer(buffer uint32) {
|
||||||
C.glowDeleteBuffers(c.gpDeleteBuffers, 1, (*C.GLuint)(unsafe.Pointer(&buffer)))
|
C.glowDeleteBuffers(c.gpDeleteBuffers, 1, (*C.GLuint)(unsafe.Pointer(&buffer)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *defaultContext) DeleteFramebuffer(framebuffer uint32) {
|
func (c *defaultContext) DeleteFramebuffer(framebuffer uint32) {
|
||||||
C.glowDeleteFramebuffersEXT(c.gpDeleteFramebuffersEXT, 1, (*C.GLuint)(unsafe.Pointer(&framebuffer)))
|
C.glowDeleteFramebuffers(c.gpDeleteFramebuffers, 1, (*C.GLuint)(unsafe.Pointer(&framebuffer)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *defaultContext) DeleteProgram(program uint32) {
|
func (c *defaultContext) DeleteProgram(program uint32) {
|
||||||
@ -521,7 +546,7 @@ func (c *defaultContext) DeleteProgram(program uint32) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *defaultContext) DeleteRenderbuffer(renderbuffer uint32) {
|
func (c *defaultContext) DeleteRenderbuffer(renderbuffer uint32) {
|
||||||
C.glowDeleteRenderbuffersEXT(c.gpDeleteRenderbuffersEXT, 1, (*C.GLuint)(unsafe.Pointer(&renderbuffer)))
|
C.glowDeleteRenderbuffers(c.gpDeleteRenderbuffers, 1, (*C.GLuint)(unsafe.Pointer(&renderbuffer)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *defaultContext) DeleteShader(shader uint32) {
|
func (c *defaultContext) DeleteShader(shader uint32) {
|
||||||
@ -532,6 +557,10 @@ func (c *defaultContext) DeleteTexture(texture uint32) {
|
|||||||
C.glowDeleteTextures(c.gpDeleteTextures, 1, (*C.GLuint)(unsafe.Pointer(&texture)))
|
C.glowDeleteTextures(c.gpDeleteTextures, 1, (*C.GLuint)(unsafe.Pointer(&texture)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *defaultContext) DeleteVertexArray(array uint32) {
|
||||||
|
C.glowDeleteVertexArrays(c.gpDeleteVertexArrays, 1, (*C.GLuint)(unsafe.Pointer(&array)))
|
||||||
|
}
|
||||||
|
|
||||||
func (c *defaultContext) Disable(cap uint32) {
|
func (c *defaultContext) Disable(cap uint32) {
|
||||||
C.glowDisable(c.gpDisable, C.GLenum(cap))
|
C.glowDisable(c.gpDisable, C.GLenum(cap))
|
||||||
}
|
}
|
||||||
@ -557,11 +586,11 @@ func (c *defaultContext) Flush() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *defaultContext) FramebufferRenderbuffer(target uint32, attachment uint32, renderbuffertarget uint32, renderbuffer uint32) {
|
func (c *defaultContext) FramebufferRenderbuffer(target uint32, attachment uint32, renderbuffertarget uint32, renderbuffer uint32) {
|
||||||
C.glowFramebufferRenderbufferEXT(c.gpFramebufferRenderbufferEXT, C.GLenum(target), C.GLenum(attachment), C.GLenum(renderbuffertarget), C.GLuint(renderbuffer))
|
C.glowFramebufferRenderbuffer(c.gpFramebufferRenderbuffer, C.GLenum(target), C.GLenum(attachment), C.GLenum(renderbuffertarget), C.GLuint(renderbuffer))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *defaultContext) FramebufferTexture2D(target uint32, attachment uint32, textarget uint32, texture uint32, level int32) {
|
func (c *defaultContext) FramebufferTexture2D(target uint32, attachment uint32, textarget uint32, texture uint32, level int32) {
|
||||||
C.glowFramebufferTexture2DEXT(c.gpFramebufferTexture2DEXT, C.GLenum(target), C.GLenum(attachment), C.GLenum(textarget), C.GLuint(texture), C.GLint(level))
|
C.glowFramebufferTexture2D(c.gpFramebufferTexture2D, C.GLenum(target), C.GLenum(attachment), C.GLenum(textarget), C.GLuint(texture), C.GLint(level))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *defaultContext) GetError() uint32 {
|
func (c *defaultContext) GetError() uint32 {
|
||||||
@ -609,7 +638,7 @@ func (c *defaultContext) GetUniformLocation(program uint32, name string) int32 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *defaultContext) IsFramebuffer(framebuffer uint32) bool {
|
func (c *defaultContext) IsFramebuffer(framebuffer uint32) bool {
|
||||||
ret := C.glowIsFramebufferEXT(c.gpIsFramebufferEXT, C.GLuint(framebuffer))
|
ret := C.glowIsFramebuffer(c.gpIsFramebuffer, C.GLuint(framebuffer))
|
||||||
return ret == TRUE
|
return ret == TRUE
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -619,7 +648,7 @@ func (c *defaultContext) IsProgram(program uint32) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *defaultContext) IsRenderbuffer(renderbuffer uint32) bool {
|
func (c *defaultContext) IsRenderbuffer(renderbuffer uint32) bool {
|
||||||
ret := C.glowIsRenderbufferEXT(c.gpIsRenderbufferEXT, C.GLuint(renderbuffer))
|
ret := C.glowIsRenderbuffer(c.gpIsRenderbuffer, C.GLuint(renderbuffer))
|
||||||
return ret == TRUE
|
return ret == TRUE
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -641,7 +670,7 @@ func (c *defaultContext) ReadPixels(dst []byte, x int32, y int32, width int32, h
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *defaultContext) RenderbufferStorage(target uint32, internalformat uint32, width int32, height int32) {
|
func (c *defaultContext) RenderbufferStorage(target uint32, internalformat uint32, width int32, height int32) {
|
||||||
C.glowRenderbufferStorageEXT(c.gpRenderbufferStorageEXT, C.GLenum(target), C.GLenum(internalformat), C.GLsizei(width), C.GLsizei(height))
|
C.glowRenderbufferStorage(c.gpRenderbufferStorage, C.GLenum(target), C.GLenum(internalformat), C.GLsizei(width), C.GLsizei(height))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *defaultContext) Scissor(x int32, y int32, width int32, height int32) {
|
func (c *defaultContext) Scissor(x int32, y int32, width int32, height int32) {
|
||||||
@ -758,37 +787,40 @@ func (c *defaultContext) LoadFunctions() error {
|
|||||||
c.gpAttachShader = C.uintptr_t(g.get("glAttachShader"))
|
c.gpAttachShader = C.uintptr_t(g.get("glAttachShader"))
|
||||||
c.gpBindAttribLocation = C.uintptr_t(g.get("glBindAttribLocation"))
|
c.gpBindAttribLocation = C.uintptr_t(g.get("glBindAttribLocation"))
|
||||||
c.gpBindBuffer = C.uintptr_t(g.get("glBindBuffer"))
|
c.gpBindBuffer = C.uintptr_t(g.get("glBindBuffer"))
|
||||||
c.gpBindFramebufferEXT = C.uintptr_t(g.get("glBindFramebufferEXT"))
|
c.gpBindFramebuffer = C.uintptr_t(g.get("glBindFramebuffer"))
|
||||||
c.gpBindRenderbufferEXT = C.uintptr_t(g.get("glBindRenderbufferEXT"))
|
c.gpBindRenderbuffer = C.uintptr_t(g.get("glBindRenderbuffer"))
|
||||||
c.gpBindTexture = C.uintptr_t(g.get("glBindTexture"))
|
c.gpBindTexture = C.uintptr_t(g.get("glBindTexture"))
|
||||||
|
c.gpBindVertexArray = C.uintptr_t(g.get("glBindVertexArray"))
|
||||||
c.gpBlendEquationSeparate = C.uintptr_t(g.get("glBlendEquationSeparate"))
|
c.gpBlendEquationSeparate = C.uintptr_t(g.get("glBlendEquationSeparate"))
|
||||||
c.gpBlendFuncSeparate = C.uintptr_t(g.get("glBlendFuncSeparate"))
|
c.gpBlendFuncSeparate = C.uintptr_t(g.get("glBlendFuncSeparate"))
|
||||||
c.gpBufferData = C.uintptr_t(g.get("glBufferData"))
|
c.gpBufferData = C.uintptr_t(g.get("glBufferData"))
|
||||||
c.gpBufferSubData = C.uintptr_t(g.get("glBufferSubData"))
|
c.gpBufferSubData = C.uintptr_t(g.get("glBufferSubData"))
|
||||||
c.gpCheckFramebufferStatusEXT = C.uintptr_t(g.get("glCheckFramebufferStatusEXT"))
|
c.gpCheckFramebufferStatus = C.uintptr_t(g.get("glCheckFramebufferStatus"))
|
||||||
c.gpClear = C.uintptr_t(g.get("glClear"))
|
c.gpClear = C.uintptr_t(g.get("glClear"))
|
||||||
c.gpColorMask = C.uintptr_t(g.get("glColorMask"))
|
c.gpColorMask = C.uintptr_t(g.get("glColorMask"))
|
||||||
c.gpCompileShader = C.uintptr_t(g.get("glCompileShader"))
|
c.gpCompileShader = C.uintptr_t(g.get("glCompileShader"))
|
||||||
c.gpCreateProgram = C.uintptr_t(g.get("glCreateProgram"))
|
c.gpCreateProgram = C.uintptr_t(g.get("glCreateProgram"))
|
||||||
c.gpCreateShader = C.uintptr_t(g.get("glCreateShader"))
|
c.gpCreateShader = C.uintptr_t(g.get("glCreateShader"))
|
||||||
c.gpDeleteBuffers = C.uintptr_t(g.get("glDeleteBuffers"))
|
c.gpDeleteBuffers = C.uintptr_t(g.get("glDeleteBuffers"))
|
||||||
c.gpDeleteFramebuffersEXT = C.uintptr_t(g.get("glDeleteFramebuffersEXT"))
|
c.gpDeleteFramebuffers = C.uintptr_t(g.get("glDeleteFramebuffers"))
|
||||||
c.gpDeleteProgram = C.uintptr_t(g.get("glDeleteProgram"))
|
c.gpDeleteProgram = C.uintptr_t(g.get("glDeleteProgram"))
|
||||||
c.gpDeleteRenderbuffersEXT = C.uintptr_t(g.get("glDeleteRenderbuffersEXT"))
|
c.gpDeleteRenderbuffers = C.uintptr_t(g.get("glDeleteRenderbuffers"))
|
||||||
c.gpDeleteShader = C.uintptr_t(g.get("glDeleteShader"))
|
c.gpDeleteShader = C.uintptr_t(g.get("glDeleteShader"))
|
||||||
c.gpDeleteTextures = C.uintptr_t(g.get("glDeleteTextures"))
|
c.gpDeleteTextures = C.uintptr_t(g.get("glDeleteTextures"))
|
||||||
|
c.gpDeleteVertexArrays = C.uintptr_t(g.get("glDeleteVertexArrays"))
|
||||||
c.gpDisable = C.uintptr_t(g.get("glDisable"))
|
c.gpDisable = C.uintptr_t(g.get("glDisable"))
|
||||||
c.gpDisableVertexAttribArray = C.uintptr_t(g.get("glDisableVertexAttribArray"))
|
c.gpDisableVertexAttribArray = C.uintptr_t(g.get("glDisableVertexAttribArray"))
|
||||||
c.gpDrawElements = C.uintptr_t(g.get("glDrawElements"))
|
c.gpDrawElements = C.uintptr_t(g.get("glDrawElements"))
|
||||||
c.gpEnable = C.uintptr_t(g.get("glEnable"))
|
c.gpEnable = C.uintptr_t(g.get("glEnable"))
|
||||||
c.gpEnableVertexAttribArray = C.uintptr_t(g.get("glEnableVertexAttribArray"))
|
c.gpEnableVertexAttribArray = C.uintptr_t(g.get("glEnableVertexAttribArray"))
|
||||||
c.gpFlush = C.uintptr_t(g.get("glFlush"))
|
c.gpFlush = C.uintptr_t(g.get("glFlush"))
|
||||||
c.gpFramebufferRenderbufferEXT = C.uintptr_t(g.get("glFramebufferRenderbufferEXT"))
|
c.gpFramebufferRenderbuffer = C.uintptr_t(g.get("glFramebufferRenderbuffer"))
|
||||||
c.gpFramebufferTexture2DEXT = C.uintptr_t(g.get("glFramebufferTexture2DEXT"))
|
c.gpFramebufferTexture2D = C.uintptr_t(g.get("glFramebufferTexture2D"))
|
||||||
c.gpGenBuffers = C.uintptr_t(g.get("glGenBuffers"))
|
c.gpGenBuffers = C.uintptr_t(g.get("glGenBuffers"))
|
||||||
c.gpGenFramebuffersEXT = C.uintptr_t(g.get("glGenFramebuffersEXT"))
|
c.gpGenFramebuffers = C.uintptr_t(g.get("glGenFramebuffers"))
|
||||||
c.gpGenRenderbuffersEXT = C.uintptr_t(g.get("glGenRenderbuffersEXT"))
|
c.gpGenRenderbuffers = C.uintptr_t(g.get("glGenRenderbuffers"))
|
||||||
c.gpGenTextures = C.uintptr_t(g.get("glGenTextures"))
|
c.gpGenTextures = C.uintptr_t(g.get("glGenTextures"))
|
||||||
|
c.gpGenVertexArrays = C.uintptr_t(g.get("glGenVertexArrays"))
|
||||||
c.gpGetError = C.uintptr_t(g.get("glGetError"))
|
c.gpGetError = C.uintptr_t(g.get("glGetError"))
|
||||||
c.gpGetIntegerv = C.uintptr_t(g.get("glGetIntegerv"))
|
c.gpGetIntegerv = C.uintptr_t(g.get("glGetIntegerv"))
|
||||||
c.gpGetProgramInfoLog = C.uintptr_t(g.get("glGetProgramInfoLog"))
|
c.gpGetProgramInfoLog = C.uintptr_t(g.get("glGetProgramInfoLog"))
|
||||||
@ -796,14 +828,14 @@ func (c *defaultContext) LoadFunctions() error {
|
|||||||
c.gpGetShaderInfoLog = C.uintptr_t(g.get("glGetShaderInfoLog"))
|
c.gpGetShaderInfoLog = C.uintptr_t(g.get("glGetShaderInfoLog"))
|
||||||
c.gpGetShaderiv = C.uintptr_t(g.get("glGetShaderiv"))
|
c.gpGetShaderiv = C.uintptr_t(g.get("glGetShaderiv"))
|
||||||
c.gpGetUniformLocation = C.uintptr_t(g.get("glGetUniformLocation"))
|
c.gpGetUniformLocation = C.uintptr_t(g.get("glGetUniformLocation"))
|
||||||
c.gpIsFramebufferEXT = C.uintptr_t(g.get("glIsFramebufferEXT"))
|
c.gpIsFramebuffer = C.uintptr_t(g.get("glIsFramebuffer"))
|
||||||
c.gpIsProgram = C.uintptr_t(g.get("glIsProgram"))
|
c.gpIsProgram = C.uintptr_t(g.get("glIsProgram"))
|
||||||
c.gpIsRenderbufferEXT = C.uintptr_t(g.get("glIsRenderbufferEXT"))
|
c.gpIsRenderbuffer = C.uintptr_t(g.get("glIsRenderbuffer"))
|
||||||
c.gpIsTexture = C.uintptr_t(g.get("glIsTexture"))
|
c.gpIsTexture = C.uintptr_t(g.get("glIsTexture"))
|
||||||
c.gpLinkProgram = C.uintptr_t(g.get("glLinkProgram"))
|
c.gpLinkProgram = C.uintptr_t(g.get("glLinkProgram"))
|
||||||
c.gpPixelStorei = C.uintptr_t(g.get("glPixelStorei"))
|
c.gpPixelStorei = C.uintptr_t(g.get("glPixelStorei"))
|
||||||
c.gpReadPixels = C.uintptr_t(g.get("glReadPixels"))
|
c.gpReadPixels = C.uintptr_t(g.get("glReadPixels"))
|
||||||
c.gpRenderbufferStorageEXT = C.uintptr_t(g.get("glRenderbufferStorageEXT"))
|
c.gpRenderbufferStorage = C.uintptr_t(g.get("glRenderbufferStorage"))
|
||||||
c.gpScissor = C.uintptr_t(g.get("glScissor"))
|
c.gpScissor = C.uintptr_t(g.get("glScissor"))
|
||||||
c.gpShaderSource = C.uintptr_t(g.get("glShaderSource"))
|
c.gpShaderSource = C.uintptr_t(g.get("glShaderSource"))
|
||||||
c.gpStencilFunc = C.uintptr_t(g.get("glStencilFunc"))
|
c.gpStencilFunc = C.uintptr_t(g.get("glStencilFunc"))
|
||||||
|
@ -29,6 +29,7 @@ type defaultContext struct {
|
|||||||
fnBindFramebuffer js.Value
|
fnBindFramebuffer js.Value
|
||||||
fnBindRenderbuffer js.Value
|
fnBindRenderbuffer js.Value
|
||||||
fnBindTexture js.Value
|
fnBindTexture js.Value
|
||||||
|
fnBindVertexArray js.Value
|
||||||
fnBlendEquationSeparate js.Value
|
fnBlendEquationSeparate js.Value
|
||||||
fnBlendFuncSeparate js.Value
|
fnBlendFuncSeparate js.Value
|
||||||
fnBufferData js.Value
|
fnBufferData js.Value
|
||||||
@ -43,12 +44,14 @@ type defaultContext struct {
|
|||||||
fnCreateRenderbuffer js.Value
|
fnCreateRenderbuffer js.Value
|
||||||
fnCreateShader js.Value
|
fnCreateShader js.Value
|
||||||
fnCreateTexture js.Value
|
fnCreateTexture js.Value
|
||||||
|
fnCreateVertexArray js.Value
|
||||||
fnDeleteBuffer js.Value
|
fnDeleteBuffer js.Value
|
||||||
fnDeleteFramebuffer js.Value
|
fnDeleteFramebuffer js.Value
|
||||||
fnDeleteProgram js.Value
|
fnDeleteProgram js.Value
|
||||||
fnDeleteRenderbuffer js.Value
|
fnDeleteRenderbuffer js.Value
|
||||||
fnDeleteShader js.Value
|
fnDeleteShader js.Value
|
||||||
fnDeleteTexture js.Value
|
fnDeleteTexture js.Value
|
||||||
|
fnDeleteVertexArray js.Value
|
||||||
fnDisable js.Value
|
fnDisable js.Value
|
||||||
fnDisableVertexAttribArray js.Value
|
fnDisableVertexAttribArray js.Value
|
||||||
fnDrawElements js.Value
|
fnDrawElements js.Value
|
||||||
@ -102,6 +105,7 @@ type defaultContext struct {
|
|||||||
renderbuffers values
|
renderbuffers values
|
||||||
shaders values
|
shaders values
|
||||||
textures values
|
textures values
|
||||||
|
vertexArrays values
|
||||||
uniformLocations map[uint32]*values
|
uniformLocations map[uint32]*values
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,6 +160,7 @@ func NewDefaultContext(v js.Value) (Context, error) {
|
|||||||
fnBindFramebuffer: v.Get("bindFramebuffer").Call("bind", v),
|
fnBindFramebuffer: v.Get("bindFramebuffer").Call("bind", v),
|
||||||
fnBindRenderbuffer: v.Get("bindRenderbuffer").Call("bind", v),
|
fnBindRenderbuffer: v.Get("bindRenderbuffer").Call("bind", v),
|
||||||
fnBindTexture: v.Get("bindTexture").Call("bind", v),
|
fnBindTexture: v.Get("bindTexture").Call("bind", v),
|
||||||
|
fnBindVertexArray: v.Get("bindVertexArray").Call("bind", v),
|
||||||
fnBlendEquationSeparate: v.Get("blendEquationSeparate").Call("bind", v),
|
fnBlendEquationSeparate: v.Get("blendEquationSeparate").Call("bind", v),
|
||||||
fnBlendFuncSeparate: v.Get("blendFuncSeparate").Call("bind", v),
|
fnBlendFuncSeparate: v.Get("blendFuncSeparate").Call("bind", v),
|
||||||
fnBufferData: v.Get("bufferData").Call("bind", v),
|
fnBufferData: v.Get("bufferData").Call("bind", v),
|
||||||
@ -170,12 +175,14 @@ func NewDefaultContext(v js.Value) (Context, error) {
|
|||||||
fnCreateRenderbuffer: v.Get("createRenderbuffer").Call("bind", v),
|
fnCreateRenderbuffer: v.Get("createRenderbuffer").Call("bind", v),
|
||||||
fnCreateShader: v.Get("createShader").Call("bind", v),
|
fnCreateShader: v.Get("createShader").Call("bind", v),
|
||||||
fnCreateTexture: v.Get("createTexture").Call("bind", v),
|
fnCreateTexture: v.Get("createTexture").Call("bind", v),
|
||||||
|
fnCreateVertexArray: v.Get("createVertexArray").Call("bind", v),
|
||||||
fnDeleteBuffer: v.Get("deleteBuffer").Call("bind", v),
|
fnDeleteBuffer: v.Get("deleteBuffer").Call("bind", v),
|
||||||
fnDeleteFramebuffer: v.Get("deleteFramebuffer").Call("bind", v),
|
fnDeleteFramebuffer: v.Get("deleteFramebuffer").Call("bind", v),
|
||||||
fnDeleteProgram: v.Get("deleteProgram").Call("bind", v),
|
fnDeleteProgram: v.Get("deleteProgram").Call("bind", v),
|
||||||
fnDeleteRenderbuffer: v.Get("deleteRenderbuffer").Call("bind", v),
|
fnDeleteRenderbuffer: v.Get("deleteRenderbuffer").Call("bind", v),
|
||||||
fnDeleteShader: v.Get("deleteShader").Call("bind", v),
|
fnDeleteShader: v.Get("deleteShader").Call("bind", v),
|
||||||
fnDeleteTexture: v.Get("deleteTexture").Call("bind", v),
|
fnDeleteTexture: v.Get("deleteTexture").Call("bind", v),
|
||||||
|
fnDeleteVertexArray: v.Get("deleteVertexArray").Call("bind", v),
|
||||||
fnDisable: v.Get("disable").Call("bind", v),
|
fnDisable: v.Get("disable").Call("bind", v),
|
||||||
fnDisableVertexAttribArray: v.Get("disableVertexAttribArray").Call("bind", v),
|
fnDisableVertexAttribArray: v.Get("disableVertexAttribArray").Call("bind", v),
|
||||||
fnDrawElements: v.Get("drawElements").Call("bind", v),
|
fnDrawElements: v.Get("drawElements").Call("bind", v),
|
||||||
@ -269,6 +276,10 @@ func (c *defaultContext) BindTexture(target uint32, texture uint32) {
|
|||||||
c.fnBindTexture.Invoke(target, c.textures.get(texture))
|
c.fnBindTexture.Invoke(target, c.textures.get(texture))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *defaultContext) BindVertexArray(array uint32) {
|
||||||
|
c.fnBindVertexArray.Invoke(c.vertexArrays.get(array))
|
||||||
|
}
|
||||||
|
|
||||||
func (c *defaultContext) BlendEquationSeparate(modeRGB uint32, modeAlpha uint32) {
|
func (c *defaultContext) BlendEquationSeparate(modeRGB uint32, modeAlpha uint32) {
|
||||||
c.fnBlendEquationSeparate.Invoke(modeRGB, modeAlpha)
|
c.fnBlendEquationSeparate.Invoke(modeRGB, modeAlpha)
|
||||||
}
|
}
|
||||||
@ -327,6 +338,10 @@ func (c *defaultContext) CreateTexture() uint32 {
|
|||||||
return c.textures.create(c.fnCreateTexture.Invoke())
|
return c.textures.create(c.fnCreateTexture.Invoke())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *defaultContext) CreateVertexArray() uint32 {
|
||||||
|
return c.vertexArrays.create(c.fnCreateVertexArray.Invoke())
|
||||||
|
}
|
||||||
|
|
||||||
func (c *defaultContext) DeleteBuffer(buffer uint32) {
|
func (c *defaultContext) DeleteBuffer(buffer uint32) {
|
||||||
c.fnDeleteBuffer.Invoke(c.buffers.get(buffer))
|
c.fnDeleteBuffer.Invoke(c.buffers.get(buffer))
|
||||||
c.buffers.delete(buffer)
|
c.buffers.delete(buffer)
|
||||||
@ -358,6 +373,11 @@ func (c *defaultContext) DeleteTexture(texture uint32) {
|
|||||||
c.textures.delete(texture)
|
c.textures.delete(texture)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *defaultContext) DeleteVertexArray(array uint32) {
|
||||||
|
c.fnDeleteVertexArray.Invoke(c.vertexArrays.get(array))
|
||||||
|
c.textures.delete(array)
|
||||||
|
}
|
||||||
|
|
||||||
func (c *defaultContext) Disable(cap uint32) {
|
func (c *defaultContext) Disable(cap uint32) {
|
||||||
c.fnDisable.Invoke(cap)
|
c.fnDisable.Invoke(cap)
|
||||||
}
|
}
|
||||||
|
@ -24,78 +24,81 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type defaultContext struct {
|
type defaultContext struct {
|
||||||
gpActiveTexture uintptr
|
gpActiveTexture uintptr
|
||||||
gpAttachShader uintptr
|
gpAttachShader uintptr
|
||||||
gpBindAttribLocation uintptr
|
gpBindAttribLocation uintptr
|
||||||
gpBindBuffer uintptr
|
gpBindBuffer uintptr
|
||||||
gpBindFramebufferEXT uintptr
|
gpBindFramebuffer uintptr
|
||||||
gpBindRenderbufferEXT uintptr
|
gpBindRenderbuffer uintptr
|
||||||
gpBindTexture uintptr
|
gpBindTexture uintptr
|
||||||
gpBlendEquationSeparate uintptr
|
gpBindVertexArray uintptr
|
||||||
gpBlendFuncSeparate uintptr
|
gpBlendEquationSeparate uintptr
|
||||||
gpBufferData uintptr
|
gpBlendFuncSeparate uintptr
|
||||||
gpBufferSubData uintptr
|
gpBufferData uintptr
|
||||||
gpCheckFramebufferStatusEXT uintptr
|
gpBufferSubData uintptr
|
||||||
gpClear uintptr
|
gpCheckFramebufferStatus uintptr
|
||||||
gpColorMask uintptr
|
gpClear uintptr
|
||||||
gpCompileShader uintptr
|
gpColorMask uintptr
|
||||||
gpCreateProgram uintptr
|
gpCompileShader uintptr
|
||||||
gpCreateShader uintptr
|
gpCreateProgram uintptr
|
||||||
gpDeleteBuffers uintptr
|
gpCreateShader uintptr
|
||||||
gpDeleteFramebuffersEXT uintptr
|
gpDeleteBuffers uintptr
|
||||||
gpDeleteProgram uintptr
|
gpDeleteFramebuffers uintptr
|
||||||
gpDeleteRenderbuffersEXT uintptr
|
gpDeleteProgram uintptr
|
||||||
gpDeleteShader uintptr
|
gpDeleteRenderbuffers uintptr
|
||||||
gpDeleteTextures uintptr
|
gpDeleteShader uintptr
|
||||||
gpDisable uintptr
|
gpDeleteTextures uintptr
|
||||||
gpDisableVertexAttribArray uintptr
|
gpDeleteVertexArrays uintptr
|
||||||
gpDrawElements uintptr
|
gpDisable uintptr
|
||||||
gpEnable uintptr
|
gpDisableVertexAttribArray uintptr
|
||||||
gpEnableVertexAttribArray uintptr
|
gpDrawElements uintptr
|
||||||
gpFlush uintptr
|
gpEnable uintptr
|
||||||
gpFramebufferRenderbufferEXT uintptr
|
gpEnableVertexAttribArray uintptr
|
||||||
gpFramebufferTexture2DEXT uintptr
|
gpFlush uintptr
|
||||||
gpGenBuffers uintptr
|
gpFramebufferRenderbuffer uintptr
|
||||||
gpGenFramebuffersEXT uintptr
|
gpFramebufferTexture2D uintptr
|
||||||
gpGenRenderbuffersEXT uintptr
|
gpGenBuffers uintptr
|
||||||
gpGenTextures uintptr
|
gpGenFramebuffers uintptr
|
||||||
gpGetError uintptr
|
gpGenRenderbuffers uintptr
|
||||||
gpGetIntegerv uintptr
|
gpGenTextures uintptr
|
||||||
gpGetProgramInfoLog uintptr
|
gpGenVertexArrays uintptr
|
||||||
gpGetProgramiv uintptr
|
gpGetError uintptr
|
||||||
gpGetShaderInfoLog uintptr
|
gpGetIntegerv uintptr
|
||||||
gpGetShaderiv uintptr
|
gpGetProgramInfoLog uintptr
|
||||||
gpGetUniformLocation uintptr
|
gpGetProgramiv uintptr
|
||||||
gpIsFramebufferEXT uintptr
|
gpGetShaderInfoLog uintptr
|
||||||
gpIsProgram uintptr
|
gpGetShaderiv uintptr
|
||||||
gpIsRenderbufferEXT uintptr
|
gpGetUniformLocation uintptr
|
||||||
gpIsTexture uintptr
|
gpIsFramebuffer uintptr
|
||||||
gpLinkProgram uintptr
|
gpIsProgram uintptr
|
||||||
gpPixelStorei uintptr
|
gpIsRenderbuffer uintptr
|
||||||
gpReadPixels uintptr
|
gpIsTexture uintptr
|
||||||
gpRenderbufferStorageEXT uintptr
|
gpLinkProgram uintptr
|
||||||
gpScissor uintptr
|
gpPixelStorei uintptr
|
||||||
gpShaderSource uintptr
|
gpReadPixels uintptr
|
||||||
gpStencilFunc uintptr
|
gpRenderbufferStorage uintptr
|
||||||
gpStencilOp uintptr
|
gpScissor uintptr
|
||||||
gpTexImage2D uintptr
|
gpShaderSource uintptr
|
||||||
gpTexParameteri uintptr
|
gpStencilFunc uintptr
|
||||||
gpTexSubImage2D uintptr
|
gpStencilOp uintptr
|
||||||
gpUniform1fv uintptr
|
gpTexImage2D uintptr
|
||||||
gpUniform1i uintptr
|
gpTexParameteri uintptr
|
||||||
gpUniform1iv uintptr
|
gpTexSubImage2D uintptr
|
||||||
gpUniform2fv uintptr
|
gpUniform1fv uintptr
|
||||||
gpUniform2iv uintptr
|
gpUniform1i uintptr
|
||||||
gpUniform3fv uintptr
|
gpUniform1iv uintptr
|
||||||
gpUniform3iv uintptr
|
gpUniform2fv uintptr
|
||||||
gpUniform4fv uintptr
|
gpUniform2iv uintptr
|
||||||
gpUniform4iv uintptr
|
gpUniform3fv uintptr
|
||||||
gpUniformMatrix2fv uintptr
|
gpUniform3iv uintptr
|
||||||
gpUniformMatrix3fv uintptr
|
gpUniform4fv uintptr
|
||||||
gpUniformMatrix4fv uintptr
|
gpUniform4iv uintptr
|
||||||
gpUseProgram uintptr
|
gpUniformMatrix2fv uintptr
|
||||||
gpVertexAttribPointer uintptr
|
gpUniformMatrix3fv uintptr
|
||||||
gpViewport uintptr
|
gpUniformMatrix4fv uintptr
|
||||||
|
gpUseProgram uintptr
|
||||||
|
gpVertexAttribPointer uintptr
|
||||||
|
gpViewport uintptr
|
||||||
|
|
||||||
isES bool
|
isES bool
|
||||||
}
|
}
|
||||||
@ -138,17 +141,21 @@ func (c *defaultContext) BindBuffer(target uint32, buffer uint32) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *defaultContext) BindFramebuffer(target uint32, framebuffer uint32) {
|
func (c *defaultContext) BindFramebuffer(target uint32, framebuffer uint32) {
|
||||||
purego.SyscallN(c.gpBindFramebufferEXT, uintptr(target), uintptr(framebuffer))
|
purego.SyscallN(c.gpBindFramebuffer, uintptr(target), uintptr(framebuffer))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *defaultContext) BindRenderbuffer(target uint32, renderbuffer uint32) {
|
func (c *defaultContext) BindRenderbuffer(target uint32, renderbuffer uint32) {
|
||||||
purego.SyscallN(c.gpBindRenderbufferEXT, uintptr(target), uintptr(renderbuffer))
|
purego.SyscallN(c.gpBindRenderbuffer, uintptr(target), uintptr(renderbuffer))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *defaultContext) BindTexture(target uint32, texture uint32) {
|
func (c *defaultContext) BindTexture(target uint32, texture uint32) {
|
||||||
purego.SyscallN(c.gpBindTexture, uintptr(target), uintptr(texture))
|
purego.SyscallN(c.gpBindTexture, uintptr(target), uintptr(texture))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *defaultContext) BindVertexArray(array uint32) {
|
||||||
|
purego.SyscallN(c.gpBindVertexArray, uintptr(array))
|
||||||
|
}
|
||||||
|
|
||||||
func (c *defaultContext) BlendEquationSeparate(modeRGB uint32, modeAlpha uint32) {
|
func (c *defaultContext) BlendEquationSeparate(modeRGB uint32, modeAlpha uint32) {
|
||||||
purego.SyscallN(c.gpBlendEquationSeparate, uintptr(modeRGB), uintptr(modeAlpha))
|
purego.SyscallN(c.gpBlendEquationSeparate, uintptr(modeRGB), uintptr(modeAlpha))
|
||||||
}
|
}
|
||||||
@ -167,7 +174,7 @@ func (c *defaultContext) BufferSubData(target uint32, offset int, data []byte) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *defaultContext) CheckFramebufferStatus(target uint32) uint32 {
|
func (c *defaultContext) CheckFramebufferStatus(target uint32) uint32 {
|
||||||
ret, _, _ := purego.SyscallN(c.gpCheckFramebufferStatusEXT, uintptr(target))
|
ret, _, _ := purego.SyscallN(c.gpCheckFramebufferStatus, uintptr(target))
|
||||||
return uint32(ret)
|
return uint32(ret)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,7 +198,7 @@ func (c *defaultContext) CreateBuffer() uint32 {
|
|||||||
|
|
||||||
func (c *defaultContext) CreateFramebuffer() uint32 {
|
func (c *defaultContext) CreateFramebuffer() uint32 {
|
||||||
var framebuffer uint32
|
var framebuffer uint32
|
||||||
purego.SyscallN(c.gpGenFramebuffersEXT, 1, uintptr(unsafe.Pointer(&framebuffer)))
|
purego.SyscallN(c.gpGenFramebuffers, 1, uintptr(unsafe.Pointer(&framebuffer)))
|
||||||
return framebuffer
|
return framebuffer
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,7 +209,7 @@ func (c *defaultContext) CreateProgram() uint32 {
|
|||||||
|
|
||||||
func (c *defaultContext) CreateRenderbuffer() uint32 {
|
func (c *defaultContext) CreateRenderbuffer() uint32 {
|
||||||
var renderbuffer uint32
|
var renderbuffer uint32
|
||||||
purego.SyscallN(c.gpGenRenderbuffersEXT, 1, uintptr(unsafe.Pointer(&renderbuffer)))
|
purego.SyscallN(c.gpGenRenderbuffers, 1, uintptr(unsafe.Pointer(&renderbuffer)))
|
||||||
return renderbuffer
|
return renderbuffer
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,12 +224,18 @@ func (c *defaultContext) CreateTexture() uint32 {
|
|||||||
return texture
|
return texture
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *defaultContext) CreateVertexArray() uint32 {
|
||||||
|
var array uint32
|
||||||
|
purego.SyscallN(c.gpGenVertexArrays, 1, uintptr(unsafe.Pointer(&array)))
|
||||||
|
return array
|
||||||
|
}
|
||||||
|
|
||||||
func (c *defaultContext) DeleteBuffer(buffer uint32) {
|
func (c *defaultContext) DeleteBuffer(buffer uint32) {
|
||||||
purego.SyscallN(c.gpDeleteBuffers, 1, uintptr(unsafe.Pointer(&buffer)))
|
purego.SyscallN(c.gpDeleteBuffers, 1, uintptr(unsafe.Pointer(&buffer)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *defaultContext) DeleteFramebuffer(framebuffer uint32) {
|
func (c *defaultContext) DeleteFramebuffer(framebuffer uint32) {
|
||||||
purego.SyscallN(c.gpDeleteFramebuffersEXT, 1, uintptr(unsafe.Pointer(&framebuffer)))
|
purego.SyscallN(c.gpDeleteFramebuffers, 1, uintptr(unsafe.Pointer(&framebuffer)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *defaultContext) DeleteProgram(program uint32) {
|
func (c *defaultContext) DeleteProgram(program uint32) {
|
||||||
@ -230,7 +243,7 @@ func (c *defaultContext) DeleteProgram(program uint32) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *defaultContext) DeleteRenderbuffer(renderbuffer uint32) {
|
func (c *defaultContext) DeleteRenderbuffer(renderbuffer uint32) {
|
||||||
purego.SyscallN(c.gpDeleteRenderbuffersEXT, 1, uintptr(unsafe.Pointer(&renderbuffer)))
|
purego.SyscallN(c.gpDeleteRenderbuffers, 1, uintptr(unsafe.Pointer(&renderbuffer)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *defaultContext) DeleteShader(shader uint32) {
|
func (c *defaultContext) DeleteShader(shader uint32) {
|
||||||
@ -241,6 +254,10 @@ func (c *defaultContext) DeleteTexture(texture uint32) {
|
|||||||
purego.SyscallN(c.gpDeleteTextures, 1, uintptr(unsafe.Pointer(&texture)))
|
purego.SyscallN(c.gpDeleteTextures, 1, uintptr(unsafe.Pointer(&texture)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *defaultContext) DeleteVertexArray(array uint32) {
|
||||||
|
purego.SyscallN(c.gpDeleteVertexArrays, 1, uintptr(unsafe.Pointer(&array)))
|
||||||
|
}
|
||||||
|
|
||||||
func (c *defaultContext) Disable(cap uint32) {
|
func (c *defaultContext) Disable(cap uint32) {
|
||||||
purego.SyscallN(c.gpDisable, uintptr(cap))
|
purego.SyscallN(c.gpDisable, uintptr(cap))
|
||||||
}
|
}
|
||||||
@ -266,11 +283,11 @@ func (c *defaultContext) Flush() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *defaultContext) FramebufferRenderbuffer(target uint32, attachment uint32, renderbuffertarget uint32, renderbuffer uint32) {
|
func (c *defaultContext) FramebufferRenderbuffer(target uint32, attachment uint32, renderbuffertarget uint32, renderbuffer uint32) {
|
||||||
purego.SyscallN(c.gpFramebufferRenderbufferEXT, uintptr(target), uintptr(attachment), uintptr(renderbuffertarget), uintptr(renderbuffer))
|
purego.SyscallN(c.gpFramebufferRenderbuffer, uintptr(target), uintptr(attachment), uintptr(renderbuffertarget), uintptr(renderbuffer))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *defaultContext) FramebufferTexture2D(target uint32, attachment uint32, textarget uint32, texture uint32, level int32) {
|
func (c *defaultContext) FramebufferTexture2D(target uint32, attachment uint32, textarget uint32, texture uint32, level int32) {
|
||||||
purego.SyscallN(c.gpFramebufferTexture2DEXT, uintptr(target), uintptr(attachment), uintptr(textarget), uintptr(texture), uintptr(level))
|
purego.SyscallN(c.gpFramebufferTexture2D, uintptr(target), uintptr(attachment), uintptr(textarget), uintptr(texture), uintptr(level))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *defaultContext) GetError() uint32 {
|
func (c *defaultContext) GetError() uint32 {
|
||||||
@ -318,7 +335,7 @@ func (c *defaultContext) GetUniformLocation(program uint32, name string) int32 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *defaultContext) IsFramebuffer(framebuffer uint32) bool {
|
func (c *defaultContext) IsFramebuffer(framebuffer uint32) bool {
|
||||||
ret, _, _ := purego.SyscallN(c.gpIsFramebufferEXT, uintptr(framebuffer))
|
ret, _, _ := purego.SyscallN(c.gpIsFramebuffer, uintptr(framebuffer))
|
||||||
return byte(ret) != 0
|
return byte(ret) != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -328,7 +345,7 @@ func (c *defaultContext) IsProgram(program uint32) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *defaultContext) IsRenderbuffer(renderbuffer uint32) bool {
|
func (c *defaultContext) IsRenderbuffer(renderbuffer uint32) bool {
|
||||||
ret, _, _ := purego.SyscallN(c.gpIsRenderbufferEXT, uintptr(renderbuffer))
|
ret, _, _ := purego.SyscallN(c.gpIsRenderbuffer, uintptr(renderbuffer))
|
||||||
return byte(ret) != 0
|
return byte(ret) != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -350,7 +367,7 @@ func (c *defaultContext) ReadPixels(dst []byte, x int32, y int32, width int32, h
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *defaultContext) RenderbufferStorage(target uint32, internalformat uint32, width int32, height int32) {
|
func (c *defaultContext) RenderbufferStorage(target uint32, internalformat uint32, width int32, height int32) {
|
||||||
purego.SyscallN(c.gpRenderbufferStorageEXT, uintptr(target), uintptr(internalformat), uintptr(width), uintptr(height))
|
purego.SyscallN(c.gpRenderbufferStorage, uintptr(target), uintptr(internalformat), uintptr(width), uintptr(height))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *defaultContext) Scissor(x int32, y int32, width int32, height int32) {
|
func (c *defaultContext) Scissor(x int32, y int32, width int32, height int32) {
|
||||||
@ -467,37 +484,40 @@ func (c *defaultContext) LoadFunctions() error {
|
|||||||
c.gpAttachShader = g.get("glAttachShader")
|
c.gpAttachShader = g.get("glAttachShader")
|
||||||
c.gpBindAttribLocation = g.get("glBindAttribLocation")
|
c.gpBindAttribLocation = g.get("glBindAttribLocation")
|
||||||
c.gpBindBuffer = g.get("glBindBuffer")
|
c.gpBindBuffer = g.get("glBindBuffer")
|
||||||
c.gpBindFramebufferEXT = g.get("glBindFramebufferEXT")
|
c.gpBindFramebuffer = g.get("glBindFramebuffer")
|
||||||
c.gpBindRenderbufferEXT = g.get("glBindRenderbufferEXT")
|
c.gpBindRenderbuffer = g.get("glBindRenderbuffer")
|
||||||
c.gpBindTexture = g.get("glBindTexture")
|
c.gpBindTexture = g.get("glBindTexture")
|
||||||
|
c.gpBindVertexArray = g.get("glBindVertexArray")
|
||||||
c.gpBlendEquationSeparate = g.get("glBlendEquationSeparate")
|
c.gpBlendEquationSeparate = g.get("glBlendEquationSeparate")
|
||||||
c.gpBlendFuncSeparate = g.get("glBlendFuncSeparate")
|
c.gpBlendFuncSeparate = g.get("glBlendFuncSeparate")
|
||||||
c.gpBufferData = g.get("glBufferData")
|
c.gpBufferData = g.get("glBufferData")
|
||||||
c.gpBufferSubData = g.get("glBufferSubData")
|
c.gpBufferSubData = g.get("glBufferSubData")
|
||||||
c.gpCheckFramebufferStatusEXT = g.get("glCheckFramebufferStatusEXT")
|
c.gpCheckFramebufferStatus = g.get("glCheckFramebufferStatus")
|
||||||
c.gpClear = g.get("glClear")
|
c.gpClear = g.get("glClear")
|
||||||
c.gpColorMask = g.get("glColorMask")
|
c.gpColorMask = g.get("glColorMask")
|
||||||
c.gpCompileShader = g.get("glCompileShader")
|
c.gpCompileShader = g.get("glCompileShader")
|
||||||
c.gpCreateProgram = g.get("glCreateProgram")
|
c.gpCreateProgram = g.get("glCreateProgram")
|
||||||
c.gpCreateShader = g.get("glCreateShader")
|
c.gpCreateShader = g.get("glCreateShader")
|
||||||
c.gpDeleteBuffers = g.get("glDeleteBuffers")
|
c.gpDeleteBuffers = g.get("glDeleteBuffers")
|
||||||
c.gpDeleteFramebuffersEXT = g.get("glDeleteFramebuffersEXT")
|
c.gpDeleteFramebuffers = g.get("glDeleteFramebuffers")
|
||||||
c.gpDeleteProgram = g.get("glDeleteProgram")
|
c.gpDeleteProgram = g.get("glDeleteProgram")
|
||||||
c.gpDeleteRenderbuffersEXT = g.get("glDeleteRenderbuffersEXT")
|
c.gpDeleteRenderbuffers = g.get("glDeleteRenderbuffers")
|
||||||
c.gpDeleteShader = g.get("glDeleteShader")
|
c.gpDeleteShader = g.get("glDeleteShader")
|
||||||
c.gpDeleteTextures = g.get("glDeleteTextures")
|
c.gpDeleteTextures = g.get("glDeleteTextures")
|
||||||
|
c.gpDeleteVertexArrays = g.get("glDeleteVertexArrays")
|
||||||
c.gpDisable = g.get("glDisable")
|
c.gpDisable = g.get("glDisable")
|
||||||
c.gpDisableVertexAttribArray = g.get("glDisableVertexAttribArray")
|
c.gpDisableVertexAttribArray = g.get("glDisableVertexAttribArray")
|
||||||
c.gpDrawElements = g.get("glDrawElements")
|
c.gpDrawElements = g.get("glDrawElements")
|
||||||
c.gpEnable = g.get("glEnable")
|
c.gpEnable = g.get("glEnable")
|
||||||
c.gpEnableVertexAttribArray = g.get("glEnableVertexAttribArray")
|
c.gpEnableVertexAttribArray = g.get("glEnableVertexAttribArray")
|
||||||
c.gpFlush = g.get("glFlush")
|
c.gpFlush = g.get("glFlush")
|
||||||
c.gpFramebufferRenderbufferEXT = g.get("glFramebufferRenderbufferEXT")
|
c.gpFramebufferRenderbuffer = g.get("glFramebufferRenderbuffer")
|
||||||
c.gpFramebufferTexture2DEXT = g.get("glFramebufferTexture2DEXT")
|
c.gpFramebufferTexture2D = g.get("glFramebufferTexture2D")
|
||||||
c.gpGenBuffers = g.get("glGenBuffers")
|
c.gpGenBuffers = g.get("glGenBuffers")
|
||||||
c.gpGenFramebuffersEXT = g.get("glGenFramebuffersEXT")
|
c.gpGenFramebuffers = g.get("glGenFramebuffers")
|
||||||
c.gpGenRenderbuffersEXT = g.get("glGenRenderbuffersEXT")
|
c.gpGenRenderbuffers = g.get("glGenRenderbuffers")
|
||||||
c.gpGenTextures = g.get("glGenTextures")
|
c.gpGenTextures = g.get("glGenTextures")
|
||||||
|
c.gpGenVertexArrays = g.get("glGenVertexArrays")
|
||||||
c.gpGetError = g.get("glGetError")
|
c.gpGetError = g.get("glGetError")
|
||||||
c.gpGetIntegerv = g.get("glGetIntegerv")
|
c.gpGetIntegerv = g.get("glGetIntegerv")
|
||||||
c.gpGetProgramInfoLog = g.get("glGetProgramInfoLog")
|
c.gpGetProgramInfoLog = g.get("glGetProgramInfoLog")
|
||||||
@ -505,14 +525,14 @@ func (c *defaultContext) LoadFunctions() error {
|
|||||||
c.gpGetShaderInfoLog = g.get("glGetShaderInfoLog")
|
c.gpGetShaderInfoLog = g.get("glGetShaderInfoLog")
|
||||||
c.gpGetShaderiv = g.get("glGetShaderiv")
|
c.gpGetShaderiv = g.get("glGetShaderiv")
|
||||||
c.gpGetUniformLocation = g.get("glGetUniformLocation")
|
c.gpGetUniformLocation = g.get("glGetUniformLocation")
|
||||||
c.gpIsFramebufferEXT = g.get("glIsFramebufferEXT")
|
c.gpIsFramebuffer = g.get("glIsFramebuffer")
|
||||||
c.gpIsProgram = g.get("glIsProgram")
|
c.gpIsProgram = g.get("glIsProgram")
|
||||||
c.gpIsRenderbufferEXT = g.get("glIsRenderbufferEXT")
|
c.gpIsRenderbuffer = g.get("glIsRenderbuffer")
|
||||||
c.gpIsTexture = g.get("glIsTexture")
|
c.gpIsTexture = g.get("glIsTexture")
|
||||||
c.gpLinkProgram = g.get("glLinkProgram")
|
c.gpLinkProgram = g.get("glLinkProgram")
|
||||||
c.gpPixelStorei = g.get("glPixelStorei")
|
c.gpPixelStorei = g.get("glPixelStorei")
|
||||||
c.gpReadPixels = g.get("glReadPixels")
|
c.gpReadPixels = g.get("glReadPixels")
|
||||||
c.gpRenderbufferStorageEXT = g.get("glRenderbufferStorageEXT")
|
c.gpRenderbufferStorage = g.get("glRenderbufferStorage")
|
||||||
c.gpScissor = g.get("glScissor")
|
c.gpScissor = g.get("glScissor")
|
||||||
c.gpShaderSource = g.get("glShaderSource")
|
c.gpShaderSource = g.get("glShaderSource")
|
||||||
c.gpStencilFunc = g.get("glStencilFunc")
|
c.gpStencilFunc = g.get("glStencilFunc")
|
||||||
|
@ -71,6 +71,10 @@ func (g *gomobileContext) BindTexture(target uint32, texture uint32) {
|
|||||||
g.ctx.BindTexture(gl.Enum(target), gl.Texture{Value: texture})
|
g.ctx.BindTexture(gl.Enum(target), gl.Texture{Value: texture})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (g *gomobileContext) BindVertexArray(array uint32) {
|
||||||
|
g.ctx.BindVertexArray(gl.VertexArray{Value: array})
|
||||||
|
}
|
||||||
|
|
||||||
func (g *gomobileContext) BlendEquationSeparate(modeRGB uint32, modeAlpha uint32) {
|
func (g *gomobileContext) BlendEquationSeparate(modeRGB uint32, modeAlpha uint32) {
|
||||||
g.ctx.BlendEquationSeparate(gl.Enum(modeRGB), gl.Enum(modeAlpha))
|
g.ctx.BlendEquationSeparate(gl.Enum(modeRGB), gl.Enum(modeAlpha))
|
||||||
}
|
}
|
||||||
@ -127,6 +131,10 @@ func (g *gomobileContext) CreateTexture() uint32 {
|
|||||||
return g.ctx.CreateTexture().Value
|
return g.ctx.CreateTexture().Value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (g *gomobileContext) CreateVertexArray() uint32 {
|
||||||
|
return g.ctx.CreateVertexArray().Value
|
||||||
|
}
|
||||||
|
|
||||||
func (g *gomobileContext) DeleteBuffer(buffer uint32) {
|
func (g *gomobileContext) DeleteBuffer(buffer uint32) {
|
||||||
g.ctx.DeleteBuffer(gl.Buffer{Value: buffer})
|
g.ctx.DeleteBuffer(gl.Buffer{Value: buffer})
|
||||||
}
|
}
|
||||||
@ -151,6 +159,10 @@ func (g *gomobileContext) DeleteTexture(texture uint32) {
|
|||||||
g.ctx.DeleteTexture(gl.Texture{Value: texture})
|
g.ctx.DeleteTexture(gl.Texture{Value: texture})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (g *gomobileContext) DeleteVertexArray(texture uint32) {
|
||||||
|
g.ctx.DeleteVertexArray(gl.VertexArray{Value: texture})
|
||||||
|
}
|
||||||
|
|
||||||
func (g *gomobileContext) Disable(cap uint32) {
|
func (g *gomobileContext) Disable(cap uint32) {
|
||||||
g.ctx.Disable(gl.Enum(cap))
|
g.ctx.Disable(gl.Enum(cap))
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@ type Context interface {
|
|||||||
BindFramebuffer(target uint32, framebuffer uint32)
|
BindFramebuffer(target uint32, framebuffer uint32)
|
||||||
BindRenderbuffer(target uint32, renderbuffer uint32)
|
BindRenderbuffer(target uint32, renderbuffer uint32)
|
||||||
BindTexture(target uint32, texture uint32)
|
BindTexture(target uint32, texture uint32)
|
||||||
|
BindVertexArray(array uint32)
|
||||||
BlendEquationSeparate(modeRGB uint32, modeAlpha uint32)
|
BlendEquationSeparate(modeRGB uint32, modeAlpha uint32)
|
||||||
BlendFuncSeparate(srcRGB uint32, dstRGB uint32, srcAlpha uint32, dstAlpha uint32)
|
BlendFuncSeparate(srcRGB uint32, dstRGB uint32, srcAlpha uint32, dstAlpha uint32)
|
||||||
BufferInit(target uint32, size int, usage uint32)
|
BufferInit(target uint32, size int, usage uint32)
|
||||||
@ -46,12 +47,14 @@ type Context interface {
|
|||||||
CreateRenderbuffer() uint32
|
CreateRenderbuffer() uint32
|
||||||
CreateShader(xtype uint32) uint32
|
CreateShader(xtype uint32) uint32
|
||||||
CreateTexture() uint32
|
CreateTexture() uint32
|
||||||
|
CreateVertexArray() uint32
|
||||||
DeleteBuffer(buffer uint32)
|
DeleteBuffer(buffer uint32)
|
||||||
DeleteFramebuffer(framebuffer uint32)
|
DeleteFramebuffer(framebuffer uint32)
|
||||||
DeleteProgram(program uint32)
|
DeleteProgram(program uint32)
|
||||||
DeleteRenderbuffer(renderbuffer uint32)
|
DeleteRenderbuffer(renderbuffer uint32)
|
||||||
DeleteShader(shader uint32)
|
DeleteShader(shader uint32)
|
||||||
DeleteTexture(textures uint32)
|
DeleteTexture(texture uint32)
|
||||||
|
DeleteVertexArray(array uint32)
|
||||||
Disable(cap uint32)
|
Disable(cap uint32)
|
||||||
DisableVertexAttribArray(index uint32)
|
DisableVertexAttribArray(index uint32)
|
||||||
DrawElements(mode uint32, count int32, xtype uint32, offset int)
|
DrawElements(mode uint32, count int32, xtype uint32, offset int)
|
||||||
|
@ -16,7 +16,6 @@ package gl
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/ebitengine/purego"
|
"github.com/ebitengine/purego"
|
||||||
)
|
)
|
||||||
@ -44,9 +43,6 @@ func (c *defaultContext) init() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *defaultContext) getProcAddress(name string) (uintptr, error) {
|
func (c *defaultContext) getProcAddress(name string) (uintptr, error) {
|
||||||
if c.isES {
|
|
||||||
name = strings.TrimSuffix(name, "EXT")
|
|
||||||
}
|
|
||||||
proc, err := purego.Dlsym(opengl, name)
|
proc, err := purego.Dlsym(opengl, name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
|
@ -108,7 +108,6 @@ func getProcAddressGL(name string) uintptr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getProcAddressGLES(name string) uintptr {
|
func getProcAddressGLES(name string) uintptr {
|
||||||
name = strings.TrimSuffix(name, "EXT")
|
|
||||||
cname := C.CString(name)
|
cname := C.CString(name)
|
||||||
defer C.free(unsafe.Pointer(cname))
|
defer C.free(unsafe.Pointer(cname))
|
||||||
return uintptr(C.getProcAddressGLES(libGLES, cname))
|
return uintptr(C.getProcAddressGLES(libGLES, cname))
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
package opengl
|
package opengl
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"runtime"
|
||||||
|
|
||||||
"github.com/hajimehoshi/ebiten/v2/internal/glfw"
|
"github.com/hajimehoshi/ebiten/v2/internal/glfw"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -30,6 +32,11 @@ func (g *Graphics) SetGLFWClientAPI() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
glfw.WindowHint(glfw.ClientAPI, glfw.OpenGLAPI)
|
glfw.WindowHint(glfw.ClientAPI, glfw.OpenGLAPI)
|
||||||
glfw.WindowHint(glfw.ContextVersionMajor, 2)
|
glfw.WindowHint(glfw.ContextVersionMajor, 3)
|
||||||
glfw.WindowHint(glfw.ContextVersionMinor, 1)
|
glfw.WindowHint(glfw.ContextVersionMinor, 2)
|
||||||
|
// macOS requires forward-compatible and a core profile.
|
||||||
|
if runtime.GOOS == "darwin" {
|
||||||
|
glfw.WindowHint(glfw.OpenGLForwardCompatible, glfw.True)
|
||||||
|
glfw.WindowHint(glfw.OpenGLProfile, glfw.OpenGLCoreProfile)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,6 +112,8 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type openGLState struct {
|
type openGLState struct {
|
||||||
|
vertexArray uint32
|
||||||
|
|
||||||
// arrayBuffer is OpenGL's array buffer (vertices data).
|
// arrayBuffer is OpenGL's array buffer (vertices data).
|
||||||
arrayBuffer buffer
|
arrayBuffer buffer
|
||||||
|
|
||||||
@ -148,11 +150,16 @@ func (s *openGLState) reset(context *context) error {
|
|||||||
if s.elementArrayBuffer != 0 {
|
if s.elementArrayBuffer != 0 {
|
||||||
context.ctx.DeleteBuffer(uint32(s.elementArrayBuffer))
|
context.ctx.DeleteBuffer(uint32(s.elementArrayBuffer))
|
||||||
}
|
}
|
||||||
|
if s.vertexArray != 0 {
|
||||||
|
context.ctx.DeleteVertexArray(s.vertexArray)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
s.arrayBuffer = 0
|
s.arrayBuffer = 0
|
||||||
s.arrayBufferSizeInBytes = 0
|
s.arrayBufferSizeInBytes = 0
|
||||||
s.elementArrayBuffer = 0
|
s.elementArrayBuffer = 0
|
||||||
s.elementArrayBufferSizeInBytes = 0
|
s.elementArrayBufferSizeInBytes = 0
|
||||||
|
s.vertexArray = 0
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -170,6 +177,11 @@ func pow2(x int) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *openGLState) setVertices(context *context, vertices []float32, indices []uint16) {
|
func (s *openGLState) setVertices(context *context, vertices []float32, indices []uint16) {
|
||||||
|
if s.vertexArray == 0 {
|
||||||
|
s.vertexArray = context.ctx.CreateVertexArray()
|
||||||
|
}
|
||||||
|
context.ctx.BindVertexArray(s.vertexArray)
|
||||||
|
|
||||||
if size := len(vertices) * 4; s.arrayBufferSizeInBytes < size {
|
if size := len(vertices) * 4; s.arrayBufferSizeInBytes < size {
|
||||||
if s.arrayBuffer != 0 {
|
if s.arrayBuffer != 0 {
|
||||||
context.ctx.DeleteBuffer(uint32(s.arrayBuffer))
|
context.ctx.DeleteBuffer(uint32(s.arrayBuffer))
|
||||||
|
2
internal/shader/testdata/for5.expected.fs
vendored
2
internal/shader/testdata/for5.expected.fs
vendored
@ -29,5 +29,5 @@ vec4 F1(in vec4 l0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
gl_FragColor = F1(gl_FragCoord);
|
fragColor = F1(gl_FragCoord);
|
||||||
}
|
}
|
||||||
|
2
internal/shader/testdata/for5.expected.vs
vendored
2
internal/shader/testdata/for5.expected.vs
vendored
@ -1,7 +1,7 @@
|
|||||||
uniform float U0;
|
uniform float U0;
|
||||||
uniform float U1;
|
uniform float U1;
|
||||||
uniform float U2;
|
uniform float U2;
|
||||||
attribute vec2 A0;
|
in vec2 A0;
|
||||||
|
|
||||||
int F0(in int l0);
|
int F0(in int l0);
|
||||||
|
|
||||||
|
@ -8,5 +8,5 @@ vec4 F0(in vec4 l0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
gl_FragColor = F0(gl_FragCoord);
|
fragColor = F0(gl_FragCoord);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
attribute vec2 A0;
|
in vec2 A0;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
if (true) {
|
if (true) {
|
||||||
|
@ -9,5 +9,5 @@ vec4 F0(in vec4 l0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
gl_FragColor = F0(gl_FragCoord);
|
fragColor = F0(gl_FragCoord);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
attribute vec2 A0;
|
in vec2 A0;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
vec4 l0 = vec4(0);
|
vec4 l0 = vec4(0);
|
||||||
|
@ -15,5 +15,5 @@ vec4 F5(in vec4 l0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
gl_FragColor = F5(gl_FragCoord);
|
fragColor = F5(gl_FragCoord);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
attribute vec2 A0;
|
in vec2 A0;
|
||||||
|
|
||||||
void F0(void);
|
void F0(void);
|
||||||
void F1(void);
|
void F1(void);
|
||||||
|
4
internal/shader/testdata/vertex.expected.fs
vendored
4
internal/shader/testdata/vertex.expected.fs
vendored
@ -1,3 +1,3 @@
|
|||||||
uniform vec2 U0;
|
uniform vec2 U0;
|
||||||
varying vec2 V0;
|
in vec2 V0;
|
||||||
varying vec4 V1;
|
in vec4 V1;
|
||||||
|
10
internal/shader/testdata/vertex.expected.vs
vendored
10
internal/shader/testdata/vertex.expected.vs
vendored
@ -1,9 +1,9 @@
|
|||||||
uniform vec2 U0;
|
uniform vec2 U0;
|
||||||
attribute vec2 A0;
|
in vec2 A0;
|
||||||
attribute vec2 A1;
|
in vec2 A1;
|
||||||
attribute vec4 A2;
|
in vec4 A2;
|
||||||
varying vec2 V0;
|
out vec2 V0;
|
||||||
varying vec4 V1;
|
out vec4 V1;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
mat4 l0 = mat4(0);
|
mat4 l0 = mat4(0);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
uniform vec2 U0;
|
uniform vec2 U0;
|
||||||
varying vec2 V0;
|
in vec2 V0;
|
||||||
varying vec4 V1;
|
in vec4 V1;
|
||||||
|
|
||||||
vec4 F0(in vec4 l0, in vec2 l1, in vec4 l2);
|
vec4 F0(in vec4 l0, in vec2 l1, in vec4 l2);
|
||||||
|
|
||||||
@ -9,5 +9,5 @@ vec4 F0(in vec4 l0, in vec2 l1, in vec4 l2) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
gl_FragColor = F0(gl_FragCoord, V0, V1);
|
fragColor = F0(gl_FragCoord, V0, V1);
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
uniform vec2 U0;
|
uniform vec2 U0;
|
||||||
attribute vec2 A0;
|
in vec2 A0;
|
||||||
attribute vec2 A1;
|
in vec2 A1;
|
||||||
attribute vec4 A2;
|
in vec4 A2;
|
||||||
varying vec2 V0;
|
out vec2 V0;
|
||||||
varying vec4 V1;
|
out vec4 V1;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
mat4 l0 = mat4(0);
|
mat4 l0 = mat4(0);
|
||||||
|
@ -63,7 +63,7 @@ ivec4 modInt(ivec4 x, ivec4 y) {
|
|||||||
func VertexPrelude(version GLSLVersion) string {
|
func VertexPrelude(version GLSLVersion) string {
|
||||||
switch version {
|
switch version {
|
||||||
case GLSLVersionDefault:
|
case GLSLVersionDefault:
|
||||||
return utilFunctions
|
return `#version 150` + "\n\n" + utilFunctions
|
||||||
case GLSLVersionES300:
|
case GLSLVersionES300:
|
||||||
return `#version 300 es`
|
return `#version 300 es`
|
||||||
}
|
}
|
||||||
@ -73,6 +73,8 @@ func VertexPrelude(version GLSLVersion) string {
|
|||||||
func FragmentPrelude(version GLSLVersion) string {
|
func FragmentPrelude(version GLSLVersion) string {
|
||||||
var prefix string
|
var prefix string
|
||||||
switch version {
|
switch version {
|
||||||
|
case GLSLVersionDefault:
|
||||||
|
prefix = `#version 150` + "\n\n"
|
||||||
case GLSLVersionES300:
|
case GLSLVersionES300:
|
||||||
prefix = `#version 300 es` + "\n\n"
|
prefix = `#version 300 es` + "\n\n"
|
||||||
}
|
}
|
||||||
@ -83,7 +85,9 @@ precision highp int;
|
|||||||
#define lowp
|
#define lowp
|
||||||
#define mediump
|
#define mediump
|
||||||
#define highp
|
#define highp
|
||||||
#endif`
|
#endif
|
||||||
|
|
||||||
|
out vec4 fragColor;`
|
||||||
if version == GLSLVersionDefault {
|
if version == GLSLVersionDefault {
|
||||||
prelude += "\n\n" + utilFunctions
|
prelude += "\n\n" + utilFunctions
|
||||||
}
|
}
|
||||||
@ -132,18 +136,10 @@ func Compile(p *shaderir.Program, version GLSLVersion) (vertexShader, fragmentSh
|
|||||||
vslines = append(vslines, fmt.Sprintf("uniform sampler2D T%d;", i))
|
vslines = append(vslines, fmt.Sprintf("uniform sampler2D T%d;", i))
|
||||||
}
|
}
|
||||||
for i, t := range p.Attributes {
|
for i, t := range p.Attributes {
|
||||||
keyword := "attribute"
|
vslines = append(vslines, fmt.Sprintf("in %s;", c.varDecl(p, &t, fmt.Sprintf("A%d", i))))
|
||||||
if version == GLSLVersionES300 {
|
|
||||||
keyword = "in"
|
|
||||||
}
|
|
||||||
vslines = append(vslines, fmt.Sprintf("%s %s;", keyword, c.varDecl(p, &t, fmt.Sprintf("A%d", i))))
|
|
||||||
}
|
}
|
||||||
for i, t := range p.Varyings {
|
for i, t := range p.Varyings {
|
||||||
keyword := "varying"
|
vslines = append(vslines, fmt.Sprintf("out %s;", c.varDecl(p, &t, fmt.Sprintf("V%d", i))))
|
||||||
if version == GLSLVersionES300 {
|
|
||||||
keyword = "out"
|
|
||||||
}
|
|
||||||
vslines = append(vslines, fmt.Sprintf("%s %s;", keyword, c.varDecl(p, &t, fmt.Sprintf("V%d", i))))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,16 +225,9 @@ func Compile(p *shaderir.Program, version GLSLVersion) (vertexShader, fragmentSh
|
|||||||
fslines = append(fslines, fmt.Sprintf("uniform sampler2D T%d;", i))
|
fslines = append(fslines, fmt.Sprintf("uniform sampler2D T%d;", i))
|
||||||
}
|
}
|
||||||
for i, t := range p.Varyings {
|
for i, t := range p.Varyings {
|
||||||
keyword := "varying"
|
fslines = append(fslines, fmt.Sprintf("in %s;", c.varDecl(p, &t, fmt.Sprintf("V%d", i))))
|
||||||
if version == GLSLVersionES300 {
|
|
||||||
keyword = "in"
|
|
||||||
}
|
|
||||||
fslines = append(fslines, fmt.Sprintf("%s %s;", keyword, c.varDecl(p, &t, fmt.Sprintf("V%d", i))))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if version == GLSLVersionES300 {
|
|
||||||
fslines = append(fslines, "out vec4 fragColor;")
|
|
||||||
}
|
|
||||||
|
|
||||||
var funcs []*shaderir.Func
|
var funcs []*shaderir.Func
|
||||||
if p.VertexFunc.Block != nil {
|
if p.VertexFunc.Block != nil {
|
||||||
@ -615,11 +604,7 @@ func (c *compileContext) block(p *shaderir.Program, topBlock, block *shaderir.Bl
|
|||||||
case shaderir.Return:
|
case shaderir.Return:
|
||||||
switch {
|
switch {
|
||||||
case topBlock == p.FragmentFunc.Block:
|
case topBlock == p.FragmentFunc.Block:
|
||||||
token := "gl_FragColor"
|
lines = append(lines, fmt.Sprintf("%sfragColor = %s;", idt, expr(&s.Exprs[0])))
|
||||||
if c.version == GLSLVersionES300 {
|
|
||||||
token = "fragColor"
|
|
||||||
}
|
|
||||||
lines = append(lines, fmt.Sprintf("%s%s = %s;", idt, token, expr(&s.Exprs[0])))
|
|
||||||
// The 'return' statement is not required so far, as the fragment entrypoint has only one sentence so far. See adjustProgram implementation.
|
// The 'return' statement is not required so far, as the fragment entrypoint has only one sentence so far. See adjustProgram implementation.
|
||||||
case len(s.Exprs) == 0:
|
case len(s.Exprs) == 0:
|
||||||
lines = append(lines, idt+"return;")
|
lines = append(lines, idt+"return;")
|
||||||
|
@ -122,10 +122,7 @@ func (c *compileContext) builtinFuncString(f shaderir.BuiltinFunc) string {
|
|||||||
case shaderir.Dfdy:
|
case shaderir.Dfdy:
|
||||||
return "dFdy"
|
return "dFdy"
|
||||||
case shaderir.Texture2DF:
|
case shaderir.Texture2DF:
|
||||||
if c.version == GLSLVersionES300 {
|
return "texture"
|
||||||
return "texture"
|
|
||||||
}
|
|
||||||
return "texture2D"
|
|
||||||
default:
|
default:
|
||||||
return string(f)
|
return string(f)
|
||||||
}
|
}
|
||||||
|
@ -220,11 +220,11 @@ uniform S0 U0;`,
|
|||||||
},
|
},
|
||||||
GlslVS: glslVertexPrelude + `
|
GlslVS: glslVertexPrelude + `
|
||||||
uniform float U0;
|
uniform float U0;
|
||||||
attribute vec2 A0;
|
in vec2 A0;
|
||||||
varying vec3 V0;`,
|
out vec3 V0;`,
|
||||||
GlslFS: glslFragmentPrelude + `
|
GlslFS: glslFragmentPrelude + `
|
||||||
uniform float U0;
|
uniform float U0;
|
||||||
varying vec3 V0;`,
|
in vec3 V0;`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "Func",
|
Name: "Func",
|
||||||
@ -930,11 +930,11 @@ void F0(float l0, float l1, thread float& l2) {
|
|||||||
},
|
},
|
||||||
GlslVS: glslVertexPrelude + `
|
GlslVS: glslVertexPrelude + `
|
||||||
uniform float U0;
|
uniform float U0;
|
||||||
attribute vec4 A0;
|
in vec4 A0;
|
||||||
attribute float A1;
|
in float A1;
|
||||||
attribute vec2 A2;
|
in vec2 A2;
|
||||||
varying float V0;
|
out float V0;
|
||||||
varying vec2 V1;
|
out vec2 V1;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
gl_Position = A0;
|
gl_Position = A0;
|
||||||
@ -943,8 +943,8 @@ void main(void) {
|
|||||||
}`,
|
}`,
|
||||||
GlslFS: glslFragmentPrelude + `
|
GlslFS: glslFragmentPrelude + `
|
||||||
uniform float U0;
|
uniform float U0;
|
||||||
varying float V0;
|
in float V0;
|
||||||
varying vec2 V1;`,
|
in vec2 V1;`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "FragmentFunc",
|
Name: "FragmentFunc",
|
||||||
@ -1002,11 +1002,11 @@ varying vec2 V1;`,
|
|||||||
},
|
},
|
||||||
GlslVS: glslVertexPrelude + `
|
GlslVS: glslVertexPrelude + `
|
||||||
uniform float U0;
|
uniform float U0;
|
||||||
attribute vec4 A0;
|
in vec4 A0;
|
||||||
attribute float A1;
|
in float A1;
|
||||||
attribute vec2 A2;
|
in vec2 A2;
|
||||||
varying float V0;
|
out float V0;
|
||||||
varying vec2 V1;
|
out vec2 V1;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
gl_Position = A0;
|
gl_Position = A0;
|
||||||
@ -1015,8 +1015,8 @@ void main(void) {
|
|||||||
}`,
|
}`,
|
||||||
GlslFS: glslFragmentPrelude + `
|
GlslFS: glslFragmentPrelude + `
|
||||||
uniform float U0;
|
uniform float U0;
|
||||||
varying float V0;
|
in float V0;
|
||||||
varying vec2 V1;
|
in vec2 V1;
|
||||||
|
|
||||||
vec4 F0(in vec4 l0, in float l1, in vec2 l2);
|
vec4 F0(in vec4 l0, in float l1, in vec2 l2);
|
||||||
|
|
||||||
@ -1029,7 +1029,7 @@ vec4 F0(in vec4 l0, in float l1, in vec2 l2) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
gl_FragColor = F0(gl_FragCoord, V0, V1);
|
fragColor = F0(gl_FragCoord, V0, V1);
|
||||||
}`,
|
}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -71,8 +71,8 @@ func (e *egl) init(nativeWindowHandle C.NativeWindowType) error {
|
|||||||
// Create new context and set it as current.
|
// Create new context and set it as current.
|
||||||
contextAttribs := []C.EGLint{
|
contextAttribs := []C.EGLint{
|
||||||
// Set target graphics api version.
|
// Set target graphics api version.
|
||||||
C.EGL_CONTEXT_MAJOR_VERSION, 2,
|
C.EGL_CONTEXT_MAJOR_VERSION, 3,
|
||||||
C.EGL_CONTEXT_MINOR_VERSION, 1,
|
C.EGL_CONTEXT_MINOR_VERSION, 2,
|
||||||
// For debug callback
|
// For debug callback
|
||||||
C.EGL_CONTEXT_FLAGS_KHR, C.EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR,
|
C.EGL_CONTEXT_FLAGS_KHR, C.EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR,
|
||||||
C.EGL_NONE}
|
C.EGL_NONE}
|
||||||
|
Loading…
Reference in New Issue
Block a user