exc bad access - glGenBuffers and many OpenGL function EXC_BAD_ACCESS in Macbook Air -
i have weird problem lot of opengl functions failed exc_bad_access in macbook air. simple function glgenbuffers or glgetstring(gl_vendor) result. run in xcode. , segmentation fault: 11 if run in terminal.
a example code failed:
#include<glut/glut.h> #include<opengl/gl.h> #include<opengl/glu.h> #include<opengl/glext.h> int main(){ unsigned int test[3]; glgenbuffers(3, test); return 0; }
i not sure whether problem system or not. using 2012 version of macbook air osx 10.8.2 .
where's opengl context creation code? need valid, active opengl context can access opengl @ all. including glext.h
declare glgenbuffers
function pointer must initialized through extension loading mechanism. without initializing pointer right opengl function, dereferencing (= calling it) cause segfault.
in macos x don't need glext.h
because opengl functions supported available version of macos x present in os x framework.
using extension mechanism makes sense if want support wide range of macos x versions.
Comments
Post a Comment