/*
Fork by Martin Lucas Golini
Original author
Jonathan Dummer
2007-07-26-10.36
Simple OpenGL Image Library 2
Public Domain
using Sean Barret's stb_image as a base
Thanks to:
* Sean Barret - for the awesome stb_image
* Dan Venkitachalam - for finding some non-compliant DDS files, and patching some explicit casts
* everybody at gamedev.net
*/
#define SOIL_CHECK_FOR_GL_ERRORS 0
#if defined( __APPLE_CC__ ) || defined ( __APPLE__ )
#include <TargetConditionals.h>
#if defined( __IPHONE__ ) || ( defined( TARGET_OS_IPHONE ) && TARGET_OS_IPHONE ) || ( defined( TARGET_IPHONE_SIMULATOR ) && TARGET_IPHONE_SIMULATOR )
#define SOIL_PLATFORM_IOS
#include <dlfcn.h>
#else
#define SOIL_PLATFORM_OSX
#endif
#elif defined( __ANDROID__ ) || defined( ANDROID )
#define SOIL_PLATFORM_ANDROID
#elif ( defined ( linux ) || defined( __linux__ ) || defined( __FreeBSD__ ) || defined(__OpenBSD__) || defined( __NetBSD__ ) || defined( __DragonFly__ ) || defined( __SVR4 ) )
#define SOIL_X11_PLATFORM
#endif
#if ( defined( SOIL_PLATFORM_IOS ) || defined( SOIL_PLATFORM_ANDROID ) ) && ( !defined( SOIL_GLES1 ) && !defined( SOIL_GLES2 ) )
#define SOIL_GLES2
#endif
#if ( defined( SOIL_GLES2 ) || defined( SOIL_GLES1 ) ) && !defined( SOIL_NO_EGL ) && !defined( SOIL_PLATFORM_IOS )
#include <EGL/egl.h>
#endif
#if defined( SOIL_GLES2 )
#ifdef SOIL_PLATFORM_IOS
#include <OpenGLES/ES2/gl.h>
#include <OpenGLES/ES2/glext.h>
#else
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#endif
#define APIENTRY GL_APIENTRY
#elif defined( SOIL_GLES1 )
#ifndef GL_GLEXT_PROTOTYPES
#define GL_GLEXT_PROTOTYPES
#endif
#ifdef SOIL_PLATFORM_IOS
#include <OpenGLES/ES1/gl.h>
#include <OpenGLES/ES1/glext.h>
#else
#include <GLES/gl.h>
#include <GLES/glext.h>
#endif
#define APIENTRY GL_APIENTRY
#else
#if defined( __WIN32__ ) || defined( _WIN32 ) || defined( WIN32 )
#define SOIL_PLATFORM_WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <wingdi.h>
#include <GL/gl.h>
#elif defined(__APPLE__) || defined(__APPLE_CC__)
/* I can't test this Apple stuff! */
#include <OpenGL/gl.h>
#include <Carbon/Carbon.h>
#define APIENTRY
#elif defined( SOIL_X11_PLATFORM )
#include <GL/gl.h>
#include <GL/glx.h>
#else
#include <GL/gl.h>
#endif
#endif
#ifndef GL_BGRA
#define GL_BGRA 0x80E1
#endif
#ifndef GL_RG
#define GL_RG 0x8227
#endif
#ifndef GL_UNSIGNED_SHORT_4_4_4_4
#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
#endif
#ifndef GL_UNSIGNED_SHORT_5_5_5_1
#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
#endif
#ifndef GL_UNSIGNED_SHORT_5_6_5
#define GL_UNSIGNED_SHORT_5_6_5 0x8363
#endif
#ifndef GL_UNSIGNED_BYTE_3_3_2
#define GL_UNSIGNED_BYTE_3_3_2 0x8032
#endif
#include "SOIL2.h"
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "stb_image_write.h"
#include "image_helper.h"
#include "image_DXT.h"
#include "pvr_helper.h"
#include "pkm_helper.h"
#include "jo_jpeg.h"
#include <stdlib.h>
#include <string.h>
/* error reporting */
const char *result_string_pointer = "SOIL initialized";
/* for loading cube maps */
enum{
SOIL_CAPABILITY_UNKNOWN = -1,
SOIL_CAPABILITY_NONE = 0,
SOIL_CAPABILITY_PRESENT = 1
};
static int has_cubemap_capability = SOIL_CAPABILITY_UNKNOWN;
int query_cubemap_capability( void );
#define SOIL_TEXTURE_WRAP_R 0x8072
#define SOIL_CLAMP_TO_EDGE 0x812F
#define SOIL_NORMAL_MAP 0x8511
#define SOIL_REFLECTION_MAP 0x8512
#define SOIL_TEXTURE_CUBE_MAP 0x8513
#define SOIL_TEXTURE_BINDING_CUBE_MAP 0x8514
#define SOIL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
#define SOIL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
#define SOIL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
#define SOIL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
#define SOIL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
#define SOIL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
#define SOIL_PROXY_TEXTURE_CUBE_MAP 0x851B
#define SOIL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
/* for non-power-of-two texture */
#define SOIL_IS_POW2( v ) ( ( v & ( v - 1 ) ) == 0 )
static int has_NPOT_capability = SOIL_CAPABILITY_UNKNOWN;
int query_NPOT_capability( void );
/* for texture rectangles */
static int has_tex_rectangle_capability = SOIL_CAPABILITY_UNKNOWN;
int query_tex_rectangle_capability( void );
#define SOIL_TEXTURE_RECTANGLE_ARB 0x84F5
#define SOIL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84F8
/* for using DXT compression */
static int has_DXT_capability = SOIL_CAPABILITY_UNKNOWN;
int query_DXT_capability( void );
static int has_3Dc_capability = SOIL_CAPABILITY_UNKNOWN;
int query_3Dc_capability( void );
#define SOIL_GL_SRGB 0x8C40
#define SOIL_GL_SRGB_ALPHA 0x8C42
#define SOIL_RGB_S3TC_DXT1 0x83F0
#define SOIL_RGBA_S3TC_DXT1 0x83F1
#define SOIL_RGBA_S3TC_DXT3 0x83F2
#define SOIL_RGBA_S3TC_DXT5 0x83F3
#define SOIL_COMPRESSED_RG_RGTC2 0x8DBD
#define SOIL_GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C
#define SOIL_GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F
static int has_sRGB_capability = SOIL_CAPABILITY_UNKNOWN;
int query_sRGB_capability( void );
typedef void (APIENTRY * P_SOIL_GLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid * data);
static P_SOIL_GLCOMPRESSEDTEXIMAGE2DPROC soilGlCompressedTexImage2D = NULL;
typedef void (APIENTRY *P_SOIL_GLGENERATEMIPMAPPROC)(GLenum target);
static P_SOIL_GLGENERATEMIPMAPPROC soilGlGenerateMipmap = NULL;
static int has_gen_mipmap_capability = SOIL_CAPABILITY_UNKNOWN;
static int query_gen_mipmap_capability( void );
static int has_PVR_capability = SOIL_CAPABILITY_UNKNOWN;
int query_PVR_capability( void );
static int has_BGRA8888_capability = SOIL_CAPABILITY_UNKNOWN;
int query_BGRA8888_capability( void );
static int has_ETC1_capability = SOIL_CAPABILITY_UNKNOWN;
int query_ETC1_capability( void );
/* GL_IMG_texture_compression_pvrtc */
#define SOIL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00
#define SOIL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01
#define SOIL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02
#define SOIL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03
#define SOIL_GL_ETC1_RGB8_OES 0x8D64
#if defined( SOIL_X11_PLATFORM ) || defined( SOIL_PLATFORM_WIN32 ) || defined( SOIL_PLATFORM_OSX ) || defined(__HAIKU__)
typedef const GLubyte *(APIENTRY * P_SOIL_glGetStringiFunc) (GLenum, GLuint);
static P_SOIL_glGetStringiFunc soilGlGetStringiFunc = NULL;
static int isAtLeastGL3()
{
static int is_gl3 = SOIL_CAPABILITY_UNKNOWN;
if ( SOIL_CAPABILITY_UNKNOWN == is_gl3 )
{
const char * verstr = (const char *) glGetString( GL_VERSION );
is_gl3 = ( verstr && ( atoi(verstr) >= 3 ) &&
strstr( verstr, " ES " ) == NULL );
}
return is_gl3;
}
#else
static int isAtLeastGL3()
{
return SOIL_CAPABILITY_NONE;
}
#endif
#ifdef SOIL_PLATFORM_WIN32
static HMODULE openglModule = NULL;
static int soilTestWinProcPointer(const PROC pTest)
{
ptrdiff_t iTest;
if(!pTest) return 0;
iTest = (ptrdiff_t)pTest;
if(iTest == 1 || iTest == 2 || iTest == 3 || iTest == -1) return 0;
return 1;
}
#endif
#if defined(__sgi) || defined (__sun) || defined(__HAIKU__)
#include <dlfcn.h>
void* dlGetProcAddress (const char* 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)((const GLubyte*)name);
else
return dlsym(h, (const char*)name);
}
#endif
void * SOIL_GL_GetProcAddress(const char *proc)
{
void *func = NULL;
#if defined( SOIL_PLATFORM_IOS )
func = dlsym( RTLD_DEFAULT, proc );
#elif defined( SOIL_GLES2
没有合适的资源?快使用搜索试试~ 我知道了~
openGL Gouraud光照效果
共430个文件
hpp:151个
inl:116个
h:106个
需积分: 43 3 下载量 13 浏览量
2022-02-17
10:03:44
上传
评论
收藏 44.36MB RAR 举报
温馨提示
openGLGouraud关照效果,包括环境光、漫反射、镜面光,键盘鼠标事件 1.Gouraud 着色也容易受到其他伪影影响 2.如果镜面高光整个范围都在模型中的一个三角 形内——即高光范围内一个模型顶点也没有——那么它可能不会被渲染出来。由于镜面反射 分量是依顶点计算的,因此,当模型所有顶点都没有镜面反射分量时,其光栅化后的像素 也不会有镜面反射光。
资源详情
资源评论
资源推荐
收起资源包目录
openGL Gouraud光照效果 (430个子文件)
SOIL2.c 92KB
image_DXT.c 17KB
image_helper.c 10KB
wfETC.c 8KB
applicationhost.config 75KB
main.cpp 15KB
glm.cpp 10KB
Utils.cpp 8KB
dummy.cpp 7KB
Torus.cpp 4KB
Browse.VC.db 22.9MB
freetype.dll 653KB
glew32.dll 334KB
soil2.dll 297KB
glfw3.dll 202KB
.editorconfig 175B
lightAdsGouraud.exe 649KB
lightAdsGouraud.vcxproj.filters 2KB
vertShader.glsl 2KB
fragShader.glsl 659B
glew.h 1.15MB
stb_image.h 262KB
glfw3.h 209KB
glad.h 207KB
freetype.h 162KB
eglew.h 104KB
glxew.h 73KB
GL.H 67KB
wglew.h 63KB
ttnameid.h 57KB
material.h 51KB
ftdriver.h 46KB
stb_image_write.h 40KB
ftimage.h 38KB
ftoption.h 38KB
config.h 37KB
ftcache.h 33KB
pstdint.h 30KB
postprocess.h 30KB
mesh.h 25KB
tttables.h 25KB
cimport.h 24KB
stbi_pvr_c.h 23KB
ftheader.h 23KB
t1tables.h 22KB
ftstroke.h 21KB
ftmodapi.h 21KB
ftmm.h 21KB
ftconfig.h 18KB
ftglyph.h 18KB
SOIL2.h 18KB
ftoutln.h 17KB
jo_jpeg.h 17KB
stbi_DDS_c.h 16KB
glfw3native.h 16KB
types.h 15KB
anim.h 14KB
fttypes.h 14KB
scene.h 14KB
cexport.h 12KB
fterrdef.h 12KB
ftlcdfil.h 12KB
ftgxval.h 10KB
ftincrem.h 10KB
khrplatform.h 10KB
camera.h 10KB
matrix4x4.h 9KB
defs.h 9KB
ftbitmap.h 9KB
light.h 9KB
fterrors.h 9KB
ftcolor.h 9KB
ftsystem.h 8KB
ftwinfnt.h 8KB
ftmac.h 8KB
ftsnames.h 8KB
camera.h 7KB
fttrigon.h 7KB
metadata.h 7KB
ftlist.h 7KB
texture.h 7KB
ftrender.h 6KB
ftmoderr.h 6KB
matrix3x3.h 6KB
pvr_helper.h 6KB
importerdesc.h 6KB
ftparams.h 5KB
ftadvanc.h 5KB
ftotval.h 5KB
ftbdf.h 5KB
tttags.h 5KB
stbi_pkm_c.h 5KB
ftpfr.h 5KB
cfileio.h 4KB
vector3.h 4KB
ftstdlib.h 4KB
ftsizes.h 4KB
quaternion.h 4KB
ftgzip.h 4KB
ftgasp.h 4KB
共 430 条
- 1
- 2
- 3
- 4
- 5
妙为
- 粉丝: 903
- 资源: 206
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- bdwptqmxgj11.zip
- onnxruntime-win-x86
- onnxruntime-win-x64-gpu-1.20.1.zip
- vs2019 c++20 语法规范 头文件 <ratio> 的源码阅读与注释,处理分数的存储,加减乘除,以及大小比较等运算
- 首次尝试使用 Win,DirectX C++ 中的形状渲染套件.zip
- 预乘混合模式是一种用途广泛的三合一混合模式 它已经存在很长时间了,但似乎每隔几年就会被重新发现 该项目包括使用预乘 alpha 的描述,示例和工具 .zip
- 项目描述 DirectX 引擎支持版本 9、10、11 库 Microsoft SDK 功能相机视图、照明、加载网格、动画、蒙皮、层次结构界面、动画控制器、网格容器、碰撞系统 .zip
- 项目 wiki 文档中使用的代码教程的源代码库.zip
- 面向对象的通用GUI框架.zip
- 基于Java语言的PlayerBase游戏角色设计源码
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0