Difference between revisions of "Glloader/en"
Gongminmin (Talk | contribs) (Created page with "The glloader, a subproject of Klay Game Engine, is an OpenGL extension loading library. It supports OpenGL core 1.0 to 4.1, OpenGL ES core 1.0 to 2.0, as well as W...") |
Gongminmin (Talk | contribs) |
||
Line 7: | Line 7: | ||
== NOTE == | == NOTE == | ||
Please don't put [[glloader]] into a folder with non-english name. Or else it's possible that autogen.py can't run normally. | Please don't put [[glloader]] into a folder with non-english name. Or else it's possible that autogen.py can't run normally. | ||
+ | |||
+ | == Interface == | ||
+ | |||
+ | int glloader_is_supported(const char* name); | ||
+ | |||
+ | Find out if a particular feature is available on your platform. The parameter '''name''' is the name string. Returns non-zero means it's supported, or it'll return zero. | ||
+ | |||
+ | '''Note''': You can use name string "GL_VERSION_x_y" to determine if the x.y core version of OpenGL is supported. | ||
+ | |||
+ | |||
+ | void* glloader_get_gl_proc_address(const char* name); | ||
+ | |||
+ | Load a OpenGL function. The parameter '''name''' is the function's name. The return value is the address of the extension function. | ||
+ | |||
+ | '''Note''': When the function fails, there is '''NOT''' guarantee that the return value is NULL. | ||
+ | |||
+ | |||
+ | int glloader_num_features(); | ||
+ | |||
+ | Get the number of supported features, including the core and the extensions. | ||
+ | |||
+ | |||
+ | const char* glloader_get_feature_name(int index); | ||
+ | |||
+ | Get the name of a feature. The parameter '''index''''s range is [0, glloader_num_features() - 1]. | ||
+ | |||
+ | |||
+ | == Automatic Code Generater == | ||
+ | |||
+ | Because writting the loading code is very boring, I developed a automatic code generater to help writting the code. There are many xml files in the "./xml" directory. Each xml contains the typedefs, tokens, functions, and initializing path of an extension. Users can write their own xml scripts, the run "autogen.py". And it'll generate the loading code in src and include directories. | ||
+ | |||
+ | == Dependency == | ||
+ | Python 2.6 and up is required to run "autogen.py". |
Revision as of 21:39, 20 December 2010
The glloader, a subproject of Klay Game Engine, is an OpenGL extension loading library. It supports OpenGL core 1.0 to 4.1, OpenGL ES core 1.0 to 2.0, as well as WGL, GLX, and other GL extensions. There is a automatic code generater. All the things you want to do is to write a xml script if you have to support new extensions.
The glloader's primary feature is that it offers a initializing path of an extension. So if an extension has promoted into the core, the loader will try to load it from the core before try the extension one.
After setting include and lib directories, all you need to do is add #include <glloader/glloader.h> into your code.
NOTE
Please don't put glloader into a folder with non-english name. Or else it's possible that autogen.py can't run normally.
Interface
int glloader_is_supported(const char* name);
Find out if a particular feature is available on your platform. The parameter name is the name string. Returns non-zero means it's supported, or it'll return zero.
Note: You can use name string "GL_VERSION_x_y" to determine if the x.y core version of OpenGL is supported.
void* glloader_get_gl_proc_address(const char* name);
Load a OpenGL function. The parameter name is the function's name. The return value is the address of the extension function.
Note: When the function fails, there is NOT guarantee that the return value is NULL.
int glloader_num_features();
Get the number of supported features, including the core and the extensions.
const char* glloader_get_feature_name(int index);
Get the name of a feature. The parameter index's range is [0, glloader_num_features() - 1].
Automatic Code Generater
Because writting the loading code is very boring, I developed a automatic code generater to help writting the code. There are many xml files in the "./xml" directory. Each xml contains the typedefs, tokens, functions, and initializing path of an extension. Users can write their own xml scripts, the run "autogen.py". And it'll generate the loading code in src and include directories.
Dependency
Python 2.6 and up is required to run "autogen.py".