Skip to content
/ glad Public

GL/GLES/EGL/GLX/WGL C/c++ Loader generated based on the official specs

License

Notifications You must be signed in to change notification settings

ours1984/glad

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

glad

badgebadge license glad

GL/GLES/EGL/GLX/WGL C/C++ Loader generated based on the official specs

目录

背景

glad官方没有git仓库,所以再网页上针对特定版本导出c++的git仓库

安装

直接git克隆就可以了.

git clone https://github.com/ours1984/glad.git 

使用

打开GLAD的在线服务,将语言(Language)设置为C/C++,在API选项中,选择3.3以上的OpenGL(gl)版本。

之后将模式(Profile)设置为Core,并且保证选中了生成加载器(Generate a loader)选项。

扩展(Extensions)选中GL_ARB_point_sprite。都选择完之后,点击生成(Generate)按钮来生成库文件。

文件生成地址

https://glad.dav1d.de/#profile=core&language=c&specification=gl&loader=on&api=gl%3D3.3&extensions=GL_ARB_point_sprite

struct gladGLversionStruct {
    int major;
    int minor;
};

extern struct gladGLversionStruct GLVersion;

typedef void* (* GLADloadproc)(const char *name);

/*
 * Load OpenGL using the internal loader.
 * Returns the true/1 if loading succeeded.
 *
 */
int gladLoadGL(void);

/*
 * Load OpenGL using an external loader like SDL_GL_GetProcAddress.
 *
 * Substitute GL with the API you generated
 *
 */
int gladLoadGLLoader(GLADloadproc);

/**
 * WGL and GLX have an unload function to free the module handle.
 * Call the unload function after your last GLX or WGL API call.
 */
void gladUnloadGLX(void);
void gladUnloadWGL(void);

把 glad.h 替换掉任意的 gl.h or gl3.h 只能 include glad.h.

    if(!gladLoadGL()) { exit(-1); }
    printf("OpenGL Version %d.%d loaded", GLVersion.major, GLVersion.minor);

    if(GLAD_GL_EXT_framebuffer_multisample) {
        /* GL_EXT_framebuffer_multisample is supported */
    }

    if(GLAD_GL_VERSION_3_0) {
        /* We support at least OpenGL version 3 */
    }

贡献

PRs 是可以接受的.

About

GL/GLES/EGL/GLX/WGL C/c++ Loader generated based on the official specs

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published