/*
** The OpenGL Extension Wrangler Library
** Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
** Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
** Copyright (C) 2002, Lev Povalahev
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are met:
**
** * Redistributions of source code must retain the above copyright notice,
** this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright notice,
** this list of conditions and the following disclaimer in the documentation
** and/or other materials provided with the distribution.
** * The name of the author may be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
** THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <GL/glew.h>
#if defined(_WIN32)
# include <GL/wglew.h>
#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
# include <GL/glxew.h>
#endif
/*
* Define glewGetContext and related helper macros.
*/
#ifdef GLEW_MX
# define glewGetContext() ctx
# ifdef _WIN32
# define GLEW_CONTEXT_ARG_DEF_INIT GLEWContext* ctx
# define GLEW_CONTEXT_ARG_VAR_INIT ctx
# define wglewGetContext() ctx
# define WGLEW_CONTEXT_ARG_DEF_INIT WGLEWContext* ctx
# define WGLEW_CONTEXT_ARG_DEF_LIST WGLEWContext* ctx
# else /* _WIN32 */
# define GLEW_CONTEXT_ARG_DEF_INIT void
# define GLEW_CONTEXT_ARG_VAR_INIT
# define glxewGetContext() ctx
# define GLXEW_CONTEXT_ARG_DEF_INIT void
# define GLXEW_CONTEXT_ARG_DEF_LIST GLXEWContext* ctx
# endif /* _WIN32 */
# define GLEW_CONTEXT_ARG_DEF_LIST GLEWContext* ctx
#else /* GLEW_MX */
# define GLEW_CONTEXT_ARG_DEF_INIT void
# define GLEW_CONTEXT_ARG_VAR_INIT
# define GLEW_CONTEXT_ARG_DEF_LIST void
# define WGLEW_CONTEXT_ARG_DEF_INIT void
# define WGLEW_CONTEXT_ARG_DEF_LIST void
# define GLXEW_CONTEXT_ARG_DEF_INIT void
# define GLXEW_CONTEXT_ARG_DEF_LIST void
#endif /* GLEW_MX */
#if defined(__APPLE__)
#include <stdlib.h>
#include <string.h>
#include <AvailabilityMacros.h>
#ifdef MAC_OS_X_VERSION_10_3
#include <dlfcn.h>
void* NSGLGetProcAddress (const GLubyte *name)
{
static void* image = NULL;
if (NULL == image)
{
image = dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", RTLD_LAZY);
}
return image ? dlsym(image, (const char*)name) : NULL;
}
#else
#include <mach-o/dyld.h>
void* NSGLGetProcAddress (const GLubyte *name)
{
static const struct mach_header* image = NULL;
NSSymbol symbol;
char* symbolName;
if (NULL == image)
{
image = NSAddImage("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", NSADDIMAGE_OPTION_RETURN_ON_ERROR);
}
/* prepend a '_' for the Unix C symbol mangling convention */
symbolName = malloc(strlen((const char*)name) + 2);
strcpy(symbolName+1, (const char*)name);
symbolName[0] = '_';
symbol = NULL;
/* if (NSIsSymbolNameDefined(symbolName))
symbol = NSLookupAndBindSymbol(symbolName); */
symbol = image ? NSLookupSymbolInImage(image, symbolName, NSLOOKUPSYMBOLINIMAGE_OPTION_BIND | NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR) : NULL;
free(symbolName);
return symbol ? NSAddressOfSymbol(symbol) : NULL;
}
#endif /* MAC_OS_X_VERSION_10_3 */
#endif /* __APPLE__ */
#if defined(__sgi) || defined (__sun)
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
void* dlGetProcAddress (const GLubyte* name)
{
static void* h = NULL;
static void* gpa;
if (h == NULL)
{
if ((h = dlopen(NULL, RTLD_LAZY | RTLD_LOCAL)) == NULL) return NULL;
gpa = dlsym(h, "glXGetProcAddress");
}
if (gpa != NULL)
return ((void*(*)(const GLubyte*))gpa)(name);
else
return dlsym(h, (const char*)name);
}
#endif /* __sgi || __sun */
/*
* Define glewGetProcAddress.
*/
#if defined(_WIN32)
# define glewGetProcAddress(name) wglGetProcAddress((LPCSTR)name)
#else
# if defined(__APPLE__)
# define glewGetProcAddress(name) NSGLGetProcAddress(name)
# else
# if defined(__sgi) || defined(__sun)
# define glewGetProcAddress(name) dlGetProcAddress(name)
# else /* __linux */
# define glewGetProcAddress(name) (*glXGetProcAddressARB)(name)
# endif
# endif
#endif
/*
* Define GLboolean const cast.
*/
#define CONST_CAST(x) (*(GLboolean*)&x)
/*
* GLEW, just like OpenGL or GLU, does not rely on the standard C library.
* These functions implement the functionality required in this file.
*/
static GLuint _glewStrLen (const GLubyte* s)
{
GLuint i=0;
if (s == NULL) return 0;
while (s[i] != '\0') i++;
return i;
}
static GLuint _glewStrCLen (const GLubyte* s, GLubyte c)
{
GLuint i=0;
if (s == NULL) return 0;
while (s[i] != '\0' && s[i] != c) i++;
return (s[i] == '\0' || s[i] == c) ? i : 0;
}
static GLboolean _glewStrSame (const GLubyte* a, const GLubyte* b, GLuint n)
{
GLuint i=0;
if(a == NULL || b == NULL)
return (a == NULL && b == NULL && n == 0) ? GL_TRUE : GL_FALSE;
while (i < n && a[i] != '\0' && b[i] != '\0' && a[i] == b[i]) i++;
return i == n ? GL_TRUE : GL_FALSE;
}
static GLboolean _glewStrSame1 (GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb)
{
while (*na > 0 && (**a == ' ' || **a == '\n' || **a == '\r' || **a == '\t'))
{
(*a)++;
(*na)--;
}
if(*na >= nb)
{
GLuint i=0;
while (i < nb && (*a)+i != NULL && b+i != NULL && (*a)[i] == b[i]) i++;
if(i == nb)
{
*a = *a + nb;
*na = *na - nb;
return GL_TRUE;
}
}
return GL_FALSE;
}
static GLboolean _glewStrSame2 (GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb)
{
if(*na >= nb)
{
GLuint i=0;
while (i < nb && (*a)+i != NULL && b+i != NULL && (*a)[i] == b[i]) i++;
if(i == nb)
{
*a = *a + nb;
*na = *na - nb;
return GL_TRUE;
}
}
return GL_FALSE;
}
static GLboolean _glewStrSame3 (GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb)
{
if(*na >= nb)
{
GLuint i=0;
while (i < nb && (*a)+i != NULL && b+i != NULL && (*a)[i] == b[i]) i++;
if (i == nb && (*na == nb || (*a)[i] == ' ' || (*a)[i] == '\n' || (*a)[i] == '\r' || (*a)[i] == '\t'))
{
*a = *a + nb;
*na = *na - nb;
return GL_TRUE;
}
}
return GL_FALSE;
}
#if !defined(_WIN32) || !defined(GLEW_MX)
PFNGLCOPYTEXSUBIMAGE3DPROC __glewCopyTexSubImage3D = NULL;
PFNGLDRAWRANGEELEMENTSPROC __glewDrawRangeElements = NULL;
PFNGLTEXIMAGE3DPROC __glewTexImage3D = NULL;
PFNGLTEXSUBIMAGE3DPROC __glewTexSubImage3D = NULL;
PFNGLACTIVETEXTUREPROC __glewActiveTexture = NULL;
PFNGLCLIENTACTIVETEXTUREPROC __glewClientActiveTexture = NULL;
PFNGLCOMPRESSEDTEXIMAGE1DPROC __glewCompressedTexImage1D = NULL;
PFNGLCOMPRESSEDTEXIMAGE2DPROC __glewCompressedTexImage2D = NULL;
PFNGLCOMPRESSEDTEXIMAGE3DPROC __glewCompressedTexImage3D = NULL;
PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC __glewCompressedTexSubImage1D = NULL;
PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC __glew
没有合适的资源?快使用搜索试试~ 我知道了~
OpenGL超级宝典完整源码(第五版)
共1004个文件
tga:173个
h:120个
vcproj:76个
4星 · 超过85%的资源 需积分: 5 33 下载量 198 浏览量
2015-11-12
16:29:57
上传
评论 1
收藏 30.16MB 7Z 举报
温馨提示
适合希望精通OpenGL以便对他们的图形编程和3D图形知识进行扩展的程序员阅读,也可以帮助那些经验丰富的OpenGL程序员学习如何移植自己的应用程序。《OpenGL超级宝典(第5版)》既可以作为学习OpenGL的教材,也可以作为随时查阅的参考手册!经典书籍,必备佳品!
资源推荐
资源详情
资源评论
收起资源包目录
OpenGL超级宝典完整源码(第五版) (1004个子文件)
output.0 752KB
traces.0 430KB
output.1 751KB
traces.1 41KB
configure.ac 3KB
ADSGouraud 704KB
ADSPhong 704KB
Makefile.am 2KB
Makefile.am 1KB
Makefile.am 275B
Makefile.am 254B
Makefile.am 247B
Makefile.am 239B
Makefile.am 225B
Makefile.am 202B
Makefile.am 199B
Makefile.am 198B
Makefile.am 177B
Makefile.am 149B
Makefile.am 115B
Makefile.am 72B
Makefile.am 16B
Anisotropic 705KB
AUTHORS 820B
Blending 686KB
Block 730KB
Block 717KB
start_line.bmp 5.72MB
start_line.bmp 5.72MB
NinjaComp.BMP 3MB
MoonLike.bmp 96KB
Marslike.bmp 96KB
Marslike.bmp 96KB
MoonLike.bmp 96KB
Marble.bmp 48KB
Marble.bmp 48KB
Marble.bmp 48KB
Marble.bmp 48KB
Marble.bmp 48KB
Marble.bmp 48KB
Marble.bmp 48KB
Marble.bmp 48KB
Bounce 685KB
glew.c 704KB
freeglut_font_data.c 383KB
freeglut_main.c 74KB
freeglut_joystick.c 54KB
freeglut_window.c 52KB
freeglut_stroke_mono_roman.c 47KB
freeglut_stroke_roman.c 47KB
freeglut_geometry.c 40KB
freeglut_init.c 35KB
freeglut_menu.c 32KB
freeglut_state.c 26KB
freeglut_gamemode.c 18KB
freeglut_structure.c 18KB
smooth_opengl3.c 15KB
CallbackMaker.c 15KB
shapes.c 14KB
freeglut_font.c 12KB
freeglut_input_devices.c 11KB
freeglut_cursor.c 11KB
lorenz.c 11KB
freeglut_spaceball.c 11KB
freeglut_callbacks.c 10KB
GLXBasics.c 9KB
fractals_random.c 9KB
fractals.c 8KB
freeglut_ext.c 8KB
one.c 8KB
freeglut_teapot.c 6KB
freeglut_misc.c 6KB
freeglut_glutfont_definitions.c 4KB
spaceball.c 4KB
freeglut_display.c 3KB
freeglut_overlay.c 2KB
freeglut_videoresize.c 2KB
vmath.c 348B
ChangeLog 159KB
compile 4KB
configure 750KB
COPYING 1KB
GLTools.cpp 51KB
math3d.cpp 31KB
Block_redux.cpp 30KB
hdr_msaa.cpp 28KB
Grass.cpp 28KB
GLShaderManager.cpp 27KB
hdr_bloom.cpp 27KB
Block.cpp 25KB
SphereWorld_redux.cpp 25KB
oit.cpp 21KB
Block.cpp 19KB
fbo_drawbuffers.cpp 18KB
Perspective.cpp 18KB
OrthoGraphic.cpp 18KB
GLBatch.cpp 17KB
fbo_textures.cpp 15KB
pix_buffs.cpp 15KB
hdr_imaging.cpp 15KB
共 1004 条
- 1
- 2
- 3
- 4
- 5
- 6
- 11
资源评论
- jeffreych2016-04-14源碼完整, 感謝.
- 不卤废丝2021-03-01挺好的资料。
gxy_悦宝
- 粉丝: 1
- 资源: 8
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- MI4407-VB一款SOP8封装P-Channel场效应MOS管
- java实验2.doc
- opencv-基于c++实现的opencv图像处理算法之区域生长分割算法.zip
- MI3475-VB一款SOT23封装P-Channel场效应MOS管
- Fortran语言教程&案例&相关项目资源
- Labview 互斥按钮
- java小说人物分析.doc
- opencv-基于c++实现的opencv图像处理算法之双线性插值算法.zip
- 《STM32单片机+DHT11温湿度+MQ甲醛浓度+BH1750光照强度+按键+OLED屏幕+蜂鸣器+继电器》源代码
- python爬虫基础知识原理及Scrapy框架以及scrapy-redis分布式策略入门知识.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功