资源简介
OpenGL编程指南(原书第9版)内附随书源代码
代码片段和文件信息
#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
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 52659062 2018-02-16 15:50 OpenGL编程指南(第九版英文).pdf
文件 16 2016-09-08 10:19 OGLPG-9th-Edition\OGLPG-9th-Edition\.gitignore
文件 346 2016-09-08 10:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\doublewrite\blit.fs.glsl
文件 86 2016-09-08 10:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\doublewrite\blit.vs.glsl
文件 742 2016-09-08 10:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\doublewrite\double_write.fs.glsl
文件 956 2016-09-08 10:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\doublewrite\double_write.vs.glsl
文件 91 2016-09-08 10:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\gouraud\gouraud.frag
文件 185 2016-09-08 10:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\gouraud\gouraud.vert
文件 95 2016-09-08 10:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\keypress\keypress.frag
文件 108 2016-09-08 10:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\keypress\keypress.vert
文件 1335 2016-09-08 10:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\oit\build_lists.fs.glsl
文件 951 2016-09-08 10:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\oit\build_lists.vs.glsl
文件 2053 2016-09-08 10:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\oit\resolve_lists.fs.glsl
文件 86 2016-09-08 10:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\oit\resolve_lists.vs.glsl
文件 344 2016-09-08 10:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\overdrawcount\blit.fs.glsl
文件 86 2016-09-08 10:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\overdrawcount\blit.vs.glsl
文件 531 2016-09-08 10:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\overdrawcount\overdraw_count.fs.glsl
文件 956 2016-09-08 10:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\overdrawcount\overdraw_count.vs.glsl
文件 169 2016-09-08 10:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\pointsprites\pointsprites.fs.glsl
文件 269 2016-09-08 10:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\pointsprites\pointsprites.vs.glsl
文件 357 2016-09-08 10:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\pointsprites\pointsprites2.fs.glsl
文件 120 2016-09-08 10:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\primitive_restart\primitive_restart.fs.glsl
文件 401 2016-09-08 10:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\primitive_restart\primitive_restart.vs.glsl
文件 856 2016-09-08 10:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\shadowmap\shadowmap_scene.fs.glsl
文件 704 2016-09-08 10:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\shadowmap\shadowmap_scene.vs.glsl
文件 96 2016-09-08 10:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\shadowmap\shadowmap_shadow.fs.glsl
文件 178 2016-09-08 10:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\shadowmap\shadowmap_shadow.vs.glsl
文件 334 2016-09-08 10:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\simpletess\simple.cont
文件 715 2016-09-08 10:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\simpletess\simple.eval
文件 118 2016-09-08 10:19 OGLPG-9th-Edition\OGLPG-9th-Edition\bin\media\shaders\simpletess\simple.frag
............此处省略1156个文件信息
相关资源
- openGL绘制虚拟教室
- 基于OpenGL的3D赛车游戏的研究与实现源
- OpenGL绘制一个多边形 添加颜色
- OpenGL三维图形系统开发与实用技术 基
- OpenGL鼠标交互3D模型
- 图形学的几道基础练习计算机图形学
- 交互式计算机:图形学基于OpenGL着色
- 基于opencv与opengl实现增强现实
- OpenGl三维镂垫绘制附使用说明
- OpenGL三维图形系统开发与实用技术基
- opengl导入FBX模型代码
- OPENGL载入3DS
- opengl超级宝典第七版
- 高级着色语言GLSL渲染obj文件
- Visual Studio 搭建好的OpenGL环境GLFW3+GL
- OpenGL实现三维仿真系统
- 山东大学计算机图形学实验1
- 直线的四种裁剪算法
- Computer graphics with opengl 4th edition 计算
- 山东大学计算机图形学实验课程资源
- 计算机图形学(OpenGL版)第3版.pdf
- OpenGL SuperBible 7 pdf
- OpenGL编程指南(原书第8版) + OpenGL超
- VS2017OpenGL 配置步骤
- 读OBJ模型,加载多纹理
- OpenGL红宝书第七版带目录完整版PDF+源
- opengl自定义函数实现平移旋转缩放
- OpenGL 3D场景绘制 SiriusPrx 荒岛古堡.r
- OpenGL一个室内三维渲染OBJ文件导入和
- NeHe OpenGL Qt4教学代码
评论
共有 条评论