Yes, or create an include one time and you are done.applePi wrote: do i need always to write something like that
Prototype PFNGLGENBUFFERSPROC ( n.i, *buffers)
Global glGenBuffers.PFNGLGENBUFFERSPROC
and so on ...
Because that include was using a CORE profile with opengl 3.3, so xorc1zt imported the glGenBuffers-related command that are CERTAINLY available as core functions starting from opengl 1.5 (so from 2003). They are always available in 3.3.applePi wrote: i don't find glGenBuffers and related functions in the OpenGL.pbi nor in the include files for opengl 4.x , but i saw it in the xorc1zt include file in the OpenGL 3.3 Base (windows) posted 2 years ago
If you use what PB make available by default (I believe a COMPATIBILITY profile with the highest possible GL version made available from your opengl driver) you have two choices:
1) test for the opengl version and import and use the glGenBuffers command right away without further testing because they should be here if the version is >= 1.5
2) test for one of the extensions implementing those commands (if there is more than one, and in that case select ARB extensions when available) and if it is available import the commands
The 2 is the best approach and avoid problems and has the advantage it can work with versions lower than 1.5, since the commands are CORE there but they can easily be available as extensions in previous versions.
The extension you want to test for is probably ARB_vertex_buffer_object
https://www.opengl.org/registry/specs/A ... object.txt
The correct way to do so is to create a RC, load the list of extensions, check if the string GL_ARB_vertex_buffer_object is present, and if true import the functions and define the constant listed in the specifications linked above.
The include above defines just the constants up to the GL version specified, does not import the functions. It's half of what needed we can say. It's all that's needed for opengl 1.1 (what PB make available pre imported if I'm not mistaken) and for almost any extension if you take care of importing the functions.
By the way, your code need something like this to work in unicode, if you care about it (the purebasic import should be changed I guess)
Code: Select all
CompilerIf (#PB_Compiler_Processor = #PB_Processor_x86)
Import "Opengl32.lib"
wglGetProcAddress_(s.p-ascii) As "_wglGetProcAddress@4"
EndImport
CompilerElse
Import "Opengl32.lib"
wglGetProcAddress_(s.p-ascii) As "wglGetProcAddress"
EndImport
CompilerEndIf