Skip to content

Instantly share code, notes, and snippets.

@doughsay
Last active July 2, 2017 05:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doughsay/962eac49d11574a0f792b7d83138a5b0 to your computer and use it in GitHub Desktop.
Save doughsay/962eac49d11574a0f792b7d83138a5b0 to your computer and use it in GitHub Desktop.
crystal-opensl-problem
require "lib_gl"
x = [] of UInt32
# or x = uninitialized Pointer(UInt32)
# or x = [0_u32]
# From lib_gl:
# fun gen_buffers = "glGenBuffers"(n: Int32, buffers: UInt32*) : Void
LibGL.gen_buffers(1, x)
# This crashes with:
# Invalid memory access (signal 11) at address 0x1428
# [0x10560900b] *CallStack::print_backtrace:Int32 +107
# [0x1055f4a2c] __crystal_sigfault_handler +60
# [0x7fff90988b3a] _sigtramp +26
# [0x7fff7f455e83] glGenBuffers +19
# [0x1055e4836] __crystal_main +1222
# [0x1055f4928] main +40
# The function is meant to fill in the buffers array with buffer "names" (n uint32's; in the above example just 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment