ramiromagno / glfw

R Interface to the GLFW C Library
Other
5 stars 0 forks source link

macOS #4

Open coolbutuseless opened 1 month ago

coolbutuseless commented 1 month ago

I got it to compile OK on macOS using the following Makevars (with 'glfw` and 'glew' installed via homebrew)

PKG_CPPFLAGS = -I. -I/opt/homebrew/include
PKG_LIBS = -lglfw -lm -L/opt/homebrew/lib -framework Cocoa -framework OpenGL

However, trying to run camera_mouse_zoom.R fails here:

> program <- build_program(vert = vs, frag = fs)
Error in build_program(vert = vs, frag = fs) : 
  Validation Failed: No vertex array object bound.

sessionInfo()

R version 4.4.0 (2024-04-24)
Platform: aarch64-apple-darwin20
Running under: macOS Sonoma 14.5

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.0

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] magick_2.8.3 glfw_3.3.0  
ramiromagno commented 1 month ago

Thanks @coolbutuseless for reporting this issue. I need to get my hands on a macOS to debug this.

ramiromagno commented 1 month ago

As per this post: https://stackoverflow.com/questions/54181078/opengl-3-3-mac-error-validating-program-validation-failed-no-vertex-array-ob, could you try:

moving these lines:

vs <- system.file("tutorials/learnopengl/camera/camera.vs", package = "glfw")
fs <- system.file("tutorials/learnopengl/camera/camera.fs", package = "glfw")
program <- build_program(vert = vs, frag = fs)

to line 196 of camera_mouse_zoom.R:

gl_enable_vertex_attrib_array(1L)
coolbutuseless commented 1 month ago

Screenshot 2024-07-17 at 5 31 28 PM

That did the trick!

ramiromagno commented 1 month ago

That's awesome!