zorldo

Goofing around with Ebiten
git clone git://bsandro.tech/zorldo
Log | Files | Refs | README

package_windows.go (25085B)


      1 // SPDX-License-Identifier: MIT
      2 
      3 package gl
      4 
      5 import (
      6 	"errors"
      7 	"math"
      8 	"syscall"
      9 	"unsafe"
     10 )
     11 
     12 var (
     13 	gpActiveTexture               uintptr
     14 	gpAttachShader                uintptr
     15 	gpBindAttribLocation          uintptr
     16 	gpBindBuffer                  uintptr
     17 	gpBindFramebufferEXT          uintptr
     18 	gpBindRenderbufferEXT         uintptr
     19 	gpBindTexture                 uintptr
     20 	gpBlendFunc                   uintptr
     21 	gpBufferData                  uintptr
     22 	gpBufferSubData               uintptr
     23 	gpCheckFramebufferStatusEXT   uintptr
     24 	gpClear                       uintptr
     25 	gpColorMask                   uintptr
     26 	gpCompileShader               uintptr
     27 	gpCreateProgram               uintptr
     28 	gpCreateShader                uintptr
     29 	gpDeleteBuffers               uintptr
     30 	gpDeleteFramebuffersEXT       uintptr
     31 	gpDeleteProgram               uintptr
     32 	gpDeleteRenderbuffersEXT      uintptr
     33 	gpDeleteShader                uintptr
     34 	gpDeleteTextures              uintptr
     35 	gpDisable                     uintptr
     36 	gpDisableVertexAttribArray    uintptr
     37 	gpDrawElements                uintptr
     38 	gpEnable                      uintptr
     39 	gpEnableVertexAttribArray     uintptr
     40 	gpFlush                       uintptr
     41 	gpFramebufferRenderbufferEXT  uintptr
     42 	gpFramebufferTexture2DEXT     uintptr
     43 	gpGenBuffers                  uintptr
     44 	gpGenFramebuffersEXT          uintptr
     45 	gpGenRenderbuffersEXT         uintptr
     46 	gpGenTextures                 uintptr
     47 	gpGetBufferSubData            uintptr
     48 	gpGetDoublei_v                uintptr
     49 	gpGetDoublei_vEXT             uintptr
     50 	gpGetError                    uintptr
     51 	gpGetFloati_v                 uintptr
     52 	gpGetFloati_vEXT              uintptr
     53 	gpGetIntegeri_v               uintptr
     54 	gpGetIntegerui64i_vNV         uintptr
     55 	gpGetIntegerv                 uintptr
     56 	gpGetPointeri_vEXT            uintptr
     57 	gpGetProgramInfoLog           uintptr
     58 	gpGetProgramiv                uintptr
     59 	gpGetShaderInfoLog            uintptr
     60 	gpGetShaderiv                 uintptr
     61 	gpGetTransformFeedbacki64_v   uintptr
     62 	gpGetTransformFeedbacki_v     uintptr
     63 	gpGetUniformLocation          uintptr
     64 	gpGetUnsignedBytei_vEXT       uintptr
     65 	gpGetVertexArrayIntegeri_vEXT uintptr
     66 	gpGetVertexArrayPointeri_vEXT uintptr
     67 	gpIsFramebufferEXT            uintptr
     68 	gpIsProgram                   uintptr
     69 	gpIsRenderbufferEXT           uintptr
     70 	gpIsTexture                   uintptr
     71 	gpLinkProgram                 uintptr
     72 	gpPixelStorei                 uintptr
     73 	gpReadPixels                  uintptr
     74 	gpRenderbufferStorageEXT      uintptr
     75 	gpScissor                     uintptr
     76 	gpShaderSource                uintptr
     77 	gpStencilFunc                 uintptr
     78 	gpStencilOp                   uintptr
     79 	gpTexImage2D                  uintptr
     80 	gpTexParameteri               uintptr
     81 	gpTexSubImage2D               uintptr
     82 	gpUniform1f                   uintptr
     83 	gpUniform1i                   uintptr
     84 	gpUniform1fv                  uintptr
     85 	gpUniform2fv                  uintptr
     86 	gpUniform3fv                  uintptr
     87 	gpUniform4fv                  uintptr
     88 	gpUniformMatrix2fv            uintptr
     89 	gpUniformMatrix3fv            uintptr
     90 	gpUniformMatrix4fv            uintptr
     91 	gpUseProgram                  uintptr
     92 	gpVertexAttribPointer         uintptr
     93 	gpViewport                    uintptr
     94 )
     95 
     96 func boolToUintptr(b bool) uintptr {
     97 	if b {
     98 		return 1
     99 	}
    100 	return 0
    101 }
    102 
    103 func ActiveTexture(texture uint32) {
    104 	syscall.Syscall(gpActiveTexture, 1, uintptr(texture), 0, 0)
    105 }
    106 
    107 func AttachShader(program uint32, shader uint32) {
    108 	syscall.Syscall(gpAttachShader, 2, uintptr(program), uintptr(shader), 0)
    109 }
    110 
    111 func BindAttribLocation(program uint32, index uint32, name *uint8) {
    112 	syscall.Syscall(gpBindAttribLocation, 3, uintptr(program), uintptr(index), uintptr(unsafe.Pointer(name)))
    113 }
    114 
    115 func BindBuffer(target uint32, buffer uint32) {
    116 	syscall.Syscall(gpBindBuffer, 2, uintptr(target), uintptr(buffer), 0)
    117 }
    118 
    119 func BindFramebufferEXT(target uint32, framebuffer uint32) {
    120 	syscall.Syscall(gpBindFramebufferEXT, 2, uintptr(target), uintptr(framebuffer), 0)
    121 }
    122 
    123 func BindRenderbufferEXT(target uint32, renderbuffer uint32) {
    124 	syscall.Syscall(gpBindRenderbufferEXT, 2, uintptr(target), uintptr(renderbuffer), 0)
    125 }
    126 
    127 func BindTexture(target uint32, texture uint32) {
    128 	syscall.Syscall(gpBindTexture, 2, uintptr(target), uintptr(texture), 0)
    129 }
    130 
    131 func BlendFunc(sfactor uint32, dfactor uint32) {
    132 	syscall.Syscall(gpBlendFunc, 2, uintptr(sfactor), uintptr(dfactor), 0)
    133 }
    134 
    135 func BufferData(target uint32, size int, data unsafe.Pointer, usage uint32) {
    136 	syscall.Syscall6(gpBufferData, 4, uintptr(target), uintptr(size), uintptr(data), uintptr(usage), 0, 0)
    137 }
    138 
    139 func BufferSubData(target uint32, offset int, size int, data unsafe.Pointer) {
    140 	syscall.Syscall6(gpBufferSubData, 4, uintptr(target), uintptr(offset), uintptr(size), uintptr(data), 0, 0)
    141 }
    142 
    143 func CheckFramebufferStatusEXT(target uint32) uint32 {
    144 	ret, _, _ := syscall.Syscall(gpCheckFramebufferStatusEXT, 1, uintptr(target), 0, 0)
    145 	return (uint32)(ret)
    146 }
    147 
    148 func Clear(mask uint32) {
    149 	syscall.Syscall(gpClear, 1, uintptr(mask), 0, 0)
    150 }
    151 
    152 func ColorMask(red bool, green bool, blue bool, alpha bool) {
    153 	syscall.Syscall6(gpColorMask, 4, boolToUintptr(red), boolToUintptr(green), boolToUintptr(blue), boolToUintptr(alpha), 0, 0)
    154 }
    155 
    156 func CompileShader(shader uint32) {
    157 	syscall.Syscall(gpCompileShader, 1, uintptr(shader), 0, 0)
    158 }
    159 
    160 func CreateProgram() uint32 {
    161 	ret, _, _ := syscall.Syscall(gpCreateProgram, 0, 0, 0, 0)
    162 	return (uint32)(ret)
    163 }
    164 
    165 func CreateShader(xtype uint32) uint32 {
    166 	ret, _, _ := syscall.Syscall(gpCreateShader, 1, uintptr(xtype), 0, 0)
    167 	return (uint32)(ret)
    168 }
    169 
    170 func DeleteBuffers(n int32, buffers *uint32) {
    171 	syscall.Syscall(gpDeleteBuffers, 2, uintptr(n), uintptr(unsafe.Pointer(buffers)), 0)
    172 }
    173 
    174 func DeleteFramebuffersEXT(n int32, framebuffers *uint32) {
    175 	syscall.Syscall(gpDeleteFramebuffersEXT, 2, uintptr(n), uintptr(unsafe.Pointer(framebuffers)), 0)
    176 }
    177 
    178 func DeleteProgram(program uint32) {
    179 	syscall.Syscall(gpDeleteProgram, 1, uintptr(program), 0, 0)
    180 }
    181 
    182 func DeleteRenderbuffersEXT(n int32, renderbuffers *uint32) {
    183 	syscall.Syscall(gpDeleteRenderbuffersEXT, 2, uintptr(n), uintptr(unsafe.Pointer(renderbuffers)), 0)
    184 }
    185 
    186 func DeleteShader(shader uint32) {
    187 	syscall.Syscall(gpDeleteShader, 1, uintptr(shader), 0, 0)
    188 }
    189 
    190 func DeleteTextures(n int32, textures *uint32) {
    191 	syscall.Syscall(gpDeleteTextures, 2, uintptr(n), uintptr(unsafe.Pointer(textures)), 0)
    192 }
    193 
    194 func Disable(cap uint32) {
    195 	syscall.Syscall(gpDisable, 1, uintptr(cap), 0, 0)
    196 }
    197 
    198 func DisableVertexAttribArray(index uint32) {
    199 	syscall.Syscall(gpDisableVertexAttribArray, 1, uintptr(index), 0, 0)
    200 }
    201 
    202 func DrawElements(mode uint32, count int32, xtype uint32, indices uintptr) {
    203 	syscall.Syscall6(gpDrawElements, 4, uintptr(mode), uintptr(count), uintptr(xtype), uintptr(indices), 0, 0)
    204 }
    205 
    206 func Enable(cap uint32) {
    207 	syscall.Syscall(gpEnable, 1, uintptr(cap), 0, 0)
    208 }
    209 
    210 func EnableVertexAttribArray(index uint32) {
    211 	syscall.Syscall(gpEnableVertexAttribArray, 1, uintptr(index), 0, 0)
    212 }
    213 
    214 func Flush() {
    215 	syscall.Syscall(gpFlush, 0, 0, 0, 0)
    216 }
    217 
    218 func FramebufferRenderbufferEXT(target uint32, attachment uint32, renderbuffertarget uint32, renderbuffer uint32) {
    219 	syscall.Syscall6(gpFramebufferRenderbufferEXT, 4, uintptr(target), uintptr(attachment), uintptr(renderbuffertarget), uintptr(renderbuffer), 0, 0)
    220 }
    221 
    222 func FramebufferTexture2DEXT(target uint32, attachment uint32, textarget uint32, texture uint32, level int32) {
    223 	syscall.Syscall6(gpFramebufferTexture2DEXT, 5, uintptr(target), uintptr(attachment), uintptr(textarget), uintptr(texture), uintptr(level), 0)
    224 }
    225 
    226 func GenBuffers(n int32, buffers *uint32) {
    227 	syscall.Syscall(gpGenBuffers, 2, uintptr(n), uintptr(unsafe.Pointer(buffers)), 0)
    228 }
    229 
    230 func GenFramebuffersEXT(n int32, framebuffers *uint32) {
    231 	syscall.Syscall(gpGenFramebuffersEXT, 2, uintptr(n), uintptr(unsafe.Pointer(framebuffers)), 0)
    232 }
    233 
    234 func GenRenderbuffersEXT(n int32, renderbuffers *uint32) {
    235 	syscall.Syscall(gpGenRenderbuffersEXT, 2, uintptr(n), uintptr(unsafe.Pointer(renderbuffers)), 0)
    236 }
    237 
    238 func GenTextures(n int32, textures *uint32) {
    239 	syscall.Syscall(gpGenTextures, 2, uintptr(n), uintptr(unsafe.Pointer(textures)), 0)
    240 }
    241 
    242 func GetBufferSubData(target uint32, offset int, size int, data unsafe.Pointer) {
    243 	syscall.Syscall6(gpGetBufferSubData, 4, uintptr(target), uintptr(offset), uintptr(size), uintptr(data), 0, 0)
    244 }
    245 
    246 func GetDoublei_v(target uint32, index uint32, data *float64) {
    247 	syscall.Syscall(gpGetDoublei_v, 3, uintptr(target), uintptr(index), uintptr(unsafe.Pointer(data)))
    248 }
    249 func GetDoublei_vEXT(pname uint32, index uint32, params *float64) {
    250 	syscall.Syscall(gpGetDoublei_vEXT, 3, uintptr(pname), uintptr(index), uintptr(unsafe.Pointer(params)))
    251 }
    252 
    253 func GetError() uint32 {
    254 	ret, _, _ := syscall.Syscall(gpGetError, 0, 0, 0, 0)
    255 	return (uint32)(ret)
    256 }
    257 func GetFloati_v(target uint32, index uint32, data *float32) {
    258 	syscall.Syscall(gpGetFloati_v, 3, uintptr(target), uintptr(index), uintptr(unsafe.Pointer(data)))
    259 }
    260 func GetFloati_vEXT(pname uint32, index uint32, params *float32) {
    261 	syscall.Syscall(gpGetFloati_vEXT, 3, uintptr(pname), uintptr(index), uintptr(unsafe.Pointer(params)))
    262 }
    263 
    264 func GetIntegeri_v(target uint32, index uint32, data *int32) {
    265 	syscall.Syscall(gpGetIntegeri_v, 3, uintptr(target), uintptr(index), uintptr(unsafe.Pointer(data)))
    266 }
    267 func GetIntegerui64i_vNV(value uint32, index uint32, result *uint64) {
    268 	syscall.Syscall(gpGetIntegerui64i_vNV, 3, uintptr(value), uintptr(index), uintptr(unsafe.Pointer(result)))
    269 }
    270 func GetIntegerv(pname uint32, data *int32) {
    271 	syscall.Syscall(gpGetIntegerv, 2, uintptr(pname), uintptr(unsafe.Pointer(data)), 0)
    272 }
    273 
    274 func GetPointeri_vEXT(pname uint32, index uint32, params *unsafe.Pointer) {
    275 	syscall.Syscall(gpGetPointeri_vEXT, 3, uintptr(pname), uintptr(index), uintptr(unsafe.Pointer(params)))
    276 }
    277 
    278 func GetProgramInfoLog(program uint32, bufSize int32, length *int32, infoLog *uint8) {
    279 	syscall.Syscall6(gpGetProgramInfoLog, 4, uintptr(program), uintptr(bufSize), uintptr(unsafe.Pointer(length)), uintptr(unsafe.Pointer(infoLog)), 0, 0)
    280 }
    281 
    282 func GetProgramiv(program uint32, pname uint32, params *int32) {
    283 	syscall.Syscall(gpGetProgramiv, 3, uintptr(program), uintptr(pname), uintptr(unsafe.Pointer(params)))
    284 }
    285 
    286 func GetShaderInfoLog(shader uint32, bufSize int32, length *int32, infoLog *uint8) {
    287 	syscall.Syscall6(gpGetShaderInfoLog, 4, uintptr(shader), uintptr(bufSize), uintptr(unsafe.Pointer(length)), uintptr(unsafe.Pointer(infoLog)), 0, 0)
    288 }
    289 
    290 func GetShaderiv(shader uint32, pname uint32, params *int32) {
    291 	syscall.Syscall(gpGetShaderiv, 3, uintptr(shader), uintptr(pname), uintptr(unsafe.Pointer(params)))
    292 }
    293 
    294 func GetTransformFeedbacki64_v(xfb uint32, pname uint32, index uint32, param *int64) {
    295 	syscall.Syscall6(gpGetTransformFeedbacki64_v, 4, uintptr(xfb), uintptr(pname), uintptr(index), uintptr(unsafe.Pointer(param)), 0, 0)
    296 }
    297 func GetTransformFeedbacki_v(xfb uint32, pname uint32, index uint32, param *int32) {
    298 	syscall.Syscall6(gpGetTransformFeedbacki_v, 4, uintptr(xfb), uintptr(pname), uintptr(index), uintptr(unsafe.Pointer(param)), 0, 0)
    299 }
    300 
    301 func GetUniformLocation(program uint32, name *uint8) int32 {
    302 	ret, _, _ := syscall.Syscall(gpGetUniformLocation, 2, uintptr(program), uintptr(unsafe.Pointer(name)), 0)
    303 	return (int32)(ret)
    304 }
    305 
    306 func GetUnsignedBytei_vEXT(target uint32, index uint32, data *uint8) {
    307 	syscall.Syscall(gpGetUnsignedBytei_vEXT, 3, uintptr(target), uintptr(index), uintptr(unsafe.Pointer(data)))
    308 }
    309 func GetVertexArrayIntegeri_vEXT(vaobj uint32, index uint32, pname uint32, param *int32) {
    310 	syscall.Syscall6(gpGetVertexArrayIntegeri_vEXT, 4, uintptr(vaobj), uintptr(index), uintptr(pname), uintptr(unsafe.Pointer(param)), 0, 0)
    311 }
    312 func GetVertexArrayPointeri_vEXT(vaobj uint32, index uint32, pname uint32, param *unsafe.Pointer) {
    313 	syscall.Syscall6(gpGetVertexArrayPointeri_vEXT, 4, uintptr(vaobj), uintptr(index), uintptr(pname), uintptr(unsafe.Pointer(param)), 0, 0)
    314 }
    315 
    316 func IsFramebufferEXT(framebuffer uint32) bool {
    317 	ret, _, _ := syscall.Syscall(gpIsFramebufferEXT, 1, uintptr(framebuffer), 0, 0)
    318 	return byte(ret) != 0
    319 }
    320 
    321 func IsProgram(program uint32) bool {
    322 	ret, _, _ := syscall.Syscall(gpIsProgram, 1, uintptr(program), 0, 0)
    323 	return byte(ret) != 0
    324 }
    325 
    326 func IsRenderbufferEXT(renderbuffer uint32) bool {
    327 	ret, _, _ := syscall.Syscall(gpIsRenderbufferEXT, 1, uintptr(renderbuffer), 0, 0)
    328 	return byte(ret) != 0
    329 }
    330 
    331 func IsTexture(texture uint32) bool {
    332 	ret, _, _ := syscall.Syscall(gpIsTexture, 1, uintptr(texture), 0, 0)
    333 	return byte(ret) != 0
    334 }
    335 
    336 func LinkProgram(program uint32) {
    337 	syscall.Syscall(gpLinkProgram, 1, uintptr(program), 0, 0)
    338 }
    339 
    340 func PixelStorei(pname uint32, param int32) {
    341 	syscall.Syscall(gpPixelStorei, 2, uintptr(pname), uintptr(param), 0)
    342 }
    343 
    344 func ReadPixels(x int32, y int32, width int32, height int32, format uint32, xtype uint32, pixels unsafe.Pointer) {
    345 	syscall.Syscall9(gpReadPixels, 7, uintptr(x), uintptr(y), uintptr(width), uintptr(height), uintptr(format), uintptr(xtype), uintptr(pixels), 0, 0)
    346 }
    347 
    348 func RenderbufferStorageEXT(target uint32, internalformat uint32, width int32, height int32) {
    349 	syscall.Syscall6(gpRenderbufferStorageEXT, 4, uintptr(target), uintptr(internalformat), uintptr(width), uintptr(height), 0, 0)
    350 }
    351 
    352 func Scissor(x int32, y int32, width int32, height int32) {
    353 	syscall.Syscall6(gpScissor, 4, uintptr(x), uintptr(y), uintptr(width), uintptr(height), 0, 0)
    354 }
    355 
    356 func ShaderSource(shader uint32, count int32, xstring **uint8, length *int32) {
    357 	syscall.Syscall6(gpShaderSource, 4, uintptr(shader), uintptr(count), uintptr(unsafe.Pointer(xstring)), uintptr(unsafe.Pointer(length)), 0, 0)
    358 }
    359 
    360 func StencilFunc(xfunc uint32, ref int32, mask uint32) {
    361 	syscall.Syscall(gpStencilFunc, 3, uintptr(xfunc), uintptr(ref), uintptr(mask))
    362 }
    363 
    364 func StencilOp(fail uint32, zfail uint32, zpass uint32) {
    365 	syscall.Syscall(gpStencilOp, 3, uintptr(fail), uintptr(zfail), uintptr(zpass))
    366 }
    367 
    368 func TexImage2D(target uint32, level int32, internalformat int32, width int32, height int32, border int32, format uint32, xtype uint32, pixels unsafe.Pointer) {
    369 	syscall.Syscall9(gpTexImage2D, 9, uintptr(target), uintptr(level), uintptr(internalformat), uintptr(width), uintptr(height), uintptr(border), uintptr(format), uintptr(xtype), uintptr(pixels))
    370 }
    371 
    372 func TexParameteri(target uint32, pname uint32, param int32) {
    373 	syscall.Syscall(gpTexParameteri, 3, uintptr(target), uintptr(pname), uintptr(param))
    374 }
    375 
    376 func TexSubImage2D(target uint32, level int32, xoffset int32, yoffset int32, width int32, height int32, format uint32, xtype uint32, pixels unsafe.Pointer) {
    377 	syscall.Syscall9(gpTexSubImage2D, 9, uintptr(target), uintptr(level), uintptr(xoffset), uintptr(yoffset), uintptr(width), uintptr(height), uintptr(format), uintptr(xtype), uintptr(pixels))
    378 }
    379 
    380 func Uniform1f(location int32, v0 float32) {
    381 	syscall.Syscall(gpUniform1f, 2, uintptr(location), uintptr(math.Float32bits(v0)), 0)
    382 }
    383 
    384 func Uniform1i(location int32, v0 int32) {
    385 	syscall.Syscall(gpUniform1i, 2, uintptr(location), uintptr(v0), 0)
    386 }
    387 
    388 func Uniform1fv(location int32, count int32, value *float32) {
    389 	syscall.Syscall(gpUniform1fv, 3, uintptr(location), uintptr(count), uintptr(unsafe.Pointer(value)))
    390 }
    391 
    392 func Uniform2fv(location int32, count int32, value *float32) {
    393 	syscall.Syscall(gpUniform2fv, 3, uintptr(location), uintptr(count), uintptr(unsafe.Pointer(value)))
    394 }
    395 
    396 func Uniform3fv(location int32, count int32, value *float32) {
    397 	syscall.Syscall(gpUniform3fv, 3, uintptr(location), uintptr(count), uintptr(unsafe.Pointer(value)))
    398 }
    399 
    400 func Uniform4fv(location int32, count int32, value *float32) {
    401 	syscall.Syscall(gpUniform4fv, 3, uintptr(location), uintptr(count), uintptr(unsafe.Pointer(value)))
    402 }
    403 
    404 func UniformMatrix2fv(location int32, count int32, transpose bool, value *float32) {
    405 	syscall.Syscall6(gpUniformMatrix2fv, 4, uintptr(location), uintptr(count), boolToUintptr(transpose), uintptr(unsafe.Pointer(value)), 0, 0)
    406 }
    407 
    408 func UniformMatrix3fv(location int32, count int32, transpose bool, value *float32) {
    409 	syscall.Syscall6(gpUniformMatrix3fv, 4, uintptr(location), uintptr(count), boolToUintptr(transpose), uintptr(unsafe.Pointer(value)), 0, 0)
    410 }
    411 
    412 func UniformMatrix4fv(location int32, count int32, transpose bool, value *float32) {
    413 	syscall.Syscall6(gpUniformMatrix4fv, 4, uintptr(location), uintptr(count), boolToUintptr(transpose), uintptr(unsafe.Pointer(value)), 0, 0)
    414 }
    415 
    416 func UseProgram(program uint32) {
    417 	syscall.Syscall(gpUseProgram, 1, uintptr(program), 0, 0)
    418 }
    419 
    420 func VertexAttribPointer(index uint32, size int32, xtype uint32, normalized bool, stride int32, pointer uintptr) {
    421 	syscall.Syscall6(gpVertexAttribPointer, 6, uintptr(index), uintptr(size), uintptr(xtype), boolToUintptr(normalized), uintptr(stride), uintptr(pointer))
    422 }
    423 
    424 func Viewport(x int32, y int32, width int32, height int32) {
    425 	syscall.Syscall6(gpViewport, 4, uintptr(x), uintptr(y), uintptr(width), uintptr(height), 0, 0)
    426 }
    427 
    428 // InitWithProcAddrFunc intializes the package using the specified OpenGL
    429 // function pointer loading function.
    430 //
    431 // For more cases Init should be used.
    432 func InitWithProcAddrFunc(getProcAddr func(name string) uintptr) error {
    433 	gpActiveTexture = getProcAddr("glActiveTexture")
    434 	if gpActiveTexture == 0 {
    435 		return errors.New("glActiveTexture")
    436 	}
    437 	gpAttachShader = getProcAddr("glAttachShader")
    438 	if gpAttachShader == 0 {
    439 		return errors.New("glAttachShader")
    440 	}
    441 	gpBindAttribLocation = getProcAddr("glBindAttribLocation")
    442 	if gpBindAttribLocation == 0 {
    443 		return errors.New("glBindAttribLocation")
    444 	}
    445 	gpBindBuffer = getProcAddr("glBindBuffer")
    446 	if gpBindBuffer == 0 {
    447 		return errors.New("glBindBuffer")
    448 	}
    449 	gpBindFramebufferEXT = getProcAddr("glBindFramebufferEXT")
    450 	gpBindRenderbufferEXT = getProcAddr("glBindRenderbufferEXT")
    451 	gpBindTexture = getProcAddr("glBindTexture")
    452 	if gpBindTexture == 0 {
    453 		return errors.New("glBindTexture")
    454 	}
    455 	gpBlendFunc = getProcAddr("glBlendFunc")
    456 	if gpBlendFunc == 0 {
    457 		return errors.New("glBlendFunc")
    458 	}
    459 	gpBufferData = getProcAddr("glBufferData")
    460 	if gpBufferData == 0 {
    461 		return errors.New("glBufferData")
    462 	}
    463 	gpBufferSubData = getProcAddr("glBufferSubData")
    464 	if gpBufferSubData == 0 {
    465 		return errors.New("glBufferSubData")
    466 	}
    467 	gpCheckFramebufferStatusEXT = getProcAddr("glCheckFramebufferStatusEXT")
    468 	gpClear = getProcAddr("glClear")
    469 	if gpClear == 0 {
    470 		return errors.New("glClear")
    471 	}
    472 	gpColorMask = getProcAddr("glColorMask")
    473 	if gpColorMask == 0 {
    474 		return errors.New("glColorMask")
    475 	}
    476 	gpCompileShader = getProcAddr("glCompileShader")
    477 	if gpCompileShader == 0 {
    478 		return errors.New("glCompileShader")
    479 	}
    480 	gpCreateProgram = getProcAddr("glCreateProgram")
    481 	if gpCreateProgram == 0 {
    482 		return errors.New("glCreateProgram")
    483 	}
    484 	gpCreateShader = getProcAddr("glCreateShader")
    485 	if gpCreateShader == 0 {
    486 		return errors.New("glCreateShader")
    487 	}
    488 	gpDeleteBuffers = getProcAddr("glDeleteBuffers")
    489 	if gpDeleteBuffers == 0 {
    490 		return errors.New("glDeleteBuffers")
    491 	}
    492 	gpDeleteFramebuffersEXT = getProcAddr("glDeleteFramebuffersEXT")
    493 	gpDeleteProgram = getProcAddr("glDeleteProgram")
    494 	if gpDeleteProgram == 0 {
    495 		return errors.New("glDeleteProgram")
    496 	}
    497 	gpDeleteRenderbuffersEXT = getProcAddr("glDeleteRenderbuffersEXT")
    498 	gpDeleteShader = getProcAddr("glDeleteShader")
    499 	if gpDeleteShader == 0 {
    500 		return errors.New("glDeleteShader")
    501 	}
    502 	gpDeleteTextures = getProcAddr("glDeleteTextures")
    503 	if gpDeleteTextures == 0 {
    504 		return errors.New("glDeleteTextures")
    505 	}
    506 	gpDisable = getProcAddr("glDisable")
    507 	if gpDisable == 0 {
    508 		return errors.New("glDisable")
    509 	}
    510 	gpDisableVertexAttribArray = getProcAddr("glDisableVertexAttribArray")
    511 	if gpDisableVertexAttribArray == 0 {
    512 		return errors.New("glDisableVertexAttribArray")
    513 	}
    514 	gpDrawElements = getProcAddr("glDrawElements")
    515 	if gpDrawElements == 0 {
    516 		return errors.New("glDrawElements")
    517 	}
    518 	gpEnable = getProcAddr("glEnable")
    519 	if gpEnable == 0 {
    520 		return errors.New("glEnable")
    521 	}
    522 	gpEnableVertexAttribArray = getProcAddr("glEnableVertexAttribArray")
    523 	if gpEnableVertexAttribArray == 0 {
    524 		return errors.New("glEnableVertexAttribArray")
    525 	}
    526 	gpFlush = getProcAddr("glFlush")
    527 	if gpFlush == 0 {
    528 		return errors.New("glFlush")
    529 	}
    530 	gpFramebufferRenderbufferEXT = getProcAddr("glFramebufferRenderbufferEXT")
    531 	gpFramebufferTexture2DEXT = getProcAddr("glFramebufferTexture2DEXT")
    532 	gpGenBuffers = getProcAddr("glGenBuffers")
    533 	if gpGenBuffers == 0 {
    534 		return errors.New("glGenBuffers")
    535 	}
    536 	gpGenFramebuffersEXT = getProcAddr("glGenFramebuffersEXT")
    537 	gpGenRenderbuffersEXT = getProcAddr("glGenRenderbuffersEXT")
    538 	gpGenTextures = getProcAddr("glGenTextures")
    539 	if gpGenTextures == 0 {
    540 		return errors.New("glGenTextures")
    541 	}
    542 	gpGetBufferSubData = getProcAddr("glGetBufferSubData")
    543 	if gpGetBufferSubData == 0 {
    544 		return errors.New("glGetBufferSubData")
    545 	}
    546 	gpGetDoublei_v = getProcAddr("glGetDoublei_v")
    547 	gpGetDoublei_vEXT = getProcAddr("glGetDoublei_vEXT")
    548 	gpGetError = getProcAddr("glGetError")
    549 	if gpGetError == 0 {
    550 		return errors.New("glGetError")
    551 	}
    552 	gpGetFloati_v = getProcAddr("glGetFloati_v")
    553 	gpGetFloati_vEXT = getProcAddr("glGetFloati_vEXT")
    554 	gpGetIntegeri_v = getProcAddr("glGetIntegeri_v")
    555 	gpGetIntegerui64i_vNV = getProcAddr("glGetIntegerui64i_vNV")
    556 	gpGetIntegerv = getProcAddr("glGetIntegerv")
    557 	if gpGetIntegerv == 0 {
    558 		return errors.New("glGetIntegerv")
    559 	}
    560 	gpGetPointeri_vEXT = getProcAddr("glGetPointeri_vEXT")
    561 	gpGetProgramInfoLog = getProcAddr("glGetProgramInfoLog")
    562 	if gpGetProgramInfoLog == 0 {
    563 		return errors.New("glGetProgramInfoLog")
    564 	}
    565 	gpGetProgramiv = getProcAddr("glGetProgramiv")
    566 	if gpGetProgramiv == 0 {
    567 		return errors.New("glGetProgramiv")
    568 	}
    569 	gpGetShaderInfoLog = getProcAddr("glGetShaderInfoLog")
    570 	if gpGetShaderInfoLog == 0 {
    571 		return errors.New("glGetShaderInfoLog")
    572 	}
    573 	gpGetShaderiv = getProcAddr("glGetShaderiv")
    574 	if gpGetShaderiv == 0 {
    575 		return errors.New("glGetShaderiv")
    576 	}
    577 	gpGetTransformFeedbacki64_v = getProcAddr("glGetTransformFeedbacki64_v")
    578 	gpGetTransformFeedbacki_v = getProcAddr("glGetTransformFeedbacki_v")
    579 	gpGetUniformLocation = getProcAddr("glGetUniformLocation")
    580 	if gpGetUniformLocation == 0 {
    581 		return errors.New("glGetUniformLocation")
    582 	}
    583 	gpGetUnsignedBytei_vEXT = getProcAddr("glGetUnsignedBytei_vEXT")
    584 	gpGetVertexArrayIntegeri_vEXT = getProcAddr("glGetVertexArrayIntegeri_vEXT")
    585 	gpGetVertexArrayPointeri_vEXT = getProcAddr("glGetVertexArrayPointeri_vEXT")
    586 	gpIsFramebufferEXT = getProcAddr("glIsFramebufferEXT")
    587 	gpIsProgram = getProcAddr("glIsProgram")
    588 	if gpIsProgram == 0 {
    589 		return errors.New("glIsProgram")
    590 	}
    591 	gpIsRenderbufferEXT = getProcAddr("glIsRenderbufferEXT")
    592 	gpIsTexture = getProcAddr("glIsTexture")
    593 	if gpIsTexture == 0 {
    594 		return errors.New("glIsTexture")
    595 	}
    596 	gpLinkProgram = getProcAddr("glLinkProgram")
    597 	if gpLinkProgram == 0 {
    598 		return errors.New("glLinkProgram")
    599 	}
    600 	gpPixelStorei = getProcAddr("glPixelStorei")
    601 	if gpPixelStorei == 0 {
    602 		return errors.New("glPixelStorei")
    603 	}
    604 	gpReadPixels = getProcAddr("glReadPixels")
    605 	if gpReadPixels == 0 {
    606 		return errors.New("glReadPixels")
    607 	}
    608 	gpRenderbufferStorageEXT = getProcAddr("glRenderbufferStorageEXT")
    609 	gpScissor = getProcAddr("glScissor")
    610 	if gpScissor == 0 {
    611 		return errors.New("glScissor")
    612 	}
    613 	gpShaderSource = getProcAddr("glShaderSource")
    614 	if gpShaderSource == 0 {
    615 		return errors.New("glShaderSource")
    616 	}
    617 	gpStencilFunc = getProcAddr("glStencilFunc")
    618 	if gpStencilFunc == 0 {
    619 		return errors.New("glStencilFunc")
    620 	}
    621 	gpStencilOp = getProcAddr("glStencilOp")
    622 	if gpStencilOp == 0 {
    623 		return errors.New("glStencilOp")
    624 	}
    625 	gpTexImage2D = getProcAddr("glTexImage2D")
    626 	if gpTexImage2D == 0 {
    627 		return errors.New("glTexImage2D")
    628 	}
    629 	gpTexParameteri = getProcAddr("glTexParameteri")
    630 	if gpTexParameteri == 0 {
    631 		return errors.New("glTexParameteri")
    632 	}
    633 	gpTexSubImage2D = getProcAddr("glTexSubImage2D")
    634 	if gpTexSubImage2D == 0 {
    635 		return errors.New("glTexSubImage2D")
    636 	}
    637 	gpUniform1f = getProcAddr("glUniform1f")
    638 	if gpUniform1f == 0 {
    639 		return errors.New("glUniform1f")
    640 	}
    641 	gpUniform1i = getProcAddr("glUniform1i")
    642 	if gpUniform1i == 0 {
    643 		return errors.New("glUniform1i")
    644 	}
    645 	gpUniform1fv = getProcAddr("glUniform1fv")
    646 	if gpUniform1fv == 0 {
    647 		return errors.New("glUniform1fv")
    648 	}
    649 	gpUniform2fv = getProcAddr("glUniform2fv")
    650 	if gpUniform2fv == 0 {
    651 		return errors.New("glUniform2fv")
    652 	}
    653 	gpUniform3fv = getProcAddr("glUniform3fv")
    654 	if gpUniform3fv == 0 {
    655 		return errors.New("glUniform3fv")
    656 	}
    657 	gpUniform4fv = getProcAddr("glUniform4fv")
    658 	if gpUniform4fv == 0 {
    659 		return errors.New("glUniform4fv")
    660 	}
    661 	gpUniformMatrix2fv = getProcAddr("glUniformMatrix2fv")
    662 	if gpUniformMatrix2fv == 0 {
    663 		return errors.New("glUniformMatrix2fv")
    664 	}
    665 	gpUniformMatrix3fv = getProcAddr("glUniformMatrix3fv")
    666 	if gpUniformMatrix3fv == 0 {
    667 		return errors.New("glUniformMatrix3fv")
    668 	}
    669 	gpUniformMatrix4fv = getProcAddr("glUniformMatrix4fv")
    670 	if gpUniformMatrix4fv == 0 {
    671 		return errors.New("glUniformMatrix4fv")
    672 	}
    673 	gpUseProgram = getProcAddr("glUseProgram")
    674 	if gpUseProgram == 0 {
    675 		return errors.New("glUseProgram")
    676 	}
    677 	gpVertexAttribPointer = getProcAddr("glVertexAttribPointer")
    678 	if gpVertexAttribPointer == 0 {
    679 		return errors.New("glVertexAttribPointer")
    680 	}
    681 	gpViewport = getProcAddr("glViewport")
    682 	if gpViewport == 0 {
    683 		return errors.New("glViewport")
    684 	}
    685 	return nil
    686 }