2019-09-22 17:42:51 +02:00
|
|
|
// SPDX-License-Identifier: MIT
|
2018-12-08 18:35:13 +01:00
|
|
|
|
2022-05-27 11:26:53 +02:00
|
|
|
//go:build !darwin && !windows
|
2018-12-08 18:35:13 +01:00
|
|
|
|
|
|
|
// This file implements GlowGetProcAddress for every supported platform. The
|
|
|
|
// correct version is chosen automatically based on build tags:
|
|
|
|
//
|
|
|
|
// darwin: CGL
|
2021-10-24 08:09:16 +02:00
|
|
|
// linux freebsd openbsd: GLX
|
2018-12-08 18:35:13 +01:00
|
|
|
//
|
|
|
|
// Use of EGL instead of the platform's default (listed above) is made possible
|
|
|
|
// via the "egl" build tag.
|
|
|
|
//
|
|
|
|
// It is also possible to install your own function outside this package for
|
|
|
|
// retrieving OpenGL function pointers, to do this see InitWithProcAddrFunc.
|
|
|
|
|
|
|
|
package gl
|
|
|
|
|
|
|
|
/*
|
2021-10-24 08:09:16 +02:00
|
|
|
#cgo linux freebsd openbsd CFLAGS: -DTAG_POSIX
|
2022-08-12 05:40:23 +02:00
|
|
|
#cgo linux,!nintendosdk freebsd,!nintendosdk openbsd,!nintendosdk pkg-config: gl
|
|
|
|
#cgo egl nintendosdk CFLAGS: -DTAG_EGL
|
|
|
|
#cgo egl,!nintendosdk pkg-config: egl
|
|
|
|
#cgo nintendosdk LDFLAGS: -Wl,-unresolved-symbols=ignore-all
|
2022-07-09 09:15:56 +02:00
|
|
|
|
2018-12-08 18:35:13 +01:00
|
|
|
// Check the EGL tag first as it takes priority over the platform's default
|
|
|
|
// configuration of WGL/GLX/CGL.
|
|
|
|
#if defined(TAG_EGL)
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <EGL/egl.h>
|
2019-01-17 13:27:58 +01:00
|
|
|
static void* GlowGetProcAddress_gl21(const char* name) {
|
2018-12-08 18:35:13 +01:00
|
|
|
return eglGetProcAddress(name);
|
|
|
|
}
|
|
|
|
#elif defined(TAG_POSIX)
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <GL/glx.h>
|
2019-01-17 13:27:58 +01:00
|
|
|
static void* GlowGetProcAddress_gl21(const char* name) {
|
2018-12-08 18:35:13 +01:00
|
|
|
return glXGetProcAddress((const GLubyte *) name);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
*/
|
|
|
|
import "C"
|
|
|
|
import "unsafe"
|
|
|
|
|
|
|
|
func getProcAddress(namea string) unsafe.Pointer {
|
|
|
|
cname := C.CString(namea)
|
|
|
|
defer C.free(unsafe.Pointer(cname))
|
|
|
|
return C.GlowGetProcAddress_gl21(cname)
|
|
|
|
}
|