/*
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 对硬件曲面细分的支持,通过3 个管线阶段提供: (1)曲面细分控制着色器; (2)曲面细分器; (3)曲面细分评估
共432个文件
hpp:151个
inl:116个
h:108个
需积分: 5 7 下载量 156 浏览量
2022-04-09
15:28:08
上传
评论 1
收藏 33.88MB RAR 举报
温馨提示
OpenGL 对硬件曲面细分的支持,通过3 个管线阶段提供: (1)曲面细分控制着色器; (2)曲面细分器; (3)曲面细分评估着色器。 (1)C++/OpenGL 应用程序: 创建一个摄像机和相关的MVP 矩阵,视图(v)和投影(p)矩阵确定摄像机朝向,模 型(m)矩阵可用于修改网格的位置和方向。 (2)顶点着色器: 在这个例子中基本上什么都不做,顶点将在曲面细分器中生成。 (3)曲面细分控制着色器: 指定曲面细分器要构建的网格。 (4)曲面细分评估着色器: 将MVP 矩阵应用于网格中的顶点。 (5)片段着色器: 只需为每个像素输出固定颜色。 曲面细分器生成由两个参数定义的顶点网格:内层级别和外层级别。在这种情况下, 内层级别为12,外层级别为6——网格的外边缘被分为6 段,而跨越内部的线被分为 12 段。 程序12.1 中的特别相关的新结构被高亮显示。让我们首先讨论第一部分——C++/ OpenGL 代码。 编译这两个新着色器,跟顶点和片段着色器完全相同。然后将它们附加到同一个渲染程 序,并且链接调用保持不变。唯一的新项目是用于指定要实例化的着色器类型的常量——新 常量如下: G
资源详情
资源评论
资源推荐
收起资源包目录
OpenGL 对硬件曲面细分的支持,通过3 个管线阶段提供:
(1)曲面细分控制着色器;
(2)曲面细分器;
(3)曲面细分评估 (432个子文件)
SOIL2.c 92KB
image_DXT.c 17KB
image_helper.c 10KB
wfETC.c 8KB
applicationhost.config 75KB
glm.cpp 10KB
Utils.cpp 8KB
Utils.cpp 8KB
dummy.cpp 7KB
main.cpp 5KB
Torus.cpp 4KB
Browse.VC.db 22.79MB
freetype.dll 653KB
glew32.dll 334KB
soil2.dll 297KB
glfw3.dll 202KB
.editorconfig 175B
Prog12_1_tessellationGridOnly.exe 566KB
Prog12_1_tessellationGridOnly.vcxproj.filters 2KB
fragShader.frag 125B
tessCShader.glsl 273B
tessEShader.glsl 220B
vertShader.glsl 71B
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
jo_jpeg.h 17KB
ftoutln.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
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
共 432 条
- 1
- 2
- 3
- 4
- 5
妙为
- 粉丝: 574
- 资源: 206
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0