twitchapon-anim

Basic Twitchapon Receiver/Visuals
git clone git://bsandro.tech/twitchapon-anim
Log | Files | Refs | README | LICENSE

procaddr_notwindows.go (1523B)


      1 // SPDX-License-Identifier: MIT
      2 
      3 // +build !windows
      4 
      5 // This file implements GlowGetProcAddress for every supported platform. The
      6 // correct version is chosen automatically based on build tags:
      7 //
      8 // darwin: CGL
      9 // linux freebsd: GLX
     10 //
     11 // Use of EGL instead of the platform's default (listed above) is made possible
     12 // via the "egl" build tag.
     13 //
     14 // It is also possible to install your own function outside this package for
     15 // retrieving OpenGL function pointers, to do this see InitWithProcAddrFunc.
     16 
     17 package gl
     18 
     19 /*
     20 #cgo darwin CFLAGS: -DTAG_DARWIN
     21 #cgo darwin LDFLAGS: -framework OpenGL
     22 #cgo linux freebsd CFLAGS: -DTAG_POSIX
     23 #cgo linux freebsd pkg-config: gl
     24 #cgo egl CFLAGS: -DTAG_EGL
     25 #cgo egl pkg-config: egl
     26 // Check the EGL tag first as it takes priority over the platform's default
     27 // configuration of WGL/GLX/CGL.
     28 #if defined(TAG_EGL)
     29 	#include <stdlib.h>
     30 	#include <EGL/egl.h>
     31 	static void* GlowGetProcAddress_gl21(const char* name) {
     32 		return eglGetProcAddress(name);
     33 	}
     34 #elif defined(TAG_DARWIN)
     35 	#include <stdlib.h>
     36 	#include <dlfcn.h>
     37 	static void* GlowGetProcAddress_gl21(const char* name) {
     38 		return dlsym(RTLD_DEFAULT, name);
     39 	}
     40 #elif defined(TAG_POSIX)
     41 	#include <stdlib.h>
     42 	#include <GL/glx.h>
     43 	static void* GlowGetProcAddress_gl21(const char* name) {
     44 		return glXGetProcAddress((const GLubyte *) name);
     45 	}
     46 #endif
     47 */
     48 import "C"
     49 import "unsafe"
     50 
     51 func getProcAddress(namea string) unsafe.Pointer {
     52 	cname := C.CString(namea)
     53 	defer C.free(unsafe.Pointer(cname))
     54 	return C.GlowGetProcAddress_gl21(cname)
     55 }