Memory allocation... Basic mistake.
VBO needs memory... Allocmem, Getmem, New...
Have you
ever used OpenGL?
Like @
zamtmn said, you'll have to call one of the
Load_GL_*** functions to initialize OpenGL before using it.
Because graphics drivers are very hardware-specific, they're loaded as dynamic libraries and can vary from host to host. FPC's OpenGL units declare all API functions as function pointers (initialized to
Nil) and resolves their actual values only when calling one of the aforementioned
Load_GL_*** functions, with each variant only resolving the functions that are required by that version of the OpenGL specification.
Looking at the OpenGL documentation for glGenBuffers and scrolling to the bottom of the page, we can see that it is only supported from version 2.0 and onwards, so you'll have to call
at least Load_GL_Version_2_0.
So in essence, the segfault you're getting has nothing to do with
@VBO, but with the fact that you're calling a function pointer whose value is
Nil (if you hover over
glGenBuffers in Lazarus you'll see that it is declared as a
var).