How to use GLEW from Kotlin? Functions like `glCre...
# kotlin-native
m
How to use GLEW from Kotlin? Functions like
glCreateShader
are defined with preprocessor macro:
#define glCreateShader GLEW_GET_FUN(__glewCreateShader)
where macro is defined as
#define GLEW_GET_FUN(x) x
but in klib there is only
__glewCreateShader
variable
Copy code
public var __glewCreateShader: glew.PFNGLCREATESHADERPROC? /* = kotlinx.cinterop.CPointer<kotlinx.cinterop.CFunction<(glew.GLenum /* = kotlin.UInt */) -> glew.GLuint /* = kotlin.UInt */>>? */ /* compiled code */
and not the function.
d
If you can't be arsed to build glagogen.
m
@Dominaezzz I am already compiling GLEW and GLFW using cmake as part of build process, as I want it to be completely automatic. How was the file you posted created?
@msink So there's no easy way to just integrate GLEW to kotlin/native build. Either rewrite the library to be supported by cinterop or use different library/tool (galogen for example), or write custom one. Do I understand it correctly?
👍🏼 1
d
I wrote a script to generate it from the official OpenGL spec (gl.xml). Haven't published it anywhere though. Might make a plugin.
m
AFAIK for now galogen is the only working solution, if someone can share similar tool but written in Kotlin - would be great.