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