mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
internal/graphicsdriver/opengl: Add APIs for stencil buffers
Updates #1684
This commit is contained in:
parent
b8bf277825
commit
5c4d3325f6
@ -24,11 +24,13 @@ const (
|
||||
ONE_MINUS_DST_ALPHA = 0x0305
|
||||
DST_COLOR = 0x0306
|
||||
|
||||
ALWAYS = 0x0207
|
||||
ARRAY_BUFFER = 0x8892
|
||||
BLEND = 0x0BE2
|
||||
CLAMP_TO_EDGE = 0x812F
|
||||
COLOR_ATTACHMENT0 = 0x8CE0
|
||||
COMPILE_STATUS = 0x8B81
|
||||
DEPTH24_STENCIL8 = 0x88F0
|
||||
DYNAMIC_DRAW = 0x88E8
|
||||
ELEMENT_ARRAY_BUFFER = 0x8893
|
||||
FALSE = 0
|
||||
@ -38,15 +40,22 @@ const (
|
||||
FRAMEBUFFER_BINDING = 0x8CA6
|
||||
FRAMEBUFFER_COMPLETE = 0x8CD5
|
||||
INFO_LOG_LENGTH = 0x8B84
|
||||
INVERT = 0x150A
|
||||
KEEP = 0x1E00
|
||||
LINK_STATUS = 0x8B82
|
||||
MAX_TEXTURE_SIZE = 0x0D33
|
||||
NEAREST = 0x2600
|
||||
NO_ERROR = 0
|
||||
NOTEQUAL = 0x0205
|
||||
PIXEL_PACK_BUFFER = 0x88EB
|
||||
PIXEL_UNPACK_BUFFER = 0x88EC
|
||||
READ_WRITE = 0x88BA
|
||||
RENDERBUFFER = 0x8D41
|
||||
RGBA = 0x1908
|
||||
SHORT = 0x1402
|
||||
STENCIL_ATTACHMENT = 0x8D20
|
||||
STENCIL_BUFFER_BIT = 0x0400
|
||||
STENCIL_TEST = 0x0B90
|
||||
STREAM_DRAW = 0x88E0
|
||||
TEXTURE0 = 0x84C0
|
||||
TEXTURE_2D = 0x0DE1
|
||||
|
@ -101,27 +101,34 @@ package gl
|
||||
// typedef void (APIENTRYP GPBINDATTRIBLOCATION)(GLuint program, GLuint index, const GLchar * name);
|
||||
// typedef void (APIENTRYP GPBINDBUFFER)(GLenum target, GLuint buffer);
|
||||
// typedef void (APIENTRYP GPBINDFRAMEBUFFEREXT)(GLenum target, GLuint framebuffer);
|
||||
// typedef void (APIENTRYP GPBINDRENDERBUFFEREXT)(GLenum target, GLuint renderbuffer);
|
||||
// typedef void (APIENTRYP GPBINDTEXTURE)(GLenum target, GLuint texture);
|
||||
// typedef void (APIENTRYP GPBLENDFUNC)(GLenum sfactor, GLenum dfactor);
|
||||
// typedef void (APIENTRYP GPBUFFERDATA)(GLenum target, GLsizeiptr size, const void * data, GLenum usage);
|
||||
// typedef void (APIENTRYP GPBUFFERSUBDATA)(GLenum target, GLintptr offset, GLsizeiptr size, const void * data);
|
||||
// typedef GLenum (APIENTRYP GPCHECKFRAMEBUFFERSTATUSEXT)(GLenum target);
|
||||
// typedef void (APIENTRYP GPCLEAR)(GLbitfield mask);
|
||||
// typedef void (APIENTRYP GPCOLORMASK)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
|
||||
// typedef void (APIENTRYP GPCOMPILESHADER)(GLuint shader);
|
||||
// typedef GLuint (APIENTRYP GPCREATEPROGRAM)();
|
||||
// typedef GLuint (APIENTRYP GPCREATESHADER)(GLenum type);
|
||||
// typedef void (APIENTRYP GPDELETEBUFFERS)(GLsizei n, const GLuint * buffers);
|
||||
// typedef void (APIENTRYP GPDELETEFRAMEBUFFERSEXT)(GLsizei n, const GLuint * framebuffers);
|
||||
// typedef void (APIENTRYP GPDELETEPROGRAM)(GLuint program);
|
||||
// typedef void (APIENTRYP GPDELETERENDERBUFFERSEXT)(GLsizei n, const GLuint * renderbuffers);
|
||||
// typedef void (APIENTRYP GPDELETESHADER)(GLuint shader);
|
||||
// typedef void (APIENTRYP GPDELETETEXTURES)(GLsizei n, const GLuint * textures);
|
||||
// typedef void (APIENTRYP GPDISABLE)(GLenum cap);
|
||||
// typedef void (APIENTRYP GPDISABLEVERTEXATTRIBARRAY)(GLuint index);
|
||||
// typedef void (APIENTRYP GPDRAWELEMENTS)(GLenum mode, GLsizei count, GLenum type, const uintptr_t indices);
|
||||
// typedef void (APIENTRYP GPENABLE)(GLenum cap);
|
||||
// typedef void (APIENTRYP GPENABLEVERTEXATTRIBARRAY)(GLuint index);
|
||||
// typedef void (APIENTRYP GPFLUSH)();
|
||||
// typedef void (APIENTRYP GPFRAMEBUFFERRENDERBUFFEREXT)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
||||
// typedef void (APIENTRYP GPFRAMEBUFFERTEXTURE2DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
// typedef void (APIENTRYP GPGENBUFFERS)(GLsizei n, GLuint * buffers);
|
||||
// typedef void (APIENTRYP GPGENFRAMEBUFFERSEXT)(GLsizei n, GLuint * framebuffers);
|
||||
// typedef void (APIENTRYP GPGENRENDERBUFFERSEXT)(GLsizei n, GLuint * renderbuffers);
|
||||
// typedef void (APIENTRYP GPGENTEXTURES)(GLsizei n, GLuint * textures);
|
||||
// typedef void (APIENTRYP GPGETBUFFERSUBDATA)(GLenum target, GLintptr offset, GLsizeiptr size, void * data);
|
||||
// typedef void (APIENTRYP GPGETDOUBLEI_V)(GLenum target, GLuint index, GLdouble * data);
|
||||
@ -145,12 +152,16 @@ package gl
|
||||
// typedef void (APIENTRYP GPGETVERTEXARRAYPOINTERI_VEXT)(GLuint vaobj, GLuint index, GLenum pname, void ** param);
|
||||
// typedef GLboolean (APIENTRYP GPISFRAMEBUFFEREXT)(GLuint framebuffer);
|
||||
// typedef GLboolean (APIENTRYP GPISPROGRAM)(GLuint program);
|
||||
// typedef GLboolean (APIENTRYP GPISRENDERBUFFEREXT)(GLuint renderbuffer);
|
||||
// typedef GLboolean (APIENTRYP GPISTEXTURE)(GLuint texture);
|
||||
// typedef void (APIENTRYP GPLINKPROGRAM)(GLuint program);
|
||||
// typedef void (APIENTRYP GPPIXELSTOREI)(GLenum pname, GLint param);
|
||||
// typedef void (APIENTRYP GPREADPIXELS)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void * pixels);
|
||||
// typedef void (APIENTRYP GPRENDERBUFFERSTORAGEEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
// typedef void (APIENTRYP GPSCISSOR)(GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
// typedef void (APIENTRYP GPSHADERSOURCE)(GLuint shader, GLsizei count, const GLchar *const* string, const GLint * length);
|
||||
// typedef void (APIENTRYP GPSTENCILFUNC)(GLenum func, GLint ref, GLuint mask);
|
||||
// typedef void (APIENTRYP GPSTENCILOP)(GLenum fail, GLenum zfail, GLenum zpass);
|
||||
// typedef void (APIENTRYP GPTEXIMAGE2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void * pixels);
|
||||
// typedef void (APIENTRYP GPTEXPARAMETERI)(GLenum target, GLenum pname, GLint param);
|
||||
// typedef void (APIENTRYP GPTEXSUBIMAGE2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void * pixels);
|
||||
@ -182,6 +193,9 @@ package gl
|
||||
// static void glowBindFramebufferEXT(GPBINDFRAMEBUFFEREXT fnptr, GLenum target, GLuint framebuffer) {
|
||||
// (*fnptr)(target, framebuffer);
|
||||
// }
|
||||
// static void glowBindRenderbufferEXT(GPBINDRENDERBUFFEREXT fnptr, GLenum target, GLuint renderbuffer) {
|
||||
// (*fnptr)(target, renderbuffer);
|
||||
// }
|
||||
// static void glowBindTexture(GPBINDTEXTURE fnptr, GLenum target, GLuint texture) {
|
||||
// (*fnptr)(target, texture);
|
||||
// }
|
||||
@ -197,6 +211,12 @@ package gl
|
||||
// static GLenum glowCheckFramebufferStatusEXT(GPCHECKFRAMEBUFFERSTATUSEXT fnptr, GLenum target) {
|
||||
// return (*fnptr)(target);
|
||||
// }
|
||||
// static void glowClear(GPCLEAR fnptr, GLbitfield mask) {
|
||||
// (*fnptr)(mask);
|
||||
// }
|
||||
// static void glowColorMask(GPCOLORMASK fnptr, GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) {
|
||||
// (*fnptr)(red, green, blue, alpha);
|
||||
// }
|
||||
// static void glowCompileShader(GPCOMPILESHADER fnptr, GLuint shader) {
|
||||
// (*fnptr)(shader);
|
||||
// }
|
||||
@ -215,12 +235,18 @@ package gl
|
||||
// static void glowDeleteProgram(GPDELETEPROGRAM fnptr, GLuint program) {
|
||||
// (*fnptr)(program);
|
||||
// }
|
||||
// static void glowDeleteRenderbuffersEXT(GPDELETERENDERBUFFERSEXT fnptr, GLsizei n, const GLuint * renderbuffers) {
|
||||
// (*fnptr)(n, renderbuffers);
|
||||
// }
|
||||
// static void glowDeleteShader(GPDELETESHADER fnptr, GLuint shader) {
|
||||
// (*fnptr)(shader);
|
||||
// }
|
||||
// static void glowDeleteTextures(GPDELETETEXTURES fnptr, GLsizei n, const GLuint * textures) {
|
||||
// (*fnptr)(n, textures);
|
||||
// }
|
||||
// static void glowDisable(GPDISABLE fnptr, GLenum cap) {
|
||||
// (*fnptr)(cap);
|
||||
// }
|
||||
// static void glowDisableVertexAttribArray(GPDISABLEVERTEXATTRIBARRAY fnptr, GLuint index) {
|
||||
// (*fnptr)(index);
|
||||
// }
|
||||
@ -236,6 +262,9 @@ package gl
|
||||
// static void glowFlush(GPFLUSH fnptr) {
|
||||
// (*fnptr)();
|
||||
// }
|
||||
// static void glowFramebufferRenderbufferEXT(GPFRAMEBUFFERRENDERBUFFEREXT fnptr, GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) {
|
||||
// (*fnptr)(target, attachment, renderbuffertarget, renderbuffer);
|
||||
// }
|
||||
// static void glowFramebufferTexture2DEXT(GPFRAMEBUFFERTEXTURE2DEXT fnptr, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) {
|
||||
// (*fnptr)(target, attachment, textarget, texture, level);
|
||||
// }
|
||||
@ -245,6 +274,9 @@ package gl
|
||||
// static void glowGenFramebuffersEXT(GPGENFRAMEBUFFERSEXT fnptr, GLsizei n, GLuint * framebuffers) {
|
||||
// (*fnptr)(n, framebuffers);
|
||||
// }
|
||||
// static void glowGenRenderbuffersEXT(GPGENRENDERBUFFERSEXT fnptr, GLsizei n, GLuint * renderbuffers) {
|
||||
// (*fnptr)(n, renderbuffers);
|
||||
// }
|
||||
// static void glowGenTextures(GPGENTEXTURES fnptr, GLsizei n, GLuint * textures) {
|
||||
// (*fnptr)(n, textures);
|
||||
// }
|
||||
@ -314,6 +346,9 @@ package gl
|
||||
// static GLboolean glowIsProgram(GPISPROGRAM fnptr, GLuint program) {
|
||||
// return (*fnptr)(program);
|
||||
// }
|
||||
// static GLboolean glowIsRenderbufferEXT(GPISRENDERBUFFEREXT fnptr, GLuint renderbuffer) {
|
||||
// return (*fnptr)(renderbuffer);
|
||||
// }
|
||||
// static GLboolean glowIsTexture(GPISTEXTURE fnptr, GLuint texture) {
|
||||
// return (*fnptr)(texture);
|
||||
// }
|
||||
@ -326,12 +361,21 @@ package gl
|
||||
// static void glowReadPixels(GPREADPIXELS fnptr, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void * pixels) {
|
||||
// (*fnptr)(x, y, width, height, format, type, pixels);
|
||||
// }
|
||||
// static void glowRenderbufferStorageEXT(GPRENDERBUFFERSTORAGEEXT fnptr, GLenum target, GLenum internalformat, GLsizei width, GLsizei height) {
|
||||
// (*fnptr)(target, internalformat, width, height);
|
||||
// }
|
||||
// static void glowScissor(GPSCISSOR fnptr, GLint x, GLint y, GLsizei width, GLsizei height) {
|
||||
// (*fnptr)(x, y, width, height);
|
||||
// }
|
||||
// static void glowShaderSource(GPSHADERSOURCE fnptr, GLuint shader, GLsizei count, const GLchar *const* string, const GLint * length) {
|
||||
// (*fnptr)(shader, count, string, length);
|
||||
// }
|
||||
// static void glowStencilFunc(GPSTENCILFUNC fnptr, GLenum func, GLint ref, GLuint mask) {
|
||||
// (*fnptr)(func, ref, mask);
|
||||
// }
|
||||
// static void glowStencilOp(GPSTENCILOP fnptr, GLenum fail, GLenum zfail, GLenum zpass) {
|
||||
// (*fnptr)(fail, zfail, zpass);
|
||||
// }
|
||||
// static void glowTexImage2D(GPTEXIMAGE2D fnptr, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void * pixels) {
|
||||
// (*fnptr)(target, level, internalformat, width, height, border, format, type, pixels);
|
||||
// }
|
||||
@ -390,27 +434,34 @@ var (
|
||||
gpBindAttribLocation C.GPBINDATTRIBLOCATION
|
||||
gpBindBuffer C.GPBINDBUFFER
|
||||
gpBindFramebufferEXT C.GPBINDFRAMEBUFFEREXT
|
||||
gpBindRenderbufferEXT C.GPBINDRENDERBUFFEREXT
|
||||
gpBindTexture C.GPBINDTEXTURE
|
||||
gpBlendFunc C.GPBLENDFUNC
|
||||
gpBufferData C.GPBUFFERDATA
|
||||
gpBufferSubData C.GPBUFFERSUBDATA
|
||||
gpCheckFramebufferStatusEXT C.GPCHECKFRAMEBUFFERSTATUSEXT
|
||||
gpClear C.GPCLEAR
|
||||
gpColorMask C.GPCOLORMASK
|
||||
gpCompileShader C.GPCOMPILESHADER
|
||||
gpCreateProgram C.GPCREATEPROGRAM
|
||||
gpCreateShader C.GPCREATESHADER
|
||||
gpDeleteBuffers C.GPDELETEBUFFERS
|
||||
gpDeleteFramebuffersEXT C.GPDELETEFRAMEBUFFERSEXT
|
||||
gpDeleteProgram C.GPDELETEPROGRAM
|
||||
gpDeleteRenderbuffersEXT C.GPDELETERENDERBUFFERSEXT
|
||||
gpDeleteShader C.GPDELETESHADER
|
||||
gpDeleteTextures C.GPDELETETEXTURES
|
||||
gpDisable C.GPDISABLE
|
||||
gpDisableVertexAttribArray C.GPDISABLEVERTEXATTRIBARRAY
|
||||
gpDrawElements C.GPDRAWELEMENTS
|
||||
gpEnable C.GPENABLE
|
||||
gpEnableVertexAttribArray C.GPENABLEVERTEXATTRIBARRAY
|
||||
gpFlush C.GPFLUSH
|
||||
gpFramebufferRenderbufferEXT C.GPFRAMEBUFFERRENDERBUFFEREXT
|
||||
gpFramebufferTexture2DEXT C.GPFRAMEBUFFERTEXTURE2DEXT
|
||||
gpGenBuffers C.GPGENBUFFERS
|
||||
gpGenFramebuffersEXT C.GPGENFRAMEBUFFERSEXT
|
||||
gpGenRenderbuffersEXT C.GPGENRENDERBUFFERSEXT
|
||||
gpGenTextures C.GPGENTEXTURES
|
||||
gpGetBufferSubData C.GPGETBUFFERSUBDATA
|
||||
gpGetDoublei_v C.GPGETDOUBLEI_V
|
||||
@ -434,12 +485,16 @@ var (
|
||||
gpGetVertexArrayPointeri_vEXT C.GPGETVERTEXARRAYPOINTERI_VEXT
|
||||
gpIsFramebufferEXT C.GPISFRAMEBUFFEREXT
|
||||
gpIsProgram C.GPISPROGRAM
|
||||
gpIsRenderbufferEXT C.GPISRENDERBUFFEREXT
|
||||
gpIsTexture C.GPISTEXTURE
|
||||
gpLinkProgram C.GPLINKPROGRAM
|
||||
gpPixelStorei C.GPPIXELSTOREI
|
||||
gpReadPixels C.GPREADPIXELS
|
||||
gpRenderbufferStorageEXT C.GPRENDERBUFFERSTORAGEEXT
|
||||
gpScissor C.GPSCISSOR
|
||||
gpShaderSource C.GPSHADERSOURCE
|
||||
gpStencilFunc C.GPSTENCILFUNC
|
||||
gpStencilOp C.GPSTENCILOP
|
||||
gpTexImage2D C.GPTEXIMAGE2D
|
||||
gpTexParameteri C.GPTEXPARAMETERI
|
||||
gpTexSubImage2D C.GPTEXSUBIMAGE2D
|
||||
@ -484,6 +539,10 @@ func BindFramebufferEXT(target uint32, framebuffer uint32) {
|
||||
C.glowBindFramebufferEXT(gpBindFramebufferEXT, (C.GLenum)(target), (C.GLuint)(framebuffer))
|
||||
}
|
||||
|
||||
func BindRenderbufferEXT(target uint32, renderbuffer uint32) {
|
||||
C.glowBindRenderbufferEXT(gpBindRenderbufferEXT, (C.GLenum)(target), (C.GLuint)(renderbuffer))
|
||||
}
|
||||
|
||||
func BindTexture(target uint32, texture uint32) {
|
||||
C.glowBindTexture(gpBindTexture, (C.GLenum)(target), (C.GLuint)(texture))
|
||||
}
|
||||
@ -505,6 +564,14 @@ func CheckFramebufferStatusEXT(target uint32) uint32 {
|
||||
return (uint32)(ret)
|
||||
}
|
||||
|
||||
func Clear(mask uint32) {
|
||||
C.glowClear(gpClear, (C.GLbitfield)(mask))
|
||||
}
|
||||
|
||||
func ColorMask(red bool, green bool, blue bool, alpha bool) {
|
||||
C.glowColorMask(gpColorMask, (C.GLboolean)(boolToInt(red)), (C.GLboolean)(boolToInt(green)), (C.GLboolean)(boolToInt(blue)), (C.GLboolean)(boolToInt(alpha)))
|
||||
}
|
||||
|
||||
func CompileShader(shader uint32) {
|
||||
C.glowCompileShader(gpCompileShader, (C.GLuint)(shader))
|
||||
}
|
||||
@ -531,6 +598,10 @@ func DeleteProgram(program uint32) {
|
||||
C.glowDeleteProgram(gpDeleteProgram, (C.GLuint)(program))
|
||||
}
|
||||
|
||||
func DeleteRenderbuffersEXT(n int32, renderbuffers *uint32) {
|
||||
C.glowDeleteRenderbuffersEXT(gpDeleteRenderbuffersEXT, (C.GLsizei)(n), (*C.GLuint)(unsafe.Pointer(renderbuffers)))
|
||||
}
|
||||
|
||||
func DeleteShader(shader uint32) {
|
||||
C.glowDeleteShader(gpDeleteShader, (C.GLuint)(shader))
|
||||
}
|
||||
@ -539,6 +610,10 @@ func DeleteTextures(n int32, textures *uint32) {
|
||||
C.glowDeleteTextures(gpDeleteTextures, (C.GLsizei)(n), (*C.GLuint)(unsafe.Pointer(textures)))
|
||||
}
|
||||
|
||||
func Disable(cap uint32) {
|
||||
C.glowDisable(gpDisable, (C.GLenum)(cap))
|
||||
}
|
||||
|
||||
func DisableVertexAttribArray(index uint32) {
|
||||
C.glowDisableVertexAttribArray(gpDisableVertexAttribArray, (C.GLuint)(index))
|
||||
}
|
||||
@ -559,6 +634,10 @@ func Flush() {
|
||||
C.glowFlush(gpFlush)
|
||||
}
|
||||
|
||||
func FramebufferRenderbufferEXT(target uint32, attachment uint32, renderbuffertarget uint32, renderbuffer uint32) {
|
||||
C.glowFramebufferRenderbufferEXT(gpFramebufferRenderbufferEXT, (C.GLenum)(target), (C.GLenum)(attachment), (C.GLenum)(renderbuffertarget), (C.GLuint)(renderbuffer))
|
||||
}
|
||||
|
||||
func FramebufferTexture2DEXT(target uint32, attachment uint32, textarget uint32, texture uint32, level int32) {
|
||||
C.glowFramebufferTexture2DEXT(gpFramebufferTexture2DEXT, (C.GLenum)(target), (C.GLenum)(attachment), (C.GLenum)(textarget), (C.GLuint)(texture), (C.GLint)(level))
|
||||
}
|
||||
@ -571,6 +650,10 @@ func GenFramebuffersEXT(n int32, framebuffers *uint32) {
|
||||
C.glowGenFramebuffersEXT(gpGenFramebuffersEXT, (C.GLsizei)(n), (*C.GLuint)(unsafe.Pointer(framebuffers)))
|
||||
}
|
||||
|
||||
func GenRenderbuffersEXT(n int32, renderbuffers *uint32) {
|
||||
C.glowGenRenderbuffersEXT(gpGenRenderbuffersEXT, (C.GLsizei)(n), (*C.GLuint)(unsafe.Pointer(renderbuffers)))
|
||||
}
|
||||
|
||||
func GenTextures(n int32, textures *uint32) {
|
||||
C.glowGenTextures(gpGenTextures, (C.GLsizei)(n), (*C.GLuint)(unsafe.Pointer(textures)))
|
||||
}
|
||||
@ -659,6 +742,11 @@ func IsProgram(program uint32) bool {
|
||||
return ret == TRUE
|
||||
}
|
||||
|
||||
func IsRenderbufferEXT(renderbuffer uint32) bool {
|
||||
ret := C.glowIsRenderbufferEXT(gpIsRenderbufferEXT, (C.GLuint)(renderbuffer))
|
||||
return ret == TRUE
|
||||
}
|
||||
|
||||
func IsTexture(texture uint32) bool {
|
||||
ret := C.glowIsTexture(gpIsTexture, (C.GLuint)(texture))
|
||||
return ret == TRUE
|
||||
@ -676,6 +764,10 @@ func ReadPixels(x int32, y int32, width int32, height int32, format uint32, xtyp
|
||||
C.glowReadPixels(gpReadPixels, (C.GLint)(x), (C.GLint)(y), (C.GLsizei)(width), (C.GLsizei)(height), (C.GLenum)(format), (C.GLenum)(xtype), pixels)
|
||||
}
|
||||
|
||||
func RenderbufferStorageEXT(target uint32, internalformat uint32, width int32, height int32) {
|
||||
C.glowRenderbufferStorageEXT(gpRenderbufferStorageEXT, (C.GLenum)(target), (C.GLenum)(internalformat), (C.GLsizei)(width), (C.GLsizei)(height))
|
||||
}
|
||||
|
||||
func Scissor(x int32, y int32, width int32, height int32) {
|
||||
C.glowScissor(gpScissor, (C.GLint)(x), (C.GLint)(y), (C.GLsizei)(width), (C.GLsizei)(height))
|
||||
}
|
||||
@ -684,6 +776,14 @@ func ShaderSource(shader uint32, count int32, xstring **uint8, length *int32) {
|
||||
C.glowShaderSource(gpShaderSource, (C.GLuint)(shader), (C.GLsizei)(count), (**C.GLchar)(unsafe.Pointer(xstring)), (*C.GLint)(unsafe.Pointer(length)))
|
||||
}
|
||||
|
||||
func StencilFunc(xfunc uint32, ref int32, mask uint32) {
|
||||
C.glowStencilFunc(gpStencilFunc, (C.GLenum)(xfunc), (C.GLint)(ref), (C.GLuint)(mask))
|
||||
}
|
||||
|
||||
func StencilOp(fail uint32, zfail uint32, zpass uint32) {
|
||||
C.glowStencilOp(gpStencilOp, (C.GLenum)(fail), (C.GLenum)(zfail), (C.GLenum)(zpass))
|
||||
}
|
||||
|
||||
func TexImage2D(target uint32, level int32, internalformat int32, width int32, height int32, border int32, format uint32, xtype uint32, pixels unsafe.Pointer) {
|
||||
C.glowTexImage2D(gpTexImage2D, (C.GLenum)(target), (C.GLint)(level), (C.GLint)(internalformat), (C.GLsizei)(width), (C.GLsizei)(height), (C.GLint)(border), (C.GLenum)(format), (C.GLenum)(xtype), pixels)
|
||||
}
|
||||
@ -766,6 +866,7 @@ func InitWithProcAddrFunc(getProcAddr func(name string) unsafe.Pointer) error {
|
||||
return errors.New("glBindBuffer")
|
||||
}
|
||||
gpBindFramebufferEXT = (C.GPBINDFRAMEBUFFEREXT)(getProcAddr("glBindFramebufferEXT"))
|
||||
gpBindRenderbufferEXT = (C.GPBINDRENDERBUFFEREXT)(getProcAddr("glBindRenderbufferEXT"))
|
||||
gpBindTexture = (C.GPBINDTEXTURE)(getProcAddr("glBindTexture"))
|
||||
if gpBindTexture == nil {
|
||||
return errors.New("glBindTexture")
|
||||
@ -783,6 +884,14 @@ func InitWithProcAddrFunc(getProcAddr func(name string) unsafe.Pointer) error {
|
||||
return errors.New("glBufferSubData")
|
||||
}
|
||||
gpCheckFramebufferStatusEXT = (C.GPCHECKFRAMEBUFFERSTATUSEXT)(getProcAddr("glCheckFramebufferStatusEXT"))
|
||||
gpClear = (C.GPCLEAR)(getProcAddr("glClear"))
|
||||
if gpClear == nil {
|
||||
return errors.New("glClear")
|
||||
}
|
||||
gpColorMask = (C.GPCOLORMASK)(getProcAddr("glColorMask"))
|
||||
if gpColorMask == nil {
|
||||
return errors.New("glColorMask")
|
||||
}
|
||||
gpCompileShader = (C.GPCOMPILESHADER)(getProcAddr("glCompileShader"))
|
||||
if gpCompileShader == nil {
|
||||
return errors.New("glCompileShader")
|
||||
@ -804,6 +913,7 @@ func InitWithProcAddrFunc(getProcAddr func(name string) unsafe.Pointer) error {
|
||||
if gpDeleteProgram == nil {
|
||||
return errors.New("glDeleteProgram")
|
||||
}
|
||||
gpDeleteRenderbuffersEXT = (C.GPDELETERENDERBUFFERSEXT)(getProcAddr("glDeleteRenderbuffersEXT"))
|
||||
gpDeleteShader = (C.GPDELETESHADER)(getProcAddr("glDeleteShader"))
|
||||
if gpDeleteShader == nil {
|
||||
return errors.New("glDeleteShader")
|
||||
@ -812,6 +922,10 @@ func InitWithProcAddrFunc(getProcAddr func(name string) unsafe.Pointer) error {
|
||||
if gpDeleteTextures == nil {
|
||||
return errors.New("glDeleteTextures")
|
||||
}
|
||||
gpDisable = (C.GPDISABLE)(getProcAddr("glDisable"))
|
||||
if gpDisable == nil {
|
||||
return errors.New("glDisable")
|
||||
}
|
||||
gpDisableVertexAttribArray = (C.GPDISABLEVERTEXATTRIBARRAY)(getProcAddr("glDisableVertexAttribArray"))
|
||||
if gpDisableVertexAttribArray == nil {
|
||||
return errors.New("glDisableVertexAttribArray")
|
||||
@ -832,12 +946,14 @@ func InitWithProcAddrFunc(getProcAddr func(name string) unsafe.Pointer) error {
|
||||
if gpFlush == nil {
|
||||
return errors.New("glFlush")
|
||||
}
|
||||
gpFramebufferRenderbufferEXT = (C.GPFRAMEBUFFERRENDERBUFFEREXT)(getProcAddr("glFramebufferRenderbufferEXT"))
|
||||
gpFramebufferTexture2DEXT = (C.GPFRAMEBUFFERTEXTURE2DEXT)(getProcAddr("glFramebufferTexture2DEXT"))
|
||||
gpGenBuffers = (C.GPGENBUFFERS)(getProcAddr("glGenBuffers"))
|
||||
if gpGenBuffers == nil {
|
||||
return errors.New("glGenBuffers")
|
||||
}
|
||||
gpGenFramebuffersEXT = (C.GPGENFRAMEBUFFERSEXT)(getProcAddr("glGenFramebuffersEXT"))
|
||||
gpGenRenderbuffersEXT = (C.GPGENRENDERBUFFERSEXT)(getProcAddr("glGenRenderbuffersEXT"))
|
||||
gpGenTextures = (C.GPGENTEXTURES)(getProcAddr("glGenTextures"))
|
||||
if gpGenTextures == nil {
|
||||
return errors.New("glGenTextures")
|
||||
@ -891,6 +1007,7 @@ func InitWithProcAddrFunc(getProcAddr func(name string) unsafe.Pointer) error {
|
||||
if gpIsProgram == nil {
|
||||
return errors.New("glIsProgram")
|
||||
}
|
||||
gpIsRenderbufferEXT = (C.GPISRENDERBUFFEREXT)(getProcAddr("glIsRenderbufferEXT"))
|
||||
gpIsTexture = (C.GPISTEXTURE)(getProcAddr("glIsTexture"))
|
||||
if gpIsTexture == nil {
|
||||
return errors.New("glIsTexture")
|
||||
@ -907,6 +1024,7 @@ func InitWithProcAddrFunc(getProcAddr func(name string) unsafe.Pointer) error {
|
||||
if gpReadPixels == nil {
|
||||
return errors.New("glReadPixels")
|
||||
}
|
||||
gpRenderbufferStorageEXT = (C.GPRENDERBUFFERSTORAGEEXT)(getProcAddr("glRenderbufferStorageEXT"))
|
||||
gpScissor = (C.GPSCISSOR)(getProcAddr("glScissor"))
|
||||
if gpScissor == nil {
|
||||
return errors.New("glScissor")
|
||||
@ -915,6 +1033,14 @@ func InitWithProcAddrFunc(getProcAddr func(name string) unsafe.Pointer) error {
|
||||
if gpShaderSource == nil {
|
||||
return errors.New("glShaderSource")
|
||||
}
|
||||
gpStencilFunc = (C.GPSTENCILFUNC)(getProcAddr("glStencilFunc"))
|
||||
if gpStencilFunc == nil {
|
||||
return errors.New("glStencilFunc")
|
||||
}
|
||||
gpStencilOp = (C.GPSTENCILOP)(getProcAddr("glStencilOp"))
|
||||
if gpStencilOp == nil {
|
||||
return errors.New("glStencilOp")
|
||||
}
|
||||
gpTexImage2D = (C.GPTEXIMAGE2D)(getProcAddr("glTexImage2D"))
|
||||
if gpTexImage2D == nil {
|
||||
return errors.New("glTexImage2D")
|
||||
|
@ -15,27 +15,34 @@ var (
|
||||
gpBindAttribLocation uintptr
|
||||
gpBindBuffer uintptr
|
||||
gpBindFramebufferEXT uintptr
|
||||
gpBindRenderbufferEXT uintptr
|
||||
gpBindTexture uintptr
|
||||
gpBlendFunc uintptr
|
||||
gpBufferData uintptr
|
||||
gpBufferSubData uintptr
|
||||
gpCheckFramebufferStatusEXT uintptr
|
||||
gpClear uintptr
|
||||
gpColorMask uintptr
|
||||
gpCompileShader uintptr
|
||||
gpCreateProgram uintptr
|
||||
gpCreateShader uintptr
|
||||
gpDeleteBuffers uintptr
|
||||
gpDeleteFramebuffersEXT uintptr
|
||||
gpDeleteProgram uintptr
|
||||
gpDeleteRenderbuffersEXT uintptr
|
||||
gpDeleteShader uintptr
|
||||
gpDeleteTextures uintptr
|
||||
gpDisable uintptr
|
||||
gpDisableVertexAttribArray uintptr
|
||||
gpDrawElements uintptr
|
||||
gpEnable uintptr
|
||||
gpEnableVertexAttribArray uintptr
|
||||
gpFlush uintptr
|
||||
gpFramebufferRenderbufferEXT uintptr
|
||||
gpFramebufferTexture2DEXT uintptr
|
||||
gpGenBuffers uintptr
|
||||
gpGenFramebuffersEXT uintptr
|
||||
gpGenRenderbuffersEXT uintptr
|
||||
gpGenTextures uintptr
|
||||
gpGetBufferSubData uintptr
|
||||
gpGetDoublei_v uintptr
|
||||
@ -59,12 +66,16 @@ var (
|
||||
gpGetVertexArrayPointeri_vEXT uintptr
|
||||
gpIsFramebufferEXT uintptr
|
||||
gpIsProgram uintptr
|
||||
gpIsRenderbufferEXT uintptr
|
||||
gpIsTexture uintptr
|
||||
gpLinkProgram uintptr
|
||||
gpPixelStorei uintptr
|
||||
gpReadPixels uintptr
|
||||
gpRenderbufferStorageEXT uintptr
|
||||
gpScissor uintptr
|
||||
gpShaderSource uintptr
|
||||
gpStencilFunc uintptr
|
||||
gpStencilOp uintptr
|
||||
gpTexImage2D uintptr
|
||||
gpTexParameteri uintptr
|
||||
gpTexSubImage2D uintptr
|
||||
@ -109,6 +120,10 @@ func BindFramebufferEXT(target uint32, framebuffer uint32) {
|
||||
syscall.Syscall(gpBindFramebufferEXT, 2, uintptr(target), uintptr(framebuffer), 0)
|
||||
}
|
||||
|
||||
func BindRenderbufferEXT(target uint32, renderbuffer uint32) {
|
||||
syscall.Syscall(gpBindRenderbufferEXT, 2, uintptr(target), uintptr(renderbuffer), 0)
|
||||
}
|
||||
|
||||
func BindTexture(target uint32, texture uint32) {
|
||||
syscall.Syscall(gpBindTexture, 2, uintptr(target), uintptr(texture), 0)
|
||||
}
|
||||
@ -130,6 +145,14 @@ func CheckFramebufferStatusEXT(target uint32) uint32 {
|
||||
return (uint32)(ret)
|
||||
}
|
||||
|
||||
func Clear(mask uint32) {
|
||||
syscall.Syscall(gpClear, 1, uintptr(mask), 0, 0)
|
||||
}
|
||||
|
||||
func ColorMask(red bool, green bool, blue bool, alpha bool) {
|
||||
syscall.Syscall6(gpColorMask, 4, boolToUintptr(red), boolToUintptr(green), boolToUintptr(blue), boolToUintptr(alpha), 0, 0)
|
||||
}
|
||||
|
||||
func CompileShader(shader uint32) {
|
||||
syscall.Syscall(gpCompileShader, 1, uintptr(shader), 0, 0)
|
||||
}
|
||||
@ -156,6 +179,10 @@ func DeleteProgram(program uint32) {
|
||||
syscall.Syscall(gpDeleteProgram, 1, uintptr(program), 0, 0)
|
||||
}
|
||||
|
||||
func DeleteRenderbuffersEXT(n int32, renderbuffers *uint32) {
|
||||
syscall.Syscall(gpDeleteRenderbuffersEXT, 2, uintptr(n), uintptr(unsafe.Pointer(renderbuffers)), 0)
|
||||
}
|
||||
|
||||
func DeleteShader(shader uint32) {
|
||||
syscall.Syscall(gpDeleteShader, 1, uintptr(shader), 0, 0)
|
||||
}
|
||||
@ -164,6 +191,10 @@ func DeleteTextures(n int32, textures *uint32) {
|
||||
syscall.Syscall(gpDeleteTextures, 2, uintptr(n), uintptr(unsafe.Pointer(textures)), 0)
|
||||
}
|
||||
|
||||
func Disable(cap uint32) {
|
||||
syscall.Syscall(gpDisable, 1, uintptr(cap), 0, 0)
|
||||
}
|
||||
|
||||
func DisableVertexAttribArray(index uint32) {
|
||||
syscall.Syscall(gpDisableVertexAttribArray, 1, uintptr(index), 0, 0)
|
||||
}
|
||||
@ -184,6 +215,10 @@ func Flush() {
|
||||
syscall.Syscall(gpFlush, 0, 0, 0, 0)
|
||||
}
|
||||
|
||||
func FramebufferRenderbufferEXT(target uint32, attachment uint32, renderbuffertarget uint32, renderbuffer uint32) {
|
||||
syscall.Syscall6(gpFramebufferRenderbufferEXT, 4, uintptr(target), uintptr(attachment), uintptr(renderbuffertarget), uintptr(renderbuffer), 0, 0)
|
||||
}
|
||||
|
||||
func FramebufferTexture2DEXT(target uint32, attachment uint32, textarget uint32, texture uint32, level int32) {
|
||||
syscall.Syscall6(gpFramebufferTexture2DEXT, 5, uintptr(target), uintptr(attachment), uintptr(textarget), uintptr(texture), uintptr(level), 0)
|
||||
}
|
||||
@ -196,6 +231,10 @@ func GenFramebuffersEXT(n int32, framebuffers *uint32) {
|
||||
syscall.Syscall(gpGenFramebuffersEXT, 2, uintptr(n), uintptr(unsafe.Pointer(framebuffers)), 0)
|
||||
}
|
||||
|
||||
func GenRenderbuffersEXT(n int32, renderbuffers *uint32) {
|
||||
syscall.Syscall(gpGenRenderbuffersEXT, 2, uintptr(n), uintptr(unsafe.Pointer(renderbuffers)), 0)
|
||||
}
|
||||
|
||||
func GenTextures(n int32, textures *uint32) {
|
||||
syscall.Syscall(gpGenTextures, 2, uintptr(n), uintptr(unsafe.Pointer(textures)), 0)
|
||||
}
|
||||
@ -284,6 +323,11 @@ func IsProgram(program uint32) bool {
|
||||
return ret != 0
|
||||
}
|
||||
|
||||
func IsRenderbufferEXT(renderbuffer uint32) bool {
|
||||
ret, _, _ := syscall.Syscall(gpIsRenderbufferEXT, 1, uintptr(renderbuffer), 0, 0)
|
||||
return ret != 0
|
||||
}
|
||||
|
||||
func IsTexture(texture uint32) bool {
|
||||
ret, _, _ := syscall.Syscall(gpIsTexture, 1, uintptr(texture), 0, 0)
|
||||
return ret != 0
|
||||
@ -301,6 +345,10 @@ func ReadPixels(x int32, y int32, width int32, height int32, format uint32, xtyp
|
||||
syscall.Syscall9(gpReadPixels, 7, uintptr(x), uintptr(y), uintptr(width), uintptr(height), uintptr(format), uintptr(xtype), uintptr(pixels), 0, 0)
|
||||
}
|
||||
|
||||
func RenderbufferStorageEXT(target uint32, internalformat uint32, width int32, height int32) {
|
||||
syscall.Syscall6(gpRenderbufferStorageEXT, 4, uintptr(target), uintptr(internalformat), uintptr(width), uintptr(height), 0, 0)
|
||||
}
|
||||
|
||||
func Scissor(x int32, y int32, width int32, height int32) {
|
||||
syscall.Syscall6(gpScissor, 4, uintptr(x), uintptr(y), uintptr(width), uintptr(height), 0, 0)
|
||||
}
|
||||
@ -309,6 +357,14 @@ func ShaderSource(shader uint32, count int32, xstring **uint8, length *int32) {
|
||||
syscall.Syscall6(gpShaderSource, 4, uintptr(shader), uintptr(count), uintptr(unsafe.Pointer(xstring)), uintptr(unsafe.Pointer(length)), 0, 0)
|
||||
}
|
||||
|
||||
func StencilFunc(xfunc uint32, ref int32, mask uint32) {
|
||||
syscall.Syscall(gpStencilFunc, 3, uintptr(xfunc), uintptr(ref), uintptr(mask))
|
||||
}
|
||||
|
||||
func StencilOp(fail uint32, zfail uint32, zpass uint32) {
|
||||
syscall.Syscall(gpStencilOp, 3, uintptr(fail), uintptr(zfail), uintptr(zpass))
|
||||
}
|
||||
|
||||
func TexImage2D(target uint32, level int32, internalformat int32, width int32, height int32, border int32, format uint32, xtype uint32, pixels unsafe.Pointer) {
|
||||
syscall.Syscall9(gpTexImage2D, 9, uintptr(target), uintptr(level), uintptr(internalformat), uintptr(width), uintptr(height), uintptr(border), uintptr(format), uintptr(xtype), uintptr(pixels))
|
||||
}
|
||||
@ -391,6 +447,7 @@ func InitWithProcAddrFunc(getProcAddr func(name string) uintptr) error {
|
||||
return errors.New("glBindBuffer")
|
||||
}
|
||||
gpBindFramebufferEXT = getProcAddr("glBindFramebufferEXT")
|
||||
gpBindRenderbufferEXT = getProcAddr("glBindRenderbufferEXT")
|
||||
gpBindTexture = getProcAddr("glBindTexture")
|
||||
if gpBindTexture == 0 {
|
||||
return errors.New("glBindTexture")
|
||||
@ -408,6 +465,14 @@ func InitWithProcAddrFunc(getProcAddr func(name string) uintptr) error {
|
||||
return errors.New("glBufferSubData")
|
||||
}
|
||||
gpCheckFramebufferStatusEXT = getProcAddr("glCheckFramebufferStatusEXT")
|
||||
gpClear = getProcAddr("glClear")
|
||||
if gpClear == 0 {
|
||||
return errors.New("glClear")
|
||||
}
|
||||
gpColorMask = getProcAddr("glColorMask")
|
||||
if gpColorMask == 0 {
|
||||
return errors.New("glColorMask")
|
||||
}
|
||||
gpCompileShader = getProcAddr("glCompileShader")
|
||||
if gpCompileShader == 0 {
|
||||
return errors.New("glCompileShader")
|
||||
@ -429,6 +494,7 @@ func InitWithProcAddrFunc(getProcAddr func(name string) uintptr) error {
|
||||
if gpDeleteProgram == 0 {
|
||||
return errors.New("glDeleteProgram")
|
||||
}
|
||||
gpDeleteRenderbuffersEXT = getProcAddr("glDeleteRenderbuffersEXT")
|
||||
gpDeleteShader = getProcAddr("glDeleteShader")
|
||||
if gpDeleteShader == 0 {
|
||||
return errors.New("glDeleteShader")
|
||||
@ -437,6 +503,10 @@ func InitWithProcAddrFunc(getProcAddr func(name string) uintptr) error {
|
||||
if gpDeleteTextures == 0 {
|
||||
return errors.New("glDeleteTextures")
|
||||
}
|
||||
gpDisable = getProcAddr("glDisable")
|
||||
if gpDisable == 0 {
|
||||
return errors.New("glDisable")
|
||||
}
|
||||
gpDisableVertexAttribArray = getProcAddr("glDisableVertexAttribArray")
|
||||
if gpDisableVertexAttribArray == 0 {
|
||||
return errors.New("glDisableVertexAttribArray")
|
||||
@ -457,12 +527,14 @@ func InitWithProcAddrFunc(getProcAddr func(name string) uintptr) error {
|
||||
if gpFlush == 0 {
|
||||
return errors.New("glFlush")
|
||||
}
|
||||
gpFramebufferRenderbufferEXT = getProcAddr("glFramebufferRenderbufferEXT")
|
||||
gpFramebufferTexture2DEXT = getProcAddr("glFramebufferTexture2DEXT")
|
||||
gpGenBuffers = getProcAddr("glGenBuffers")
|
||||
if gpGenBuffers == 0 {
|
||||
return errors.New("glGenBuffers")
|
||||
}
|
||||
gpGenFramebuffersEXT = getProcAddr("glGenFramebuffersEXT")
|
||||
gpGenRenderbuffersEXT = getProcAddr("glGenRenderbuffersEXT")
|
||||
gpGenTextures = getProcAddr("glGenTextures")
|
||||
if gpGenTextures == 0 {
|
||||
return errors.New("glGenTextures")
|
||||
@ -516,6 +588,7 @@ func InitWithProcAddrFunc(getProcAddr func(name string) uintptr) error {
|
||||
if gpIsProgram == 0 {
|
||||
return errors.New("glIsProgram")
|
||||
}
|
||||
gpIsRenderbufferEXT = getProcAddr("glIsRenderbufferEXT")
|
||||
gpIsTexture = getProcAddr("glIsTexture")
|
||||
if gpIsTexture == 0 {
|
||||
return errors.New("glIsTexture")
|
||||
@ -532,6 +605,7 @@ func InitWithProcAddrFunc(getProcAddr func(name string) uintptr) error {
|
||||
if gpReadPixels == 0 {
|
||||
return errors.New("glReadPixels")
|
||||
}
|
||||
gpRenderbufferStorageEXT = getProcAddr("glRenderbufferStorageEXT")
|
||||
gpScissor = getProcAddr("glScissor")
|
||||
if gpScissor == 0 {
|
||||
return errors.New("glScissor")
|
||||
@ -540,6 +614,14 @@ func InitWithProcAddrFunc(getProcAddr func(name string) uintptr) error {
|
||||
if gpShaderSource == 0 {
|
||||
return errors.New("glShaderSource")
|
||||
}
|
||||
gpStencilFunc = getProcAddr("glStencilFunc")
|
||||
if gpStencilFunc == 0 {
|
||||
return errors.New("glStencilFunc")
|
||||
}
|
||||
gpStencilOp = getProcAddr("glStencilOp")
|
||||
if gpStencilOp == 0 {
|
||||
return errors.New("glStencilOp")
|
||||
}
|
||||
gpTexImage2D = getProcAddr("glTexImage2D")
|
||||
if gpTexImage2D == 0 {
|
||||
return errors.New("glTexImage2D")
|
||||
|
@ -24,26 +24,33 @@ type gl struct {
|
||||
bindAttribLocation js.Value
|
||||
bindBuffer js.Value
|
||||
bindFramebuffer js.Value
|
||||
bindRenderbuffer js.Value
|
||||
bindTexture js.Value
|
||||
blendFunc js.Value
|
||||
bufferData js.Value
|
||||
bufferSubData js.Value
|
||||
checkFramebufferStatus js.Value
|
||||
clear js.Value
|
||||
colorMask js.Value
|
||||
compileShader js.Value
|
||||
createBuffer js.Value
|
||||
createFramebuffer js.Value
|
||||
createProgram js.Value
|
||||
createRenderbuffer js.Value
|
||||
createShader js.Value
|
||||
createTexture js.Value
|
||||
deleteBuffer js.Value
|
||||
deleteFramebuffer js.Value
|
||||
deleteProgram js.Value
|
||||
deleteRenderbuffer js.Value
|
||||
deleteShader js.Value
|
||||
deleteTexture js.Value
|
||||
disable js.Value
|
||||
disableVertexAttribArray js.Value
|
||||
drawElements js.Value
|
||||
enable js.Value
|
||||
enableVertexAttribArray js.Value
|
||||
framebufferRenderbuffer js.Value
|
||||
framebufferTexture2D js.Value
|
||||
flush js.Value
|
||||
getBufferSubData js.Value
|
||||
@ -58,12 +65,17 @@ type gl struct {
|
||||
isContextLost js.Value
|
||||
isFramebuffer js.Value
|
||||
isProgram js.Value
|
||||
isRenderbuffer js.Value
|
||||
isTexture js.Value
|
||||
linkProgram js.Value
|
||||
pixelStorei js.Value
|
||||
readPixels js.Value
|
||||
renderbufferStorage js.Value
|
||||
scissor js.Value
|
||||
shaderSource js.Value
|
||||
stencilFunc js.Value
|
||||
stencilMask js.Value
|
||||
stencilOp js.Value
|
||||
texImage2D js.Value
|
||||
texSubImage2D js.Value
|
||||
texParameteri js.Value
|
||||
@ -90,26 +102,33 @@ func newGL(v js.Value) *gl {
|
||||
bindAttribLocation: v.Get("bindAttribLocation").Call("bind", v),
|
||||
bindBuffer: v.Get("bindBuffer").Call("bind", v),
|
||||
bindFramebuffer: v.Get("bindFramebuffer").Call("bind", v),
|
||||
bindRenderbuffer: v.Get("bindRenderbuffer").Call("bind", v),
|
||||
bindTexture: v.Get("bindTexture").Call("bind", v),
|
||||
blendFunc: v.Get("blendFunc").Call("bind", v),
|
||||
bufferData: v.Get("bufferData").Call("bind", v),
|
||||
bufferSubData: v.Get("bufferSubData").Call("bind", v),
|
||||
checkFramebufferStatus: v.Get("checkFramebufferStatus").Call("bind", v),
|
||||
clear: v.Get("clear").Call("bind", v),
|
||||
colorMask: v.Get("colorMask").Call("bind", v),
|
||||
compileShader: v.Get("compileShader").Call("bind", v),
|
||||
createBuffer: v.Get("createBuffer").Call("bind", v),
|
||||
createFramebuffer: v.Get("createFramebuffer").Call("bind", v),
|
||||
createProgram: v.Get("createProgram").Call("bind", v),
|
||||
createRenderbuffer: v.Get("createRenderbuffer").Call("bind", v),
|
||||
createShader: v.Get("createShader").Call("bind", v),
|
||||
createTexture: v.Get("createTexture").Call("bind", v),
|
||||
deleteBuffer: v.Get("deleteBuffer").Call("bind", v),
|
||||
deleteFramebuffer: v.Get("deleteFramebuffer").Call("bind", v),
|
||||
deleteProgram: v.Get("deleteProgram").Call("bind", v),
|
||||
deleteRenderbuffer: v.Get("deleteRenderbuffer").Call("bind", v),
|
||||
deleteShader: v.Get("deleteShader").Call("bind", v),
|
||||
deleteTexture: v.Get("deleteTexture").Call("bind", v),
|
||||
disable: v.Get("disable").Call("bind", v),
|
||||
disableVertexAttribArray: v.Get("disableVertexAttribArray").Call("bind", v),
|
||||
drawElements: v.Get("drawElements").Call("bind", v),
|
||||
enable: v.Get("enable").Call("bind", v),
|
||||
enableVertexAttribArray: v.Get("enableVertexAttribArray").Call("bind", v),
|
||||
framebufferRenderbuffer: v.Get("framebufferRenderbuffer").Call("bind", v),
|
||||
framebufferTexture2D: v.Get("framebufferTexture2D").Call("bind", v),
|
||||
flush: v.Get("flush").Call("bind", v),
|
||||
getParameter: v.Get("getParameter").Call("bind", v),
|
||||
@ -122,12 +141,17 @@ func newGL(v js.Value) *gl {
|
||||
isContextLost: v.Get("isContextLost").Call("bind", v),
|
||||
isFramebuffer: v.Get("isFramebuffer").Call("bind", v),
|
||||
isProgram: v.Get("isProgram").Call("bind", v),
|
||||
isRenderbuffer: v.Get("isRenderbuffer").Call("bind", v),
|
||||
isTexture: v.Get("isTexture").Call("bind", v),
|
||||
linkProgram: v.Get("linkProgram").Call("bind", v),
|
||||
pixelStorei: v.Get("pixelStorei").Call("bind", v),
|
||||
readPixels: v.Get("readPixels").Call("bind", v),
|
||||
renderbufferStorage: v.Get("renderbufferStorage").Call("bind", v),
|
||||
scissor: v.Get("scissor").Call("bind", v),
|
||||
shaderSource: v.Get("shaderSource").Call("bind", v),
|
||||
stencilFunc: v.Get("stencilFunc").Call("bind", v),
|
||||
stencilMask: v.Get("stencilMask").Call("bind", v),
|
||||
stencilOp: v.Get("stencilOp").Call("bind", v),
|
||||
texImage2D: v.Get("texImage2D").Call("bind", v),
|
||||
texSubImage2D: v.Get("texSubImage2D").Call("bind", v),
|
||||
texParameteri: v.Get("texParameteri").Call("bind", v),
|
||||
|
@ -24,6 +24,7 @@ const (
|
||||
ONE_MINUS_DST_ALPHA = 0x0305
|
||||
DST_COLOR = 0x0306
|
||||
|
||||
ALWAYS = 0x0207
|
||||
ARRAY_BUFFER = 0x8892
|
||||
BLEND = 0x0BE2
|
||||
CLAMP_TO_EDGE = 0x812F
|
||||
@ -39,16 +40,24 @@ const (
|
||||
FRAMEBUFFER_COMPLETE = 0x8CD5
|
||||
HIGH_FLOAT = 0x8DF2
|
||||
INFO_LOG_LENGTH = 0x8B84
|
||||
INVERT = 0x150A
|
||||
KEEP = 0x1E00
|
||||
LINK_STATUS = 0x8B82
|
||||
MAX_TEXTURE_SIZE = 0x0D33
|
||||
NEAREST = 0x2600
|
||||
NO_ERROR = 0
|
||||
NOTEQUAL = 0x0205
|
||||
PIXEL_PACK_BUFFER = 0x88EB
|
||||
PIXEL_UNPACK_BUFFER = 0x88EC
|
||||
READ_WRITE = 0x88BA
|
||||
RENDERBUFFER = 0x8D41
|
||||
RGBA = 0x1908
|
||||
SCISSOR_TEST = 0x0C11
|
||||
SHORT = 0x1402
|
||||
STENCIL_ATTACHMENT = 0x8D20
|
||||
STENCIL_BUFFER_BIT = 0x0400
|
||||
STENCIL_INDEX8 = 0x8D48
|
||||
STENCIL_TEST = 0x0B90
|
||||
STREAM_DRAW = 0x88E0
|
||||
TEXTURE0 = 0x84C0
|
||||
TEXTURE_2D = 0x0DE1
|
||||
|
@ -66,6 +66,10 @@ func (DefaultContext) BindFramebuffer(target uint32, framebuffer uint32) {
|
||||
C.glBindFramebuffer(C.GLenum(target), C.GLuint(framebuffer))
|
||||
}
|
||||
|
||||
func (DefaultContext) BindRenderbuffer(target uint32, renderbuffer uint32) {
|
||||
C.glBindRenderbuffer(C.GLenum(target), C.GLuint(renderbuffer))
|
||||
}
|
||||
|
||||
func (DefaultContext) BindTexture(target uint32, texture uint32) {
|
||||
C.glBindTexture(C.GLenum(target), C.GLuint(texture))
|
||||
}
|
||||
@ -90,6 +94,14 @@ func (DefaultContext) CheckFramebufferStatus(target uint32) uint32 {
|
||||
return uint32(C.glCheckFramebufferStatus(C.GLenum(target)))
|
||||
}
|
||||
|
||||
func (DefaultContext) Clear(mask uint32) {
|
||||
C.glClear(C.GLbitfield(mask))
|
||||
}
|
||||
|
||||
func (DefaultContext) ColorMask(red, green, blue, alpha bool) {
|
||||
C.glColorMask(glBool(red), glBool(green), glBool(blue), glBool(alpha))
|
||||
}
|
||||
|
||||
func (DefaultContext) CompileShader(shader uint32) {
|
||||
C.glCompileShader(C.GLuint(shader))
|
||||
}
|
||||
@ -114,6 +126,10 @@ func (DefaultContext) DeleteProgram(program uint32) {
|
||||
C.glDeleteProgram(C.GLuint(program))
|
||||
}
|
||||
|
||||
func (DefaultContext) DeleteRenderbuffers(renderbuffers []uint32) {
|
||||
C.glDeleteRenderbuffers(C.GLsizei(len(renderbuffers)), (*C.GLuint)(unsafe.Pointer(&renderbuffers[0])))
|
||||
}
|
||||
|
||||
func (DefaultContext) DeleteShader(shader uint32) {
|
||||
C.glDeleteShader(C.GLuint(shader))
|
||||
}
|
||||
@ -122,6 +138,10 @@ func (DefaultContext) DeleteTextures(textures []uint32) {
|
||||
C.glDeleteTextures(C.GLsizei(len(textures)), (*C.GLuint)(unsafe.Pointer(&textures[0])))
|
||||
}
|
||||
|
||||
func (DefaultContext) Disable(cap uint32) {
|
||||
C.glDisable(C.GLenum(cap))
|
||||
}
|
||||
|
||||
func (DefaultContext) DisableVertexAttribArray(index uint32) {
|
||||
C.glDisableVertexAttribArray(C.GLuint(index))
|
||||
}
|
||||
@ -142,6 +162,10 @@ func (DefaultContext) Flush() {
|
||||
C.glFlush()
|
||||
}
|
||||
|
||||
func (DefaultContext) FramebufferRenderbuffer(target uint32, attachment uint32, renderbuffertarget uint32, renderbuffer uint32) {
|
||||
C.glFramebufferRenderbuffer(C.GLenum(target), C.GLenum(attachment), C.GLenum(renderbuffertarget), C.GLuint(renderbuffer))
|
||||
}
|
||||
|
||||
func (DefaultContext) FramebufferTexture2D(target uint32, attachment uint32, textarget uint32, texture uint32, level int32) {
|
||||
C.glFramebufferTexture2D(C.GLenum(target), C.GLenum(attachment), C.GLenum(textarget), C.GLuint(texture), C.GLint(level))
|
||||
}
|
||||
@ -158,6 +182,12 @@ func (DefaultContext) GenFramebuffers(n int32) []uint32 {
|
||||
return framebuffers
|
||||
}
|
||||
|
||||
func (DefaultContext) GenRenderbuffers(n int32) []uint32 {
|
||||
renderbuffers := make([]uint32, n)
|
||||
C.glGenRenderbuffers(C.GLsizei(n), (*C.GLuint)(unsafe.Pointer(&renderbuffers[0])))
|
||||
return renderbuffers
|
||||
}
|
||||
|
||||
func (DefaultContext) GenTextures(n int32) []uint32 {
|
||||
textures := make([]uint32, n)
|
||||
C.glGenTextures(C.GLsizei(n), (*C.GLuint)(unsafe.Pointer(&textures[0])))
|
||||
@ -227,6 +257,10 @@ func (DefaultContext) IsProgram(program uint32) bool {
|
||||
return C.glIsProgram(C.GLuint(program)) != FALSE
|
||||
}
|
||||
|
||||
func (DefaultContext) IsRenderbuffer(renderbuffer uint32) bool {
|
||||
return C.glIsRenderbuffer(C.GLuint(renderbuffer)) != FALSE
|
||||
}
|
||||
|
||||
func (DefaultContext) IsTexture(texture uint32) bool {
|
||||
return C.glIsTexture(C.GLuint(texture)) != FALSE
|
||||
}
|
||||
@ -243,6 +277,10 @@ func (DefaultContext) ReadPixels(dst []byte, x int32, y int32, width int32, heig
|
||||
C.glReadPixels(C.GLint(x), C.GLint(y), C.GLsizei(width), C.GLsizei(height), C.GLenum(format), C.GLenum(xtype), unsafe.Pointer(&dst[0]))
|
||||
}
|
||||
|
||||
func (DefaultContext) RenderbufferStorage(target uint32, internalFormat uint32, width int32, height int32) {
|
||||
C.glRenderbufferStorage(C.GLenum(target), C.GLenum(internalFormat), C.GLsizei(width), C.GLsizei(height))
|
||||
}
|
||||
|
||||
func (DefaultContext) Scissor(x, y, width, height int32) {
|
||||
C.glScissor(C.GLint(x), C.GLint(y), C.GLsizei(width), C.GLsizei(height))
|
||||
}
|
||||
@ -253,6 +291,14 @@ func (DefaultContext) ShaderSource(shader uint32, xstring string) {
|
||||
C.glShaderSource(C.GLuint(shader), 1, (**C.GLchar)(unsafe.Pointer(s)), nil)
|
||||
}
|
||||
|
||||
func (DefaultContext) StencilFunc(func_ uint32, ref int32, mask uint32) {
|
||||
C.glStencilFunc(C.GLenum(func_), C.GLint(ref), C.GLuint(mask))
|
||||
}
|
||||
|
||||
func (DefaultContext) StencilOp(sfail, dpfail, dppass uint32) {
|
||||
C.glStencilOp(C.GLenum(sfail), C.GLenum(dpfail), C.GLenum(dppass))
|
||||
}
|
||||
|
||||
func (DefaultContext) TexImage2D(target uint32, level int32, internalformat int32, width int32, height int32, format uint32, xtype uint32, pixels []byte) {
|
||||
var p *byte
|
||||
if pixels != nil {
|
||||
|
@ -56,6 +56,10 @@ func (g *GomobileContext) BindFramebuffer(target uint32, framebuffer uint32) {
|
||||
g.ctx.BindFramebuffer(gl.Enum(target), gl.Framebuffer{Value: framebuffer})
|
||||
}
|
||||
|
||||
func (g *GomobileContext) BindRenderbuffer(target uint32, renderbuffer uint32) {
|
||||
g.ctx.BindRenderbuffer(gl.Enum(target), gl.Renderbuffer{Value: renderbuffer})
|
||||
}
|
||||
|
||||
func (g *GomobileContext) BindTexture(target uint32, texture uint32) {
|
||||
g.ctx.BindTexture(gl.Enum(target), gl.Texture{Value: texture})
|
||||
}
|
||||
@ -83,6 +87,14 @@ func (g *GomobileContext) CheckFramebufferStatus(target uint32) uint32 {
|
||||
return uint32(g.ctx.CheckFramebufferStatus(gl.Enum(target)))
|
||||
}
|
||||
|
||||
func (g *GomobileContext) Clear(mask uint32) {
|
||||
g.ctx.Clear(gl.Enum(mask))
|
||||
}
|
||||
|
||||
func (g *GomobileContext) ColorMask(red, green, blue, alpha bool) {
|
||||
g.ctx.ColorMask(red, green, blue, alpha)
|
||||
}
|
||||
|
||||
func (g *GomobileContext) CompileShader(shader uint32) {
|
||||
g.ctx.CompileShader(gl.Shader{Value: shader})
|
||||
}
|
||||
@ -111,6 +123,12 @@ func (g *GomobileContext) DeleteProgram(program uint32) {
|
||||
g.ctx.DeleteProgram(gmProgram(program))
|
||||
}
|
||||
|
||||
func (g *GomobileContext) DeleteRenderbuffers(renderbuffers []uint32) {
|
||||
for _, r := range renderbuffers {
|
||||
g.ctx.DeleteRenderbuffer(gl.Renderbuffer{Value: r})
|
||||
}
|
||||
}
|
||||
|
||||
func (g *GomobileContext) DeleteShader(shader uint32) {
|
||||
g.ctx.DeleteShader(gl.Shader{Value: shader})
|
||||
}
|
||||
@ -121,6 +139,10 @@ func (g *GomobileContext) DeleteTextures(textures []uint32) {
|
||||
}
|
||||
}
|
||||
|
||||
func (g *GomobileContext) Disable(cap uint32) {
|
||||
g.ctx.Disable(gl.Enum(cap))
|
||||
}
|
||||
|
||||
func (g *GomobileContext) DisableVertexAttribArray(index uint32) {
|
||||
g.ctx.DisableVertexAttribArray(gl.Attrib{Value: uint(index)})
|
||||
}
|
||||
@ -141,6 +163,10 @@ func (g *GomobileContext) Flush() {
|
||||
g.ctx.Flush()
|
||||
}
|
||||
|
||||
func (g *GomobileContext) FramebufferRenderbuffer(target uint32, attachment uint32, renderbuffertarget uint32, renderbuffer uint32) {
|
||||
g.ctx.FramebufferRenderbuffer(gl.Enum(target), gl.Enum(attachment), gl.Enum(renderbuffertarget), gl.Renderbuffer{Value: renderbuffer})
|
||||
}
|
||||
|
||||
func (g *GomobileContext) FramebufferTexture2D(target uint32, attachment uint32, textarget uint32, texture uint32, level int32) {
|
||||
g.ctx.FramebufferTexture2D(gl.Enum(target), gl.Enum(attachment), gl.Enum(textarget), gl.Texture{Value: texture}, int(level))
|
||||
}
|
||||
@ -161,6 +187,14 @@ func (g *GomobileContext) GenFramebuffers(n int32) []uint32 {
|
||||
return framebuffers
|
||||
}
|
||||
|
||||
func (g *GomobileContext) GenRenderbuffers(n int32) []uint32 {
|
||||
renderbuffers := make([]uint32, n)
|
||||
for i := range renderbuffers {
|
||||
renderbuffers[i] = g.ctx.CreateRenderbuffer().Value
|
||||
}
|
||||
return renderbuffers
|
||||
}
|
||||
|
||||
func (g *GomobileContext) GenTextures(n int32) []uint32 {
|
||||
textures := make([]uint32, n)
|
||||
for i := range textures {
|
||||
@ -209,6 +243,10 @@ func (g *GomobileContext) IsProgram(program uint32) bool {
|
||||
return g.ctx.IsProgram(gmProgram(program))
|
||||
}
|
||||
|
||||
func (g *GomobileContext) IsRenderbuffer(renderbuffer uint32) bool {
|
||||
return g.ctx.IsRenderbuffer(gl.Renderbuffer{Value: renderbuffer})
|
||||
}
|
||||
|
||||
func (g *GomobileContext) IsTexture(texture uint32) bool {
|
||||
return g.ctx.IsTexture(gl.Texture{Value: texture})
|
||||
}
|
||||
@ -225,6 +263,10 @@ func (g *GomobileContext) ReadPixels(dst []byte, x int32, y int32, width int32,
|
||||
g.ctx.ReadPixels(dst, int(x), int(y), int(width), int(height), gl.Enum(format), gl.Enum(xtype))
|
||||
}
|
||||
|
||||
func (g *GomobileContext) RenderbufferStorage(target uint32, internalFormat uint32, width int32, height int32) {
|
||||
g.ctx.RenderbufferStorage(gl.Enum(target), gl.Enum(internalFormat), int(width), int(height))
|
||||
}
|
||||
|
||||
func (g *GomobileContext) Scissor(x, y, width, height int32) {
|
||||
g.ctx.Scissor(x, y, width, height)
|
||||
}
|
||||
@ -233,6 +275,14 @@ func (g *GomobileContext) ShaderSource(shader uint32, xstring string) {
|
||||
g.ctx.ShaderSource(gl.Shader{Value: shader}, xstring)
|
||||
}
|
||||
|
||||
func (g *GomobileContext) StencilFunc(func_ uint32, ref int32, mask uint32) {
|
||||
g.ctx.StencilFunc(gl.Enum(func_), int(ref), mask)
|
||||
}
|
||||
|
||||
func (g *GomobileContext) StencilOp(sfail, dpfail, dppass uint32) {
|
||||
g.ctx.StencilOp(gl.Enum(sfail), gl.Enum(dpfail), gl.Enum(dppass))
|
||||
}
|
||||
|
||||
func (g *GomobileContext) TexImage2D(target uint32, level int32, internalformat int32, width int32, height int32, format uint32, xtype uint32, pixels []byte) {
|
||||
g.ctx.TexImage2D(gl.Enum(target), int(level), int(internalformat), int(width), int(height), gl.Enum(format), gl.Enum(xtype), pixels)
|
||||
}
|
||||
|
@ -23,27 +23,34 @@ type Context interface {
|
||||
BindAttribLocation(program uint32, index uint32, name string)
|
||||
BindBuffer(target uint32, buffer uint32)
|
||||
BindFramebuffer(target uint32, framebuffer uint32)
|
||||
BindRenderbuffer(target uint32, renderbuffer uint32)
|
||||
BindTexture(target uint32, texture uint32)
|
||||
BlendFunc(sfactor uint32, dfactor uint32)
|
||||
BufferData(target uint32, size int, data []byte, usage uint32)
|
||||
BufferSubData(target uint32, offset int, data []byte)
|
||||
CheckFramebufferStatus(target uint32) uint32
|
||||
Clear(mask uint32)
|
||||
ColorMask(red, green, blue, alpha bool)
|
||||
CompileShader(shader uint32)
|
||||
CreateProgram() uint32
|
||||
CreateShader(xtype uint32) uint32
|
||||
DeleteBuffers(buffers []uint32)
|
||||
DeleteFramebuffers(framebuffers []uint32)
|
||||
DeleteProgram(program uint32)
|
||||
DeleteRenderbuffers(renderbuffer []uint32)
|
||||
DeleteShader(shader uint32)
|
||||
DeleteTextures(textures []uint32)
|
||||
Disable(cap uint32)
|
||||
DisableVertexAttribArray(index uint32)
|
||||
DrawElements(mode uint32, count int32, xtype uint32, offset int)
|
||||
Enable(cap uint32)
|
||||
EnableVertexAttribArray(index uint32)
|
||||
Flush()
|
||||
FramebufferRenderbuffer(target uint32, attachment uint32, renderbuffertarget uint32, renderbuffer uint32)
|
||||
FramebufferTexture2D(target uint32, attachment uint32, textarget uint32, texture uint32, level int32)
|
||||
GenBuffers(n int32) []uint32
|
||||
GenFramebuffers(n int32) []uint32
|
||||
GenRenderbuffers(n int32) []uint32
|
||||
GenTextures(n int32) []uint32
|
||||
GetError() uint32
|
||||
GetIntegerv(dst []int32, pname uint32)
|
||||
@ -55,12 +62,16 @@ type Context interface {
|
||||
GetUniformLocation(program uint32, name string) int32
|
||||
IsFramebuffer(framebuffer uint32) bool
|
||||
IsProgram(program uint32) bool
|
||||
IsRenderbuffer(renderbuffer uint32) bool
|
||||
IsTexture(texture uint32) bool
|
||||
LinkProgram(program uint32)
|
||||
PixelStorei(pname uint32, param int32)
|
||||
ReadPixels(dst []byte, x int32, y int32, width int32, height int32, format uint32, xtype uint32)
|
||||
RenderbufferStorage(target uint32, internalFormat uint32, width int32, height int32)
|
||||
Scissor(x, y, width, height int32)
|
||||
ShaderSource(shader uint32, xstring string)
|
||||
StencilFunc(func_ uint32, ref int32, mask uint32)
|
||||
StencilOp(sfail, dpfail, dppass uint32)
|
||||
TexImage2D(target uint32, level int32, internalformat int32, width int32, height int32, format uint32, xtype uint32, pixels []byte)
|
||||
TexParameteri(target uint32, pname uint32, param int32)
|
||||
TexSubImage2D(target uint32, level int32, xoffset int32, yoffset int32, width int32, height int32, format uint32, xtype uint32, pixels []byte)
|
||||
|
Loading…
Reference in New Issue
Block a user