资源简介
OpenGL环境配置全文件,与博客教程:OpenGL红宝书第九版环境配置(VS2017)相配套
代码片段和文件信息
#include
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN 1
#include
static HMODULE libgl;
static void open_libgl(void)
{
libgl = LoadLibraryA(“opengl32.dll“);
}
static void close_libgl(void)
{
FreeLibrary(libgl);
}
static GL3WglProc get_proc(const char *proc)
{
GL3WglProc res;
res = (GL3WglProc) wglGetProcAddress(proc);
if (!res)
res = (GL3WglProc) GetProcAddress(libgl proc);
return res;
}
#elif defined(__APPLE__) || defined(__APPLE_CC__)
#include
CFBundleRef bundle;
CFURLRef bundleURL;
static void open_libgl(void)
{
bundleURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault
CFSTR(“/System/Library/frameworks/OpenGL.framework“)
kCFURLPOSIXPathstyle true);
bundle = CFBundleCreate(kCFAllocatorDefault bundleURL);
assert(bundle != NULL);
}
static void close_libgl(void)
{
CFRelease(bundle);
CFRelease(bundleURL);
}
static GL3WglProc get_proc(const char *proc)
{
GL3WglProc res;
CFStringRef procname = CFStringCreateWithCString(kCFAllocatorDefault proc
kCFStringEncodingASCII);
res = (GL3WglProc) CFBundleGetFunctionPointerForName(bundle procname);
CFRelease(procname);
return res;
}
#else
#include
#include
static void *libgl;
static void open_libgl(void)
{
libgl = dlopen(“libGL.so.1“ RTLD_LAZY | RTLD_GLOBAL);
}
static void close_libgl(void)
{
dlclose(libgl);
}
static GL3WglProc get_proc(const char *proc)
{
GL3WglProc res;
res = (GL3WglProc) glXGetProcAddress((const GLubyte *) proc);
if (!res)
res = (GL3WglProc) dlsym(libgl proc);
return res;
}
#endif
static struct {
int major minor;
} version;
static int parse_version(void)
{
if (!glGetIntegerv)
return -1;
glGetIntegerv(GL_MAJOR_VERSION &version.major);
glGetIntegerv(GL_MINOR_VERSION &version.minor);
if (version.major < 3)
return -1;
return 0;
}
static void load_procs(void);
int gl3wInit(void)
{
open_libgl();
load_procs();
close_libgl();
return parse_version();
}
int gl3wIsSupported(int major int minor)
{
if (major < 3)
return 0;
if (version.major == major)
return version.minor >= minor;
return version.major >= major;
}
GL3WglProc gl3wGetProcAddress(const char *proc)
{
return get_proc(proc);
}
PFNGLCULLFACEPROC gl3wCullFace;
PFNGLFRONTFACEPROC gl3wFrontFace;
PFNGLHINTPROC gl3wHint;
PFNGLLINEWIDTHPROC gl3wLineWidth;
PFNGLPOINTSIZEPROC gl3wPointSize;
PFNGLPOLYGONMODEPROC gl3wPolygonMode;
PFNGLSCISSORPROC gl3wScissor;
PFNGLTEXPARAMETERFPROC gl3wTexParameterf;
PFNGLTEXPARAMETERFVPROC gl3wTexParameterfv;
PFNGLTEXPARAMETERIPROC gl3wTexParameteri;
PFNGLTEXPARAMETERIVPROC gl3wTexParameteriv;
PFNGLTEXIMAGE1DPROC gl3wTexImage1D;
PFNGLTEXIMAGE2DPROC gl3wTexImage2D;
PFNGLDRAWBUFFERPROC gl3wDrawBuffer;
PFNGLCLEARPROC gl3wClear;
PFNGLCLEARCOLORPROC gl3wClearColor;
PFNGLCLEARSTENCILPROC gl3wClearStencil;
PFNGLCLEARDEPTHPROC gl3wClearDepth;
PFNGLSTENCILMASKPROC gl3wStencilMask;
PFNGLCOLORMASKPROC gl3wColorMask;
PFNGLDEPTHMASKPROC gl3wDepthMask;
PFNGLDISABLEPROC gl3wDisabl
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-12-02 22:05 OGLPG-9th-Edition\
目录 0 2018-12-02 22:05 OGLPG-9th-Edition\OGLPG-9th-Edition\
文件 16 2016-09-09 01:19 OGLPG-9th-Edition\OGLPG-9th-Edition\.gitignore
文件 2941 2016-09-09 01:19 OGLPG-9th-Edition\OGLPG-9th-Edition\CMakeLists.txt
文件 2076 2016-09-09 01:19 OGLPG-9th-Edition\OGLPG-9th-Edition\README.md
目录 0 2018-12-02 22:05 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\
目录 0 2018-12-02 22:05 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\
目录 0 2018-12-02 22:05 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\
目录 0 2018-12-02 22:05 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\doublewrite\
文件 346 2016-09-09 01:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\doublewrite\blit.fs.glsl
文件 86 2016-09-09 01:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\doublewrite\blit.vs.glsl
文件 742 2016-09-09 01:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\doublewrite\double_write.fs.glsl
文件 956 2016-09-09 01:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\doublewrite\double_write.vs.glsl
目录 0 2018-12-02 22:05 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\gouraud\
文件 91 2016-09-09 01:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\gouraud\gouraud.frag
文件 185 2016-09-09 01:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\gouraud\gouraud.vert
目录 0 2018-12-02 22:05 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\keypress\
文件 95 2016-09-09 01:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\keypress\keypress.frag
文件 108 2016-09-09 01:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\keypress\keypress.vert
目录 0 2018-12-02 22:05 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\oit\
文件 1335 2016-09-09 01:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\oit\build_lists.fs.glsl
文件 951 2016-09-09 01:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\oit\build_lists.vs.glsl
文件 2053 2016-09-09 01:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\oit\resolve_lists.fs.glsl
文件 86 2016-09-09 01:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\oit\resolve_lists.vs.glsl
目录 0 2018-12-02 22:05 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\overdrawcount\
文件 344 2016-09-09 01:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\overdrawcount\blit.fs.glsl
文件 86 2016-09-09 01:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\overdrawcount\blit.vs.glsl
文件 531 2016-09-09 01:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\overdrawcount\overdraw_count.fs.glsl
文件 956 2016-09-09 01:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\overdrawcount\overdraw_count.vs.glsl
目录 0 2018-12-02 22:05 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\pointsprites\
文件 169 2016-09-09 01:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\pointsprites\pointsprites.fs.glsl
............此处省略1162个文件信息
相关资源
- openGL构造教室.docx
- 第一人称3D射击游戏源代码OpenGL
- 实现鼠标点击图形填充
- glfw-3.3.zip
- OpenGL所有库OpenGL,freeglut、glu、glut、
- VS下QT实现仿真小飞机
- opengl实现光线跟踪算法
- OpenGL编程指南第九版红宝书
- vs2019番茄插件亲测可用
- 三维迷宫游戏源代码及可执行文件
- OpenCV 4.2.0 Visual Studio 2017 32位 版本
- VS2013~VS2017番茄助手破解版
- OpenGL_读取PLY文件+光照
- 研究生计算机图形学课件OpenGL
- OPENGL扫描线填充算法
- OpenGL ES 3.x游戏开发 上卷 吴亚峰.pdf
- 基于VS2017+opencv3.4.3的立体匹配SGBM与
- 用OpenGL绘制的二维动物
- opengl编写3D的CS小游戏,可运行
- 基于opengl的粒子系统
- 利用OpenGL自编程实现球体源码——网
- OpenGL Development Cookbook PDF + vs2015源碼
- OpenGL.Superbible.7th.Edition(pdfandsourceco
- OpenGL着色语言(中文版
- OpenGL编程指南第九版英文
- 6轴机械手正解,反解算法;vs2017工程
- 计算机图形学OpenGL第三版带完整目录
- 一个用 opengl 开发的雪花动画
- Computer Graphics Using OpenGL (3rd Edition)
- Visual Assist X 亲测可用VS2017
评论
共有 条评论