├── data ├── rnl_nx.pfm ├── rnl_ny.pfm ├── rnl_nz.pfm ├── rnl_px.pfm ├── rnl_py.pfm └── rnl_pz.pfm ├── hdrdemo ├── hdrdemo │ ├── en.lproj │ │ ├── InfoPlist.strings │ │ ├── ViewController_iPhone.xib │ │ └── ViewController_iPad.xib │ ├── Shaders │ │ ├── lineartonemap.fsh │ │ ├── Shader.fsh │ │ ├── FBOShader.fsh │ │ ├── FBOShader.vsh │ │ └── Shader.vsh │ ├── hdrdemo-Prefix.pch │ ├── main.m │ ├── AppDelegate.h │ ├── ViewController.h │ ├── hdrdemo-Info.plist │ ├── AppDelegate.mm │ └── ViewController.mm └── hdrdemo.xcodeproj │ └── project.pbxproj ├── scenes ├── histogram.fsh ├── hdrcubemap.fsh ├── histogram.vsh ├── hdrcubemap.vsh ├── histogramviz.h ├── hdrcubemap.h ├── histogramviz.cc └── hdrcubemap.mm ├── .gitignore ├── shared ├── opengltools.h ├── glshader.h ├── vertexbufferobject.h ├── codingguides.h ├── framebufferobject.h ├── glprogram.h ├── glshader.cc ├── vertexbufferobject.cc ├── opengltools.mm ├── framebufferobject.mm └── glprogram.mm ├── README └── tools ├── new_cpp_class.py ├── lightprobe_to_hdrtex.py └── bytebuffer.py /data/rnl_nx.pfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Volcore/hdrdemo/HEAD/data/rnl_nx.pfm -------------------------------------------------------------------------------- /data/rnl_ny.pfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Volcore/hdrdemo/HEAD/data/rnl_ny.pfm -------------------------------------------------------------------------------- /data/rnl_nz.pfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Volcore/hdrdemo/HEAD/data/rnl_nz.pfm -------------------------------------------------------------------------------- /data/rnl_px.pfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Volcore/hdrdemo/HEAD/data/rnl_px.pfm -------------------------------------------------------------------------------- /data/rnl_py.pfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Volcore/hdrdemo/HEAD/data/rnl_py.pfm -------------------------------------------------------------------------------- /data/rnl_pz.pfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Volcore/hdrdemo/HEAD/data/rnl_pz.pfm -------------------------------------------------------------------------------- /hdrdemo/hdrdemo/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /scenes/histogram.fsh: -------------------------------------------------------------------------------- 1 | varying highp vec4 var_color; 2 | 3 | void main() { 4 | gl_FragColor = var_color; 5 | } 6 | -------------------------------------------------------------------------------- /scenes/hdrcubemap.fsh: -------------------------------------------------------------------------------- 1 | varying highp vec3 var_direction; 2 | uniform samplerCube uni_texture; 3 | 4 | void main() { 5 | gl_FragColor = textureCube(uni_texture, var_direction); 6 | } 7 | -------------------------------------------------------------------------------- /scenes/histogram.vsh: -------------------------------------------------------------------------------- 1 | attribute vec2 att_position; 2 | attribute vec4 att_color; 3 | 4 | varying vec4 var_color; 5 | 6 | void main() { 7 | gl_Position = vec4(att_position, 0, 1); 8 | var_color = att_color; 9 | } 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | *.mode1v3 3 | *.mode2v3 4 | *.pbxuser 5 | *.perspectivev3 6 | .DS_Store 7 | *.o 8 | utils/obj2vbo/obj2vbo 9 | *.swp 10 | utils/pediagen/Django* 11 | utils/map/PyOpenGL-3.0.1b1 12 | *.pyc 13 | xcuserdata 14 | *.xcworkspace -------------------------------------------------------------------------------- /scenes/hdrcubemap.vsh: -------------------------------------------------------------------------------- 1 | uniform mat4 uni_mvp; 2 | 3 | attribute vec3 att_position; 4 | 5 | varying vec3 var_direction; 6 | 7 | void main() { 8 | gl_Position = uni_mvp*vec4(att_position, 1); 9 | var_direction = normalize(att_position); 10 | } 11 | 12 | -------------------------------------------------------------------------------- /hdrdemo/hdrdemo/Shaders/lineartonemap.fsh: -------------------------------------------------------------------------------- 1 | uniform sampler2D texture; 2 | varying highp vec2 var_texcoord; 3 | uniform highp vec4 scale; 4 | uniform highp vec4 bias; 5 | 6 | void main() { 7 | gl_FragColor = scale*(texture2D(texture, var_texcoord)+bias); 8 | } 9 | 10 | -------------------------------------------------------------------------------- /hdrdemo/hdrdemo/Shaders/Shader.fsh: -------------------------------------------------------------------------------- 1 | // 2 | // Shader.fsh 3 | // hdrdemo 4 | // 5 | // Created by Volker Schoenefeld on 8/8/11. 6 | // Copyright (c) 2011 Volker Schoenefeld. All rights reserved. 7 | // 8 | 9 | varying highp vec4 colorVarying; 10 | 11 | void main() 12 | { 13 | gl_FragColor = colorVarying; 14 | } 15 | -------------------------------------------------------------------------------- /hdrdemo/hdrdemo/Shaders/FBOShader.fsh: -------------------------------------------------------------------------------- 1 | // 2 | // Shader.fsh 3 | // hdrdemo 4 | // 5 | // Created by Volker Schoenefeld on 8/8/11. 6 | // Copyright (c) 2011 Volker Schoenefeld. All rights reserved. 7 | // 8 | 9 | uniform sampler2D texture; 10 | varying highp vec2 var_texcoord; 11 | 12 | void main() 13 | { 14 | gl_FragColor = 1.25*texture2D(texture, var_texcoord); 15 | } 16 | -------------------------------------------------------------------------------- /hdrdemo/hdrdemo/hdrdemo-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'hdrdemo' target in the 'hdrdemo' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_4_0 8 | #warning "This project uses features only available in iOS SDK 4.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /hdrdemo/hdrdemo/Shaders/FBOShader.vsh: -------------------------------------------------------------------------------- 1 | // 2 | // Shader.vsh 3 | // hdrdemo 4 | // 5 | // Created by Volker Schoenefeld on 8/8/11. 6 | // Copyright (c) 2011 Volker Schoenefeld. All rights reserved. 7 | // 8 | 9 | attribute vec4 att_position; 10 | attribute vec2 att_texcoord; 11 | 12 | varying vec2 var_texcoord; 13 | 14 | void main() 15 | { 16 | gl_Position = att_position; 17 | var_texcoord = att_texcoord; 18 | } 19 | -------------------------------------------------------------------------------- /hdrdemo/hdrdemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // hdrdemo 4 | // 5 | // Created by Volker Schoenefeld on 8/8/11. 6 | // Copyright (c) 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /hdrdemo/hdrdemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // hdrdemo 4 | // 5 | // Created by Volker Schoenefeld on 8/8/11. 6 | // Copyright (c) 2011 Volker Schoenefeld. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class ViewController; 12 | 13 | @interface AppDelegate : UIResponder 14 | 15 | @property (strong, nonatomic) UIWindow *window; 16 | 17 | @property (strong, nonatomic) ViewController *viewController; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /shared/opengltools.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2011, Volker Schoenefeld 3 | All rights reserved. 4 | This code is subject to the Google C++ Coding conventions: 5 | http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml 6 | ******************************************************************************/ 7 | #ifndef SHARED_OPENGLTOOLS_H_ 8 | #define SHARED_OPENGLTOOLS_H_ 9 | 10 | #include 11 | 12 | class OpenGLTools { 13 | public: 14 | OpenGLTools(); 15 | ~OpenGLTools(); 16 | static void GetError(const char *const where); 17 | static void DumpCapabilities(); 18 | private: 19 | DISALLOW_COPY_AND_ASSIGN(OpenGLTools); 20 | }; 21 | 22 | #endif // SHARED_OPENGLTOOLS_H_ 23 | -------------------------------------------------------------------------------- /hdrdemo/hdrdemo/Shaders/Shader.vsh: -------------------------------------------------------------------------------- 1 | // 2 | // Shader.vsh 3 | // hdrdemo 4 | // 5 | // Created by Volker Schoenefeld on 8/8/11. 6 | // Copyright (c) 2011 Volker Schoenefeld. All rights reserved. 7 | // 8 | 9 | attribute vec4 position; 10 | attribute vec3 normal; 11 | 12 | varying vec4 colorVarying; 13 | 14 | uniform mat4 modelViewProjectionMatrix; 15 | uniform mat3 normalMatrix; 16 | 17 | void main() 18 | { 19 | vec3 eyeNormal = normalize(normalMatrix * normal); 20 | vec3 lightPosition = vec3(0.0, 0.0, 1.0); 21 | vec4 diffuseColor = vec4(4.4, 4.4, 4.0, 1.0); 22 | 23 | float nDotVP = max(0.0, dot(eyeNormal, normalize(lightPosition))); 24 | 25 | colorVarying = diffuseColor * nDotVP; 26 | 27 | gl_Position = modelViewProjectionMatrix * position; 28 | } 29 | -------------------------------------------------------------------------------- /shared/glshader.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2011, Limbic Software, Inc. 3 | All rights reserved. 4 | This code is subject to the Google C++ Coding conventions: 5 | http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml 6 | ******************************************************************************/ 7 | #ifndef SHARED_GLSHADER_H_ 8 | #define SHARED_GLSHADER_H_ 9 | 10 | #include 11 | 12 | class GLShader { 13 | public: 14 | enum Type { 15 | VERTEX = 0, 16 | FRAGMENT = 1, 17 | }; 18 | static GLShader *LoadAndCompile(Type type, const char *text); 19 | ~GLShader(); 20 | unsigned int shader() const { return shader_; } 21 | private: 22 | GLShader(unsigned int shader); 23 | unsigned int shader_; 24 | DISALLOW_COPY_AND_ASSIGN(GLShader); 25 | }; 26 | 27 | #endif // SHARED_GLSHADER_H_ 28 | -------------------------------------------------------------------------------- /hdrdemo/hdrdemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // hdrdemo 4 | // 5 | // Created by Volker Schoenefeld on 8/8/11. 6 | // Copyright (c) 2011 Volker Schoenefeld. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | #define HISTOGRAM_SIZE 256 13 | 14 | @interface ViewController : GLKViewController { 15 | @private 16 | IBOutlet UISwitch *_hdrButton; 17 | // Histogram stuff 18 | IBOutlet UISwitch *_histogramButton; 19 | IBOutlet UIView *_histogramView; 20 | IBOutlet UILabel *_histogramMin; 21 | IBOutlet UILabel *_histogramMax; 22 | IBOutlet UILabel *_histogramBinMax; 23 | IBOutlet UILabel *_histogramUpperBound; 24 | IBOutlet UISwitch *_filterTextures; 25 | IBOutlet UISlider *_scaleSlider; 26 | IBOutlet UISlider *_biasSlider; 27 | IBOutlet UISwitch *_linearSwitch; 28 | } 29 | 30 | - (IBAction) toggleHDR; 31 | - (IBAction) toggleHistogram; 32 | - (IBAction) toggleFilterTextures; 33 | @end 34 | -------------------------------------------------------------------------------- /scenes/histogramviz.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2011, Volker Schoenefeld 3 | All rights reserved. 4 | This code is subject to the Google C++ Coding conventions: 5 | http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml 6 | ******************************************************************************/ 7 | #ifndef SCENES_HISTOGRAMVIZ_H_ 8 | #define SCENES_HISTOGRAMVIZ_H_ 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | class HistogramViz { 15 | public: 16 | HistogramViz(); 17 | ~HistogramViz(); 18 | void Prepare(int size); 19 | void Draw(float *histogram, int width, int height, float fbo_scale, float fbo_bias); 20 | private: 21 | int histogram_size_; 22 | GLProgram *program_; 23 | VertexBufferObject *vbo_; 24 | VertexBufferObject *vbo2_; 25 | DISALLOW_COPY_AND_ASSIGN(HistogramViz); 26 | }; 27 | 28 | #endif // SCENES_HISTOGRAMVIZ_H_ 29 | -------------------------------------------------------------------------------- /scenes/hdrcubemap.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2011, Volker Schoenefeld 3 | All rights reserved. 4 | This code is subject to the Google C++ Coding conventions: 5 | http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml 6 | ******************************************************************************/ 7 | #ifndef SCENES_HDRCUBEMAP_H_ 8 | #define SCENES_HDRCUBEMAP_H_ 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | class HDRCubeMap { 15 | public: 16 | HDRCubeMap(); 17 | ~HDRCubeMap(); 18 | void Prepare(bool filtering); 19 | void Draw(float *mvp); 20 | void Reset(); 21 | private: 22 | void LoadPFMTexture(const char *const filename, int type); 23 | GLProgram *program_; 24 | VertexBufferObject *vbo_; 25 | unsigned int texid_; 26 | unsigned int uni_texture_location_; 27 | unsigned int uni_mvp_location_; 28 | DISALLOW_COPY_AND_ASSIGN(HDRCubeMap); 29 | }; 30 | 31 | #endif // SCENES_HDRCUBEMAP_H_ 32 | -------------------------------------------------------------------------------- /shared/vertexbufferobject.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2010, Limbic Software, Inc. 3 | All rights reserved. 4 | This code is subject to the Google C++ Coding conventions: 5 | http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml 6 | ******************************************************************************/ 7 | #ifndef SHARED_VERTEXBUFFEROBJECT_H_ 8 | #define SHARED_VERTEXBUFFEROBJECT_H_ 9 | 10 | #include 11 | #include 12 | 13 | class VertexBufferObject { 14 | public: 15 | VertexBufferObject(); 16 | ~VertexBufferObject(); 17 | void SetVertexData(uint8_t *data, unsigned int length, bool stream=false); 18 | void SetIndexData(uint8_t *data, unsigned int length, bool stream=false); 19 | void AddAttribute(int attribute, int count, int type, bool noramlize, int stride, int offset); 20 | void Draw(unsigned int type, unsigned int count, unsigned int data_type, int offset); 21 | private: 22 | unsigned int vbo_id_; 23 | unsigned int ibo_id_; 24 | unsigned int vao_id_; 25 | DISALLOW_COPY_AND_ASSIGN(VertexBufferObject); 26 | }; 27 | 28 | #endif // SHARED_VERTEXBUFFEROBJECT_H_ 29 | -------------------------------------------------------------------------------- /shared/codingguides.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2011, Limbic Software, Inc. 3 | All rights reserved. 4 | This code is subject to the Google C++ Coding conventions: 5 | http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml 6 | ******************************************************************************/ 7 | #ifndef SHARED_CODINGGUIDES_H_ 8 | #define SHARED_CODINGGUIDES_H_ 9 | 10 | #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ 11 | TypeName(const TypeName&); \ 12 | void operator=(const TypeName&) 13 | 14 | #define SAFE_DELETE(x) \ 15 | if (x != 0) { \ 16 | delete x; \ 17 | x = 0; \ 18 | } 19 | 20 | #define SAFE_FREE(x) \ 21 | if (x != 0) { \ 22 | free(x); \ 23 | x = 0; \ 24 | } 25 | 26 | 27 | #define SAFE_DELETE_ARRAY(x) \ 28 | if (x != 0) { \ 29 | delete [] x; \ 30 | x = 0; \ 31 | } 32 | 33 | #define EMPTY_STD_VECTOR(x) \ 34 | while (x.empty() == false) {\ 35 | delete x.back(); \ 36 | x.pop_back(); \ 37 | } 38 | 39 | #define EMPTY_STD_LIST(x) \ 40 | while (x.empty() == false) {\ 41 | delete x.back(); \ 42 | x.pop_back(); \ 43 | } 44 | 45 | #endif // SHARED_CODINGGUIDES_H_ 46 | -------------------------------------------------------------------------------- /shared/framebufferobject.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2010, Limbic Software, Inc. 3 | All rights reserved. 4 | This code is subject to the Google C++ Coding conventions: 5 | http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml 6 | ******************************************************************************/ 7 | #ifndef SHARED_FRAMEBUFFEROBJECT_H_ 8 | #define SHARED_FRAMEBUFFEROBJECT_H_ 9 | 10 | #include 11 | 12 | class FramebufferObject { 13 | public: 14 | enum DepthType { 15 | Depth24, 16 | Depth16, 17 | NoDepth 18 | }; 19 | enum ColorType { 20 | RGB888, 21 | RGBA8888, 22 | HDR = 1000, 23 | RG16F, 24 | RGB16F, 25 | RGBA16F, 26 | }; 27 | ~FramebufferObject(); 28 | static FramebufferObject *Create(int width, int height, ColorType color, DepthType depth); 29 | void Activate(); 30 | void Deactivate(); 31 | unsigned int colorrb_id() const { return colorrb_id_; } 32 | unsigned int tex_id() const { return tex_id_; } 33 | private: 34 | FramebufferObject(); 35 | int width_; 36 | int height_; 37 | unsigned int fbo_id_; 38 | unsigned int tex_id_; 39 | unsigned int depthrb_id_; 40 | unsigned int colorrb_id_; 41 | // Temporary variables used for rendering. 42 | int old_fbo_; 43 | int old_viewport_[4]; 44 | DISALLOW_COPY_AND_ASSIGN(FramebufferObject); 45 | }; 46 | 47 | #endif // SHARED_FRAMEBUFFEROBJECT_H_ 48 | -------------------------------------------------------------------------------- /hdrdemo/hdrdemo/hdrdemo-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFiles 12 | 13 | CFBundleIdentifier 14 | com.limbic.${PRODUCT_NAME:rfc1034identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 1.0 27 | LSRequiresIPhoneOS 28 | 29 | UIStatusBarHidden 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /shared/glprogram.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2011, Limbic Software, Inc. 3 | All rights reserved. 4 | This code is subject to the Google C++ Coding conventions: 5 | http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml 6 | ******************************************************************************/ 7 | #ifndef SHARED_GLPROGRAM_H_ 8 | #define SHARED_GLPROGRAM_H_ 9 | 10 | #include 11 | 12 | class GLShader; 13 | 14 | typedef int UniformLocation; 15 | typedef int AttributeLocation; 16 | 17 | class GLProgram { 18 | public: 19 | GLProgram(); 20 | ~GLProgram(); 21 | static GLProgram *FromFiles(const char *vshader_filename, const char *fshader_filename); 22 | static GLProgram *FromText(const char *vshader, const char *fshader); 23 | void Attach(const GLShader *shader) const; 24 | void BindAttribLocation(const char *name, AttributeLocation location) const; 25 | bool Link() const; 26 | bool Validate() const; 27 | void Use() const; 28 | void Disable() const; 29 | UniformLocation GetUniformLocation(const char *name) const; 30 | AttributeLocation GetAttribLocation(const char *name) const; 31 | void SetUniformi(int uniform, int x) const; 32 | void SetUniformf(int uniform, float x) const; 33 | void SetUniformf(int uniform, float x, float y) const; 34 | void SetUniformf(int uniform, float x, float y, float z) const; 35 | void SetUniformf(int uniform, float x, float y, float z, float w) const; 36 | void SetUniformMatrix3(int uniform, const float *m) const; 37 | void SetUniformMatrix4(int uniform, const float *m) const; 38 | private: 39 | unsigned int program_; 40 | DISALLOW_COPY_AND_ASSIGN(GLProgram); 41 | }; 42 | 43 | #endif // SHARED_GLPROGRAM_H_ 44 | -------------------------------------------------------------------------------- /shared/glshader.cc: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2010, Limbic Software, Inc. 3 | All rights reserved. 4 | This code is subject to the Google C++ Coding conventions: 5 | http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml 6 | ******************************************************************************/ 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #define SHADER_DEBUG 13 | 14 | GLShader::GLShader(unsigned int shader) 15 | : shader_(shader) { 16 | } 17 | 18 | GLShader::~GLShader() { 19 | glDeleteShader(shader_); 20 | } 21 | 22 | GLShader *GLShader::LoadAndCompile(Type type, const char *text) { 23 | GLint status; 24 | GLenum shader_type; 25 | switch (type) { 26 | case VERTEX: shader_type = GL_VERTEX_SHADER; break; 27 | case FRAGMENT: shader_type = GL_FRAGMENT_SHADER; break; 28 | default: 29 | printf("Unknown shader type %i! Should be either VERTEX or FRAGMENT!\n", type); 30 | return NULL; 31 | } 32 | GLuint shader = glCreateShader(shader_type); 33 | glShaderSource(shader, 1, &text, NULL); 34 | glCompileShader(shader); 35 | #ifdef SHADER_DEBUG 36 | GLint log_length; 37 | glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &log_length); 38 | if (log_length > 0) { 39 | GLchar *log = new GLchar[log_length]; 40 | glGetShaderInfoLog(shader, log_length, &log_length, log); 41 | printf("*** Shader source:\n%s\n*** Compile log:\n%s", text, log); 42 | delete[]log; 43 | } 44 | #endif 45 | glGetShaderiv(shader, GL_COMPILE_STATUS, &status); 46 | if (status == 0) { 47 | printf("Failed to compile shader!\n"); 48 | glDeleteShader(shader); 49 | return NULL; 50 | } 51 | return new GLShader(shader); 52 | } 53 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | hdrdemo is Copyright (C) 2011 Volker Schoenefeld 2 | http://volcore.limbic.com 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of the Limbic Software, Inc. nor the 12 | names of its contributors may be used to endorse or promote products 13 | derived from this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY LIMBIC SOFTWARE, INC. ''AS IS'' AND ANY 16 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL LIMBIC SOFTWARE, INC. BE LIABLE FOR ANY 19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | 26 | Enjoy! 27 | 28 | If you like this, consider getting one of our games: 29 | 30 | - TowerMadness http://bit.ly/towermadness 31 | - Nuts! http://bit.ly/get-nuts 32 | - Zombie Gunship bit.ly/zombie-gunship 33 | 34 | Thanks! 35 | 36 | NOTES: 37 | - linear interpolation does not work on device, because the A5 only supports half float interpolation. The textures, however, are single floats. It works well in the sim, though. 38 | -------------------------------------------------------------------------------- /shared/vertexbufferobject.cc: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2010, Limbic Software, Inc. 3 | All rights reserved. 4 | This code is subject to the Google C++ Coding conventions: 5 | http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml 6 | ******************************************************************************/ 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | VertexBufferObject::VertexBufferObject() 13 | : vbo_id_(0), 14 | ibo_id_(0), 15 | vao_id_(0) { 16 | glGenVertexArraysOES(1, &vao_id_); 17 | glBindVertexArrayOES(vao_id_); 18 | } 19 | 20 | VertexBufferObject::~VertexBufferObject() { 21 | glBindVertexArrayOES(0); 22 | glDeleteVertexArraysOES(1, &vao_id_); 23 | glBindBuffer(GL_ARRAY_BUFFER, 0); 24 | glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); 25 | glDeleteBuffers(1, &vbo_id_); 26 | glDeleteBuffers(1, &ibo_id_); 27 | } 28 | 29 | void VertexBufferObject::SetVertexData(uint8_t *data, unsigned int length, bool stream) { 30 | glGenBuffers(1, &vbo_id_); 31 | glBindBuffer(GL_ARRAY_BUFFER, vbo_id_); 32 | glBufferData(GL_ARRAY_BUFFER, length, data, stream?GL_STREAM_DRAW:GL_STATIC_DRAW); 33 | } 34 | 35 | void VertexBufferObject::SetIndexData(uint8_t *data, unsigned int length, bool stream) { 36 | glGenBuffers(1, &ibo_id_); 37 | glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo_id_); 38 | glBufferData(GL_ELEMENT_ARRAY_BUFFER, length, data, stream?GL_STREAM_DRAW:GL_STATIC_DRAW); 39 | } 40 | 41 | void VertexBufferObject::AddAttribute(int attribute, int count, int type, bool normalize, int stride, int offset) { 42 | glEnableVertexAttribArray(attribute); 43 | glVertexAttribPointer(attribute, count, type, normalize, stride, (GLvoid*)offset); 44 | } 45 | 46 | void VertexBufferObject::Draw(unsigned int type, unsigned int count, unsigned int data_type, int offset) { 47 | glBindVertexArrayOES(vao_id_); 48 | glDrawElements(type, count, data_type, (GLvoid*)offset); 49 | } 50 | -------------------------------------------------------------------------------- /shared/opengltools.mm: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2011, Volker Schoenefeld 3 | All rights reserved. 4 | This code is subject to the Google C++ Coding conventions: 5 | http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml 6 | ******************************************************************************/ 7 | #include 8 | 9 | OpenGLTools::OpenGLTools() { 10 | } 11 | 12 | OpenGLTools::~OpenGLTools() { 13 | } 14 | 15 | void OpenGLTools::GetError(const char *const where) { 16 | int error = glGetError(); 17 | if (error != GL_NO_ERROR) { 18 | NSLog(@"GL Error in '%s': %X", where, error); 19 | } 20 | } 21 | 22 | static const char *const enumToString(int e) { 23 | switch (e) { 24 | #define C(x) case x: return #x; 25 | C(GL_FRONT_FACE) 26 | #undef C 27 | default: 28 | break; 29 | } 30 | static char tmp[64]; 31 | snprintf(tmp, 64, "Unknown enum 0x%04X", e); 32 | return tmp; 33 | } 34 | 35 | void OpenGLTools::DumpCapabilities() { 36 | printf("*** OpenGL ES Capabilities Report ***\n"); 37 | printf("glGetString():\n"); 38 | printf(" Vendor: %s\n", glGetString(GL_VENDOR)); 39 | printf(" Renderer: %s\n", glGetString(GL_RENDERER)); 40 | printf(" Version: %s\n", glGetString(GL_VERSION)); 41 | printf(" Extensions:\n%s\n", glGetString(GL_EXTENSIONS)); 42 | printf("glGet*v():\n"); 43 | #define F(string) { \ 44 | float tmp = 0.0f; \ 45 | glGetFloatv(string, &tmp); \ 46 | printf(" %50s: %f\n", #string, tmp); \ 47 | } 48 | #define I(string) { \ 49 | int tmp = 0; \ 50 | glGetIntegerv(string, &tmp); \ 51 | printf(" %50s: %i\n", #string, tmp); \ 52 | } 53 | #define E(string) { \ 54 | int tmp = 0; \ 55 | glGetIntegerv(string, &tmp); \ 56 | printf(" %50s: %s\n", #string, enumToString(tmp)); \ 57 | } 58 | // Start of list 59 | I(GL_MAX_VERTEX_ATTRIBS) 60 | I(GL_MAX_VERTEX_UNIFORM_VECTORS) 61 | I(GL_MAX_VARYING_VECTORS) 62 | I(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS) 63 | I(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS) 64 | I(GL_MAX_TEXTURE_IMAGE_UNITS) 65 | I(GL_MAX_FRAGMENT_UNIFORM_VECTORS) 66 | I(GL_MAX_CUBE_MAP_TEXTURE_SIZE) 67 | I(GL_MAX_TEXTURE_SIZE) 68 | I(GL_MAX_VIEWPORT_DIMS) 69 | } -------------------------------------------------------------------------------- /tools/new_cpp_class.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import sys 3 | import os 4 | import errno 5 | import datetime 6 | 7 | year = datetime.date.today().year 8 | 9 | HEADER = """\ 10 | /******************************************************************************* 11 | Copyright (c) %(year)s, Volker Schoenefeld 12 | All rights reserved. 13 | This code is subject to the Google C++ Coding conventions: 14 | http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml 15 | ******************************************************************************/ 16 | #ifndef %(guard)s 17 | #define %(guard)s 18 | 19 | #include 20 | 21 | class %(name)s { 22 | public: 23 | %(name)s(); 24 | ~%(name)s(); 25 | private: 26 | DISALLOW_COPY_AND_ASSIGN(%(name)s); 27 | }; 28 | 29 | #endif // %(guard)s 30 | """ 31 | 32 | SOURCE = """\ 33 | /******************************************************************************* 34 | Copyright (c) %(year)s, Volker Schoenefeld 35 | All rights reserved. 36 | This code is subject to the Google C++ Coding conventions: 37 | http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml 38 | ******************************************************************************/ 39 | #include <%(hname)s> 40 | 41 | %(name)s::%(name)s() { 42 | } 43 | 44 | %(name)s::~%(name)s() { 45 | } 46 | """ 47 | 48 | def mkdir_p(path): 49 | try: 50 | os.makedirs(path) 51 | except OSError as exc: # Python >2.5 52 | if exc.errno == errno.EEXIST: 53 | pass 54 | else: raise 55 | 56 | def main(): 57 | if len(sys.argv)<3: 58 | print "Need to specify full path and class name!" 59 | return 60 | path = sys.argv[1] 61 | name = sys.argv[2] 62 | parts = path.split("/") 63 | hname = path+"/"+name.lower()+".h" 64 | ccname = path+"/"+name.lower()+".cc" 65 | print("Creating path %s..."%path) 66 | mkdir_p(path) 67 | guard = path.replace("/", "_").upper()+"_"+name.upper()+"_H_" 68 | args = dict(guard=guard, 69 | hname=hname, 70 | year=year, 71 | name=name) 72 | print("Creating file %s..."%hname) 73 | if os.path.exists(hname): 74 | print(" Error: File exists!") 75 | else: 76 | f = open(hname, "wt") 77 | f.write(HEADER%args) 78 | f.close() 79 | print("Creating file %s..."%ccname) 80 | if os.path.exists(ccname): 81 | print(" Error: File exists!") 82 | else: 83 | f = open(ccname, "wt") 84 | f.write(SOURCE%args) 85 | f.close() 86 | 87 | if __name__ == "__main__": 88 | main() 89 | -------------------------------------------------------------------------------- /hdrdemo/hdrdemo/AppDelegate.mm: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // hdrdemo 4 | // 5 | // Created by Volker Schoenefeld on 8/8/11. 6 | // Copyright (c) 2011 Volker Schoenefeld. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | #import "ViewController.h" 12 | 13 | @implementation AppDelegate 14 | 15 | @synthesize window = _window; 16 | @synthesize viewController = _viewController; 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 19 | { 20 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 21 | // Override point for customization after application launch. 22 | if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { 23 | self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPhone" bundle:nil]; 24 | } else { 25 | self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPad" bundle:nil]; 26 | } 27 | self.window.rootViewController = self.viewController; 28 | [self.window makeKeyAndVisible]; 29 | return YES; 30 | } 31 | 32 | - (void)applicationWillResignActive:(UIApplication *)application 33 | { 34 | /* 35 | Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 36 | Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 37 | */ 38 | } 39 | 40 | - (void)applicationDidEnterBackground:(UIApplication *)application 41 | { 42 | /* 43 | Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 44 | If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 45 | */ 46 | } 47 | 48 | - (void)applicationWillEnterForeground:(UIApplication *)application 49 | { 50 | /* 51 | Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 52 | */ 53 | } 54 | 55 | - (void)applicationDidBecomeActive:(UIApplication *)application 56 | { 57 | /* 58 | Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 59 | */ 60 | } 61 | 62 | - (void)applicationWillTerminate:(UIApplication *)application 63 | { 64 | /* 65 | Called when the application is about to terminate. 66 | Save data if appropriate. 67 | See also applicationDidEnterBackground:. 68 | */ 69 | } 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /tools/lightprobe_to_hdrtex.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | def do_flip_x(width, height, data): 4 | import bytebuffer 5 | ibs = bytebuffer.ReadBuffer(data) 6 | obs = bytebuffer.WriteBuffer() 7 | for y in range(height): 8 | l = [] 9 | # read one scanline 10 | for x in range(width): 11 | v = (ibs.readF32(), ibs.readF32(), ibs.readF32()) 12 | l.append(v) 13 | # write the inverted scanline 14 | for x in range(width): 15 | obs.writeF32(l[width-x-1][0]) 16 | obs.writeF32(l[width-x-1][1]) 17 | obs.writeF32(l[width-x-1][2]) 18 | return obs.get() 19 | 20 | def do_flip_y(width, height, data): 21 | import bytebuffer 22 | ibs = bytebuffer.ReadBuffer(data) 23 | obs = bytebuffer.WriteBuffer() 24 | scanlines = [] 25 | for y in range(height): 26 | scanline = [] 27 | # read one scanline 28 | for x in range(width): 29 | v = (ibs.readF32(), ibs.readF32(), ibs.readF32()) 30 | scanline.append(v) 31 | scanlines.append(scanline) 32 | for y in range(height): 33 | # write the inverted scanlines 34 | scanline = scanlines[height-y-1] 35 | for x in range(width): 36 | obs.writeF32(scanline[x][0]) 37 | obs.writeF32(scanline[x][1]) 38 | obs.writeF32(scanline[x][2]) 39 | return obs.get() 40 | 41 | def save_pfm(image, name, width, height, flip_x=False, flip_y=False): 42 | print(" writing %s..."%name) 43 | f = open(name, "wb") 44 | f.write("PF\x0a%u %u\x0a%f\x0a"%(width, height, -1)) 45 | data = image.get() 46 | if flip_x: 47 | data = do_flip_x(width, height, data) 48 | if flip_y: 49 | data = do_flip_y(width, height, data) 50 | f.write(data) 51 | f.close() 52 | 53 | def main(): 54 | import sys 55 | print("Parsing %s"%sys.argv[1]) 56 | f = open(sys.argv[1], "rb") 57 | data = f.read() 58 | f.close() 59 | import bytebuffer 60 | ibs = bytebuffer.ReadBuffer(data) 61 | pf_header = ibs.readLine() 62 | if pf_header != "PF": 63 | print("Not a color pfm!") 64 | return 65 | resolution = ibs.readLine().split(" ") 66 | width = int(resolution[0]) 67 | height = int(resolution[1]) 68 | scale = float(ibs.readLine()) 69 | if scale < 0: 70 | ibs.setEndian("<") 71 | scale = -scale 72 | else: 73 | ibs.setEndian(">") 74 | image_width = width/3 75 | image_height = height/4 76 | image = [bytebuffer.WriteBuffer() for x in range(12)] 77 | for y in range(height): 78 | for x in range(width): 79 | ix = x/image_width 80 | iy = y/image_height 81 | image_idx = ix + iy*3 82 | for c in range(3): 83 | image[image_idx].writeF32(ibs.readF32()) 84 | print("Writing images...") 85 | save_pfm(image[ 4], "rnl_ny.pfm", image_width, image_height, flip_x=False, flip_y=False) 86 | save_pfm(image[ 1], "rnl_pz.pfm", image_width, image_height, flip_x=False, flip_y=False) 87 | save_pfm(image[ 8], "rnl_px.pfm", image_width, image_height, flip_x=True, flip_y=True) 88 | save_pfm(image[ 6], "rnl_nx.pfm", image_width, image_height, flip_x=True, flip_y=True) 89 | save_pfm(image[ 7], "rnl_nz.pfm", image_width, image_height, flip_x=True, flip_y=True) 90 | save_pfm(image[10], "rnl_py.pfm", image_width, image_height, flip_x=False, flip_y=False) 91 | 92 | 93 | if __name__ == "__main__": 94 | main() 95 | -------------------------------------------------------------------------------- /scenes/histogramviz.cc: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2011, Volker Schoenefeld 3 | All rights reserved. 4 | This code is subject to the Google C++ Coding conventions: 5 | http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml 6 | ******************************************************************************/ 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | struct Vertex { 14 | float x, y; 15 | uint8_t r, g, b, a; 16 | }; 17 | 18 | HistogramViz::HistogramViz() 19 | : program_(0), 20 | vbo_(0), 21 | vbo2_(0) { 22 | } 23 | 24 | HistogramViz::~HistogramViz() { 25 | SAFE_DELETE(vbo_); 26 | SAFE_DELETE(vbo2_); 27 | SAFE_DELETE(program_); 28 | } 29 | 30 | void HistogramViz::Prepare(int size) { 31 | histogram_size_ = size; 32 | program_ = GLProgram::FromFiles("histogram", "histogram"); 33 | if (program_) { 34 | program_->BindAttribLocation("att_position", 0); 35 | program_->BindAttribLocation("att_color", 1); 36 | if (program_->Link() == false) { 37 | printf("Failed to link histogram program!\n"); 38 | SAFE_DELETE(program_); 39 | } 40 | } 41 | } 42 | 43 | void HistogramViz::Draw(float *histogram, int width, int height, float fbo_scale, float fbo_bias) { 44 | SAFE_DELETE(vbo_); 45 | SAFE_DELETE(vbo2_); 46 | // compute max of histogram 47 | float max = 0.0f; 48 | for (int i=0; i max) { 50 | max = histogram[i]; 51 | } 52 | } 53 | float hist_scale = 1.0f/max; 54 | // Build histogram VBO/IBO 55 | program_->Use(); 56 | Vertex v[histogram_size_*4]; 57 | Vertex v2[histogram_size_*1]; 58 | unsigned short id[histogram_size_*4]; 59 | unsigned short id2[histogram_size_*1]; 60 | float step_x = 1.0f/float(width); 61 | float step_y = 1.0f/float(height); 62 | float start_x = -width+step_x*0.5f; 63 | float start_y = -height+step_y*0.5f; 64 | float max_height = 200.0f; 65 | for (int i=0; i 1.0f) stm = 1.0f; 94 | v2[i+0].x = (start_x+i*2)*step_x; 95 | v2[i+0].y = (start_y+stm*max_height)*step_y; 96 | v2[i+0].r = 128; 97 | v2[i+0].g = 255; 98 | v2[i+0].b = 128; 99 | v2[i+0].a = 96; 100 | } 101 | for (int i=0; iSetVertexData((uint8_t*)v, sizeof(v), true); 114 | vbo_->SetIndexData((uint8_t*)id, sizeof(id), true); 115 | vbo_->AddAttribute(0, 2, GL_FLOAT, false, sizeof(Vertex), offsetof(Vertex, x)); 116 | vbo_->AddAttribute(1, 4, GL_UNSIGNED_BYTE, true, sizeof(Vertex), offsetof(Vertex, r)); 117 | vbo_->Draw(GL_LINES, histogram_size_*4, GL_UNSIGNED_SHORT, 0); 118 | vbo_ = new VertexBufferObject(); 119 | if (vbo2_ == 0) { 120 | vbo2_ = new VertexBufferObject(); 121 | } 122 | vbo2_->SetVertexData((uint8_t*)v2, sizeof(v2), true); 123 | vbo2_->SetIndexData((uint8_t*)id2, sizeof(id2), true); 124 | vbo2_->AddAttribute(0, 2, GL_FLOAT, false, sizeof(Vertex), offsetof(Vertex, x)); 125 | vbo2_->AddAttribute(1, 4, GL_UNSIGNED_BYTE, true, sizeof(Vertex), offsetof(Vertex, r)); 126 | vbo2_->Draw(GL_LINE_STRIP, histogram_size_, GL_UNSIGNED_SHORT, 0); 127 | glDisable(GL_BLEND); 128 | } 129 | -------------------------------------------------------------------------------- /scenes/hdrcubemap.mm: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2011, Volker Schoenefeld 3 | All rights reserved. 4 | This code is subject to the Google C++ Coding conventions: 5 | http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml 6 | ******************************************************************************/ 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | static GLfloat gCubeVertexData[] = { 14 | -5.0f, -5.0f, -5.0f, // 0 15 | 5.0f, -5.0f, -5.0f, // 1 16 | -5.0f, 5.0f, -5.0f, // 2 17 | 5.0f, 5.0f, -5.0f, // 3 18 | -5.0f, -5.0f, 5.0f, // 4 19 | 5.0f, -5.0f, 5.0f, // 5 20 | -5.0f, 5.0f, 5.0f, // 6 21 | 5.0f, 5.0f, 5.0f, // 7 22 | }; 23 | 24 | static unsigned short gCubeIndexData[] = { 25 | 0, 1, 2, 2, 1, 3, // xx- 26 | 4, 5, 6, 6, 5, 7, // xx+ 27 | 0, 1, 4, 4, 1, 5, // x-x 28 | 2, 3, 6, 6, 3, 7, // x+x 29 | 0, 2, 4, 4, 2, 6, // -xx 30 | 1, 3, 5, 5, 3, 7, // +xx 31 | }; 32 | 33 | 34 | HDRCubeMap::HDRCubeMap() 35 | : program_(0), 36 | texid_(0), 37 | vbo_(0) { 38 | } 39 | 40 | HDRCubeMap::~HDRCubeMap() { 41 | SAFE_DELETE(vbo_); 42 | } 43 | 44 | void HDRCubeMap::Reset() { 45 | if (texid_ != 0) { 46 | glDeleteTextures(1, &texid_); 47 | } 48 | SAFE_DELETE(vbo_); 49 | SAFE_DELETE(program_); 50 | } 51 | 52 | void HDRCubeMap::LoadPFMTexture(const char *const filename, int type) { 53 | NSString *ns_filename = [NSString stringWithUTF8String:filename]; 54 | NSString *ns_pathname = [[NSBundle mainBundle] pathForResource:ns_filename ofType:@"pfm"]; 55 | NSData *data = [NSData dataWithContentsOfFile:ns_pathname]; 56 | int width = 256; 57 | int height = 256; 58 | void *pixeldata = ((uint8_t*)data.bytes)+21; 59 | glTexImage2D(type, 0, GL_RGB, width, height, 0, GL_RGB, GL_FLOAT, pixeldata); 60 | OpenGLTools::GetError("uploadpfm"); 61 | } 62 | 63 | void HDRCubeMap::Prepare(bool filtering) { 64 | Reset(); 65 | // load the shader 66 | program_ = GLProgram::FromFiles("hdrcubemap", "hdrcubemap"); 67 | if (program_) { 68 | program_->BindAttribLocation("att_position", 0); 69 | if (program_->Link() == false) { 70 | printf("Failed to link histogram program!\n"); 71 | SAFE_DELETE(program_); 72 | } else { 73 | uni_texture_location_ = program_->GetUniformLocation("uni_texture"); 74 | uni_mvp_location_ = program_->GetUniformLocation("uni_mvp"); 75 | } 76 | } 77 | // Build the VBO 78 | vbo_ = new VertexBufferObject(); 79 | vbo_->SetVertexData(reinterpret_cast(gCubeVertexData), sizeof(gCubeVertexData)); 80 | vbo_->SetIndexData(reinterpret_cast(gCubeIndexData), sizeof(gCubeIndexData)); 81 | vbo_->AddAttribute(0, 3, GL_FLOAT, GL_FALSE, 12, 0); 82 | // Load the texture 83 | glGenTextures(1, &texid_); 84 | glBindTexture(GL_TEXTURE_CUBE_MAP, texid_); 85 | if (filtering) { 86 | glTexParameterf(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 87 | glTexParameterf(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 88 | } else { 89 | glTexParameterf(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 90 | glTexParameterf(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 91 | } 92 | //glTexParameterf(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE); 93 | glTexParameterf(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 94 | glTexParameterf(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 95 | OpenGLTools::GetError("pre-uploadpfm"); 96 | LoadPFMTexture("rnl_nx", GL_TEXTURE_CUBE_MAP_NEGATIVE_X); 97 | LoadPFMTexture("rnl_ny", GL_TEXTURE_CUBE_MAP_NEGATIVE_Y); 98 | LoadPFMTexture("rnl_nz", GL_TEXTURE_CUBE_MAP_NEGATIVE_Z); 99 | LoadPFMTexture("rnl_px", GL_TEXTURE_CUBE_MAP_POSITIVE_X); 100 | LoadPFMTexture("rnl_py", GL_TEXTURE_CUBE_MAP_POSITIVE_Y); 101 | LoadPFMTexture("rnl_pz", GL_TEXTURE_CUBE_MAP_POSITIVE_Z); 102 | OpenGLTools::GetError("post-uploadpfm"); 103 | glBindTexture(GL_TEXTURE_2D, 0); 104 | } 105 | 106 | void HDRCubeMap::Draw(float *mvp) { 107 | //glDisable(GL_DEPTH_TEST); 108 | //glDepthMask(false); 109 | glDepthMask(true); 110 | glEnable(GL_DEPTH_TEST); 111 | program_->Use(); 112 | glBindTexture(GL_TEXTURE_CUBE_MAP, texid_); 113 | program_->SetUniformi(uni_texture_location_, 0); 114 | program_->SetUniformMatrix4(uni_mvp_location_, mvp); 115 | vbo_->Draw(GL_TRIANGLES, sizeof(gCubeIndexData)/sizeof(unsigned short), GL_UNSIGNED_SHORT, 0); 116 | glDepthMask(true); 117 | glEnable(GL_DEPTH_TEST); 118 | } 119 | -------------------------------------------------------------------------------- /tools/bytebuffer.py: -------------------------------------------------------------------------------- 1 | from struct import * 2 | import string 3 | from binascii import b2a_hex 4 | 5 | FILTER=''.join([(len(repr(chr(x)))==3) and chr(x) or '.' for x in range(256)]) 6 | 7 | def dump(src, length=16): 8 | N=0; result='' 9 | while src: 10 | s,src = src[:length],src[length:] 11 | hexa = ' '.join(["%02X"%ord(x) for x in s]) 12 | s = s.translate(FILTER) 13 | result += "%04X %-*s %s\n" % (N, length*3, hexa, s) 14 | N+=length 15 | return result 16 | 17 | class WriteBuffer: 18 | def __init__(self): 19 | self.data = [] 20 | 21 | def write(self, d): 22 | self.data.append(d) 23 | 24 | def writeU8(self, v): 25 | self.data.append(pack(' 0: 138 | s += chr(n) 139 | n = self.readU8() 140 | return s 141 | 142 | def readStr8(self): 143 | l = self.readU8() 144 | s = self.data[self.offset:self.offset+l] 145 | self.offset += l 146 | return s 147 | 148 | def readStr16(self): 149 | l = self.readU16() 150 | s = self.data[self.offset:self.offset+l] 151 | self.offset += l 152 | return s 153 | 154 | def readStr32(self): 155 | l = self.readU32() 156 | s = self.data[self.offset:self.offset+l] 157 | self.offset += l 158 | return s 159 | 160 | def length(self): 161 | return len(self.data) 162 | 163 | def dump(self): 164 | return "ReadBuffer of length %i at offset %i with data\n%s"%(len(self.data), 165 | self.offset, dump(self.data)) 166 | -------------------------------------------------------------------------------- /shared/framebufferobject.mm: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2010, Limbic Software, Inc. 3 | All rights reserved. 4 | This code is subject to the Google C++ Coding conventions: 5 | http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml 6 | ******************************************************************************/ 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | FramebufferObject::FramebufferObject() 14 | : width_(0), 15 | height_(0), 16 | fbo_id_(0), 17 | tex_id_(0), 18 | depthrb_id_(0), 19 | colorrb_id_(0) { 20 | } 21 | 22 | FramebufferObject::~FramebufferObject() { 23 | if (tex_id_) { 24 | glDeleteTextures(1, &tex_id_); 25 | tex_id_ = 0; 26 | } 27 | if (colorrb_id_) { 28 | glDeleteRenderbuffers(1, &colorrb_id_); 29 | colorrb_id_ = 0; 30 | } 31 | if (depthrb_id_) { 32 | glDeleteRenderbuffers(1, &depthrb_id_); 33 | depthrb_id_ = 0; 34 | } 35 | if (fbo_id_) { 36 | glDeleteFramebuffers(1, &fbo_id_); 37 | fbo_id_ = 0; 38 | } 39 | } 40 | 41 | FramebufferObject *FramebufferObject::Create(int width, int height, ColorType color, DepthType depth) { 42 | FramebufferObject *fbo = new FramebufferObject(); 43 | fbo->width_ = width; 44 | fbo->height_ = height; 45 | glGenFramebuffers(1, &fbo->fbo_id_); 46 | glBindFramebuffer(GL_FRAMEBUFFER, fbo->fbo_id_); 47 | if (color >= HDR) { 48 | // Create the HDR render target 49 | unsigned int format = GL_UNSIGNED_BYTE; 50 | unsigned int type = GL_RGB; 51 | switch (color) { 52 | case RGB16F: type = GL_RGB; format = GL_HALF_FLOAT_OES; break; 53 | default: 54 | case RGBA16F: type = GL_RGBA; format = GL_HALF_FLOAT_OES; break; 55 | } 56 | glGenTextures(1, &fbo->tex_id_); 57 | glBindTexture(GL_TEXTURE_2D, fbo->tex_id_); 58 | glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 59 | glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 60 | glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 61 | glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 62 | glTexImage2D(GL_TEXTURE_2D, 0, type, width, height, 0, type, format, 0); 63 | glBindTexture(GL_TEXTURE_2D, 0); 64 | glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, fbo->tex_id_, 0); 65 | } else { 66 | // Create the color render target 67 | glGenTextures(1, &fbo->tex_id_); 68 | glBindTexture(GL_TEXTURE_2D, fbo->tex_id_); 69 | unsigned int internal_format = GL_RGB; 70 | unsigned int upload_format = GL_UNSIGNED_BYTE; 71 | switch (color) { 72 | case RGBA8888: internal_format = GL_RGBA; break; 73 | default: 74 | case RGB888: internal_format = GL_RGB; break; 75 | } 76 | glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 77 | glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 78 | glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 79 | glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 80 | glTexImage2D(GL_TEXTURE_2D, 0, internal_format, width, height, 0, GL_RGB, upload_format, 0); 81 | glBindTexture(GL_TEXTURE_2D, 0); 82 | // Bind color buffer 83 | glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, fbo->tex_id_, 0); 84 | } 85 | // Bind depth buffer 86 | if (depth != NoDepth) { 87 | glGenRenderbuffers(1, &fbo->depthrb_id_); 88 | glBindRenderbuffer(GL_RENDERBUFFER, fbo->depthrb_id_); 89 | unsigned int depth_format = 0; 90 | switch (depth) { 91 | case Depth24: depth_format = GL_DEPTH_COMPONENT24_OES; break; 92 | default: 93 | case Depth16: depth_format = GL_DEPTH_COMPONENT16; break; 94 | } 95 | glRenderbufferStorage(GL_RENDERBUFFER, depth_format, width, height); 96 | glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, fbo->depthrb_id_); 97 | glBindRenderbuffer(GL_RENDERBUFFER, 0); 98 | } 99 | // Finalize 100 | if(glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) { 101 | printf("failed to make complete rtt framebuffer object %x\n", glCheckFramebufferStatus(GL_FRAMEBUFFER)); 102 | } 103 | glBindFramebuffer(GL_FRAMEBUFFER, 0); 104 | return fbo; 105 | } 106 | 107 | void FramebufferObject::Activate() { 108 | glGetIntegerv(GL_FRAMEBUFFER_BINDING, &old_fbo_); 109 | glGetIntegerv(GL_VIEWPORT, old_viewport_); 110 | glBindFramebuffer(GL_FRAMEBUFFER, fbo_id_); 111 | glViewport(0, 0, width_, height_); 112 | } 113 | 114 | void FramebufferObject::Deactivate() { 115 | glBindFramebuffer(GL_FRAMEBUFFER, old_fbo_); 116 | glViewport(old_viewport_[0], old_viewport_[1], old_viewport_[2], old_viewport_[3]); 117 | } -------------------------------------------------------------------------------- /shared/glprogram.mm: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2010, Limbic Software, Inc. 3 | All rights reserved. 4 | This code is subject to the Google C++ Coding conventions: 5 | http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml 6 | ******************************************************************************/ 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #define DEBUG_PROGRAM 14 | #define VALIDATE_PROGRAM 15 | 16 | GLProgram::GLProgram() 17 | : program_(0) { 18 | program_ = glCreateProgram(); 19 | } 20 | 21 | GLProgram::~GLProgram() { 22 | glDeleteProgram(program_); 23 | } 24 | 25 | GLProgram *GLProgram::FromFiles(const char *vertex_shader_filename, const char *fragment_shader_filename) { 26 | // Load the vertex shader 27 | NSString *ns_vertex_shader_filename = [NSString stringWithUTF8String:vertex_shader_filename]; 28 | NSString *vertex_shader_pathname = [[NSBundle mainBundle] pathForResource:ns_vertex_shader_filename ofType:@"vsh"]; 29 | const GLchar *vertex_shader_source; 30 | vertex_shader_source = (GLchar *)[[NSString stringWithContentsOfFile:vertex_shader_pathname encoding:NSUTF8StringEncoding error:nil] UTF8String]; 31 | GLShader *vertex_shader = 0; 32 | if (vertex_shader_source) { 33 | vertex_shader = GLShader::LoadAndCompile(GLShader::VERTEX, vertex_shader_source); 34 | } 35 | // Load the fragment shader 36 | NSString *ns_fragment_shader_filename = [NSString stringWithUTF8String:fragment_shader_filename]; 37 | NSString *fragment_shader_pathname = [[NSBundle mainBundle] pathForResource:ns_fragment_shader_filename ofType:@"fsh"]; 38 | const GLchar *fragment_shader_source; 39 | fragment_shader_source = (GLchar *)[[NSString stringWithContentsOfFile:fragment_shader_pathname encoding:NSUTF8StringEncoding error:nil] UTF8String]; 40 | GLShader *fragment_shader = 0; 41 | if (fragment_shader_source) { 42 | fragment_shader = GLShader::LoadAndCompile(GLShader::FRAGMENT, fragment_shader_source); 43 | } 44 | // Check for valid shaders 45 | if (!vertex_shader || !fragment_shader) { 46 | SAFE_DELETE(vertex_shader); 47 | SAFE_DELETE(fragment_shader); 48 | return NULL; 49 | } 50 | GLProgram *program = new GLProgram(); 51 | program->Attach(vertex_shader); 52 | program->Attach(fragment_shader); 53 | SAFE_DELETE(vertex_shader); 54 | SAFE_DELETE(fragment_shader); 55 | return program; 56 | } 57 | 58 | 59 | GLProgram *GLProgram::FromText(const char *vertex_shader_source, const char *fragment_shader_source) { 60 | GLShader *vertex_shader = GLShader::LoadAndCompile(GLShader::VERTEX, vertex_shader_source); 61 | GLShader *fragment_shader = GLShader::LoadAndCompile(GLShader::FRAGMENT, fragment_shader_source); 62 | if (!vertex_shader || !fragment_shader) { 63 | SAFE_DELETE(vertex_shader); 64 | SAFE_DELETE(fragment_shader); 65 | return NULL; 66 | } 67 | GLProgram *program = new GLProgram(); 68 | program->Attach(vertex_shader); 69 | program->Attach(fragment_shader); 70 | SAFE_DELETE(vertex_shader); 71 | SAFE_DELETE(fragment_shader); 72 | return program; 73 | } 74 | 75 | void GLProgram::Attach(const GLShader *shader) const { 76 | glAttachShader(program_, shader->shader()); 77 | } 78 | 79 | bool GLProgram::Link() const { 80 | glLinkProgram(program_); 81 | #ifdef DEBUG_PROGRAM 82 | GLint log_length; 83 | glGetProgramiv(program_, GL_INFO_LOG_LENGTH, &log_length); 84 | if (log_length > 0) { 85 | GLchar *log = new GLchar[log_length]; 86 | glGetProgramInfoLog(program_, log_length, &log_length, log); 87 | printf("*** Program link log:\n%s", log); 88 | delete[] log; 89 | } 90 | #endif 91 | GLint status; 92 | glGetProgramiv(program_, GL_LINK_STATUS, &status); 93 | if (status == 0) 94 | return false; 95 | return true; 96 | } 97 | 98 | void GLProgram::BindAttribLocation(const char *name, AttributeLocation location) const { 99 | glBindAttribLocation(program_, location, name); 100 | } 101 | 102 | bool GLProgram::Validate() const { 103 | GLint log_length; 104 | glValidateProgram(program_); 105 | glGetProgramiv(program_, GL_INFO_LOG_LENGTH, &log_length); 106 | if (log_length > 0) { 107 | GLchar *log = new GLchar[log_length]; 108 | glGetProgramInfoLog(program_, log_length, &log_length, log); 109 | printf("*** Program validate log:\n%s", log); 110 | delete []log; 111 | } 112 | GLint status; 113 | glGetProgramiv(program_, GL_VALIDATE_STATUS, &status); 114 | if (status == 0) 115 | return false; 116 | return true; 117 | } 118 | 119 | void GLProgram::Use() const { 120 | #ifdef VALIDATE_PROGRAM 121 | Validate(); 122 | #endif 123 | glUseProgram(program_); 124 | } 125 | 126 | void GLProgram::Disable() const { 127 | glUseProgram(0); 128 | } 129 | 130 | UniformLocation GLProgram::GetUniformLocation(const char *name) const { 131 | return glGetUniformLocation(program_, name); 132 | } 133 | 134 | UniformLocation GLProgram::GetAttribLocation(const char *name) const { 135 | return glGetAttribLocation(program_, name); 136 | } 137 | 138 | void GLProgram::SetUniformi(int uniform, int x) const { 139 | glUniform1i(uniform, x); 140 | } 141 | 142 | void GLProgram::SetUniformf(int uniform, float x) const { 143 | glUniform1f(uniform, x); 144 | } 145 | 146 | void GLProgram::SetUniformf(int uniform, float x, float y) const { 147 | glUniform2f(uniform, x, y); 148 | } 149 | 150 | void GLProgram::SetUniformf(int uniform, float x, float y, float z) const { 151 | glUniform3f(uniform, x, y, z); 152 | } 153 | 154 | void GLProgram::SetUniformf(int uniform, float x, float y, float z, float w) const { 155 | glUniform4f(uniform, x, y, z, w); 156 | } 157 | 158 | void GLProgram::SetUniformMatrix3(int uniform, const float *v) const { 159 | glUniformMatrix3fv(uniform, 1, GL_FALSE, v); 160 | } 161 | 162 | void GLProgram::SetUniformMatrix4(int uniform, const float *v) const { 163 | glUniformMatrix4fv(uniform, 1, GL_FALSE, v); 164 | } 165 | -------------------------------------------------------------------------------- /hdrdemo/hdrdemo/en.lproj/ViewController_iPhone.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1280 5 | 10J869 6 | 1880 7 | 1038.35 8 | 461.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 874 12 | 13 | 14 | YES 15 | IBProxyObject 16 | IBUIView 17 | 18 | 19 | YES 20 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 21 | 22 | 23 | PluginDependencyRecalculationVersion 24 | 25 | 26 | 27 | YES 28 | 29 | IBFilesOwner 30 | IBCocoaTouchFramework 31 | 32 | 33 | IBFirstResponder 34 | IBCocoaTouchFramework 35 | 36 | 37 | 38 | 274 39 | {320, 460} 40 | 41 | 42 | 43 | 3 44 | MQA 45 | 46 | 2 47 | 48 | 49 | NO 50 | IBCocoaTouchFramework 51 | 52 | 53 | 54 | 55 | YES 56 | 57 | 58 | view 59 | 60 | 61 | 62 | 3 63 | 64 | 65 | 66 | 67 | YES 68 | 69 | 0 70 | 71 | YES 72 | 73 | 74 | 75 | 76 | 77 | -1 78 | 79 | 80 | File's Owner 81 | 82 | 83 | -2 84 | 85 | 86 | 87 | 88 | 2 89 | 90 | 91 | 92 | 93 | 94 | 95 | YES 96 | 97 | YES 98 | -1.CustomClassName 99 | -1.IBPluginDependency 100 | -2.CustomClassName 101 | -2.IBPluginDependency 102 | 2.CustomClassName 103 | 2.IBPluginDependency 104 | 105 | 106 | YES 107 | ViewController 108 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 109 | UIResponder 110 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 111 | GLKView 112 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 113 | 114 | 115 | 116 | YES 117 | 118 | 119 | 120 | 121 | 122 | YES 123 | 124 | 125 | 126 | 127 | 4 128 | 129 | 130 | 0 131 | IBCocoaTouchFramework 132 | 133 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 134 | 135 | 136 | YES 137 | 3 138 | 874 139 | 140 | 141 | -------------------------------------------------------------------------------- /hdrdemo/hdrdemo/ViewController.mm: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // hdrdemo 4 | // 5 | // Created by Volker Schoenefeld on 8/8/11. 6 | // Copyright (c) 2011 Volker Schoenefeld. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #define BUFFER_OFFSET(i) ((int)NULL + (i)) 18 | 19 | // Uniform index. 20 | enum 21 | { 22 | UNIFORM_MODELVIEWPROJECTION_MATRIX, 23 | UNIFORM_NORMAL_MATRIX, 24 | NUM_UNIFORMS 25 | }; 26 | GLint uniforms[NUM_UNIFORMS]; 27 | 28 | // Attribute index. 29 | enum 30 | { 31 | ATTRIB_VERTEX, 32 | ATTRIB_NORMAL, 33 | ATTRIB_TEXCOORD, 34 | NUM_ATTRIBUTES 35 | }; 36 | 37 | GLfloat gCubeVertexData[216] = 38 | { 39 | // Data layout for each line below is: 40 | // positionX, positionY, positionZ, normalX, normalY, normalZ, 41 | 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 42 | 0.5f, 0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 43 | 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 44 | 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 45 | 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 46 | 0.5f, 0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 47 | 48 | 0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 49 | -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 50 | 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 51 | 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 52 | -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 53 | -0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 54 | 55 | -0.5f, 0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 56 | -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 57 | -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 58 | -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 59 | -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 60 | -0.5f, -0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 61 | 62 | -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 63 | 0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 64 | -0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 65 | -0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 66 | 0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 67 | 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 68 | 69 | 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 70 | -0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 71 | 0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 72 | 0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 73 | -0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 74 | -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 75 | 76 | 0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 77 | -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 78 | 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 79 | 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 80 | -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 81 | -0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f 82 | }; 83 | 84 | unsigned short gCubeIndexData[] = { 85 | 0, 1, 2, 86 | 3, 4, 5, 87 | 6, 7, 8, 88 | 9, 10, 11, 89 | 12, 13, 14, 90 | 15, 16, 17, 91 | 18, 19, 20, 92 | 21, 22, 23, 93 | 24, 25, 26, 94 | 27, 28, 29, 95 | 30, 31, 32, 96 | 33, 34, 35 97 | }; 98 | 99 | GLfloat gFBOVertexData[] = { 100 | -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 101 | -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 102 | 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 103 | 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 104 | }; 105 | 106 | unsigned short gFBOIndexData[] = { 107 | 0, 1, 2, 108 | 0, 2, 3 109 | }; 110 | 111 | static void myglPushGroupMarker(const char *const name) { 112 | glPushGroupMarkerEXT(strlen(name)+1, name); 113 | } 114 | 115 | 116 | @interface ViewController () { 117 | GLProgram *_program; 118 | GLProgram *_fbo_program; 119 | GLint _fbo_tex_bind; 120 | GLint _fbo_lineartonemap_scale; 121 | GLint _fbo_lineartonemap_bias; 122 | float _fbo_scale; 123 | float _fbo_bias; 124 | FramebufferObject *_fbo; 125 | VertexBufferObject *_vbo; 126 | VertexBufferObject *_fbo_vbo; 127 | 128 | HDRCubeMap *_hdrcubemap; 129 | 130 | GLKMatrix4 _modelViewProjectionMatrix; 131 | GLKMatrix4 _viewProjectionMatrix; 132 | GLKMatrix3 _normalMatrix; 133 | float _rotation; 134 | 135 | GLuint _vertexArray; 136 | GLuint _vertexBuffer; 137 | 138 | bool _renderingHDR; 139 | 140 | // Histogram stuff 141 | float _histogramValues[HISTOGRAM_SIZE]; 142 | dispatch_queue_t _histogramQueue; 143 | bool _histogramActive; 144 | HistogramViz *_histogramViz; 145 | } 146 | @property (strong, nonatomic) EAGLContext *context; 147 | @property (strong, nonatomic) GLKBaseEffect *effect; 148 | 149 | - (void)setupHDR; 150 | - (void)setupGL; 151 | - (void)tearDownGL; 152 | 153 | @end 154 | 155 | @implementation ViewController 156 | 157 | @synthesize context = _context; 158 | @synthesize effect = _effect; 159 | 160 | - (void)viewDidLoad 161 | { 162 | [super viewDidLoad]; 163 | 164 | self.context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; 165 | 166 | if (!self.context) { 167 | NSLog(@"Failed to create ES context"); 168 | } 169 | 170 | GLKView *view = (GLKView *)self.view; 171 | view.context = self.context; 172 | view.drawableDepthFormat = GLKViewDrawableDepthFormat24; 173 | _fbo_scale = 0.5f; 174 | _fbo_bias = -0.5f; 175 | // Prepare histogram buffer 176 | _histogramQueue = dispatch_queue_create("histogram_queue", 0); 177 | _histogramActive = false; 178 | _histogramView.hidden = !_histogramButton.on; 179 | [self setupGL]; 180 | } 181 | 182 | - (void)viewDidUnload 183 | { 184 | [super viewDidUnload]; 185 | 186 | [self tearDownGL]; 187 | 188 | if ([EAGLContext currentContext] == self.context) { 189 | [EAGLContext setCurrentContext:nil]; 190 | } 191 | self.context = nil; 192 | } 193 | 194 | - (void)didReceiveMemoryWarning 195 | { 196 | [super didReceiveMemoryWarning]; 197 | // Release any cached data, images, etc. that aren't in use. 198 | } 199 | 200 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 201 | { 202 | // Return YES for supported orientations 203 | if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { 204 | return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); 205 | } else { 206 | return YES; 207 | } 208 | } 209 | 210 | - (void)setupHDR { 211 | SAFE_DELETE(_fbo); 212 | FramebufferObject::ColorType colortype = FramebufferObject::RGB888; 213 | if (_hdrButton.on) { 214 | colortype = FramebufferObject::RGB16F; 215 | _renderingHDR = true; 216 | } else { 217 | _renderingHDR = false; 218 | } 219 | _fbo = FramebufferObject::Create(self.view.bounds.size.width, self.view.bounds.size.height, colortype, FramebufferObject::Depth16); 220 | } 221 | 222 | - (void)setupGL 223 | { 224 | [EAGLContext setCurrentContext:self.context]; 225 | 226 | printf("GL Extensions: %s\n", glGetString(GL_EXTENSIONS)); 227 | 228 | [self setupHDR]; 229 | 230 | _fbo_program = GLProgram::FromFiles("FBOShader", "lineartonemap"); 231 | if (_fbo_program) { 232 | _fbo_program->BindAttribLocation("att_position", ATTRIB_VERTEX); 233 | _fbo_program->BindAttribLocation("att_texcoord", ATTRIB_TEXCOORD); 234 | if (_fbo_program->Link() == false) { 235 | printf("Failed to link program!\n"); 236 | SAFE_DELETE(_fbo_program); 237 | } 238 | _fbo_tex_bind = _fbo_program->GetUniformLocation("texture"); 239 | _fbo_lineartonemap_scale = _fbo_program->GetUniformLocation("scale"); 240 | _fbo_lineartonemap_bias = _fbo_program->GetUniformLocation("bias"); 241 | } 242 | _program = GLProgram::FromFiles("Shader", "Shader"); 243 | if (_program) { 244 | _program->BindAttribLocation("position", ATTRIB_VERTEX); 245 | _program->BindAttribLocation("normal", ATTRIB_NORMAL); 246 | if (_program->Link() == false) { 247 | printf("Failed to link program!\n"); 248 | SAFE_DELETE(_program); 249 | } 250 | } 251 | if (_program) { 252 | uniforms[UNIFORM_MODELVIEWPROJECTION_MATRIX] = _program->GetUniformLocation("modelViewProjectionMatrix"); 253 | uniforms[UNIFORM_NORMAL_MATRIX] = _program->GetUniformLocation("normalMatrix"); 254 | } 255 | 256 | self.effect = [[GLKBaseEffect alloc] init]; 257 | self.effect.light0.enabled = GL_TRUE; 258 | self.effect.light0.diffuseColor = GLKVector4Make(1.0f, 0.4f, 0.4f, 1.0f); 259 | 260 | _vbo = new VertexBufferObject(); 261 | _vbo->SetVertexData(reinterpret_cast(gCubeVertexData), sizeof(gCubeVertexData)); 262 | _vbo->SetIndexData(reinterpret_cast(gCubeIndexData), sizeof(gCubeIndexData)); 263 | _vbo->AddAttribute(GLKVertexAttribPosition, 3, GL_FLOAT, GL_FALSE, 24, BUFFER_OFFSET(0)); 264 | _vbo->AddAttribute(GLKVertexAttribNormal, 3, GL_FLOAT, GL_FALSE, 24, BUFFER_OFFSET(12)); 265 | 266 | _fbo_vbo = new VertexBufferObject(); 267 | _vbo->SetVertexData(reinterpret_cast(gFBOVertexData), sizeof(gFBOVertexData)); 268 | _vbo->SetIndexData(reinterpret_cast(gFBOIndexData), sizeof(gFBOIndexData)); 269 | _vbo->AddAttribute(ATTRIB_VERTEX, 3, GL_FLOAT, GL_FALSE, 20, BUFFER_OFFSET(0)); 270 | _vbo->AddAttribute(ATTRIB_TEXCOORD, 2, GL_FLOAT, GL_FALSE, 20, BUFFER_OFFSET(12)); 271 | 272 | _hdrcubemap = new HDRCubeMap(); 273 | _hdrcubemap->Prepare([_filterTextures isOn]); 274 | _histogramViz = new HistogramViz(); 275 | _histogramViz->Prepare(HISTOGRAM_SIZE); 276 | } 277 | 278 | - (void)tearDownGL 279 | { 280 | [EAGLContext setCurrentContext:self.context]; 281 | 282 | dispatch_release(_histogramQueue); 283 | 284 | SAFE_DELETE(_histogramViz); 285 | SAFE_DELETE(_hdrcubemap); 286 | SAFE_DELETE(_fbo); 287 | SAFE_DELETE(_vbo); 288 | 289 | glDeleteBuffers(1, &_vertexBuffer); 290 | glDeleteVertexArraysOES(1, &_vertexArray); 291 | 292 | self.effect = nil; 293 | 294 | SAFE_DELETE(_program); 295 | SAFE_DELETE(_fbo_program); 296 | } 297 | 298 | #pragma mark - GLKView and GLKViewController delegate methods 299 | 300 | - (void)update 301 | { 302 | float aspect = fabsf(self.view.bounds.size.width / self.view.bounds.size.height); 303 | GLKMatrix4 projectionMatrix = GLKMatrix4MakePerspective(GLKMathDegreesToRadians(65.0f), aspect, 0.1f, 100.0f); 304 | 305 | self.effect.transform.projectionMatrix = projectionMatrix; 306 | 307 | GLKMatrix4 baseModelViewMatrix = GLKMatrix4MakeTranslation(0.0f, 0.0f, -4.0f); 308 | baseModelViewMatrix = GLKMatrix4Rotate(baseModelViewMatrix, _rotation, 0.0f, 1.0f, 0.0f); 309 | 310 | // Compute the model view matrix for the object rendered with GLKit 311 | GLKMatrix4 modelViewMatrix = GLKMatrix4MakeTranslation(0.0f, 0.0f, -1.5f); 312 | modelViewMatrix = GLKMatrix4Rotate(modelViewMatrix, _rotation, 1.0f, 1.0f, 1.0f); 313 | modelViewMatrix = GLKMatrix4Multiply(baseModelViewMatrix, modelViewMatrix); 314 | 315 | self.effect.transform.modelviewMatrix = modelViewMatrix; 316 | 317 | // Compute the model view matrix for the object rendered with ES2 318 | modelViewMatrix = GLKMatrix4MakeTranslation(0.0f, 0.0f, 1.5f); 319 | modelViewMatrix = GLKMatrix4Rotate(modelViewMatrix, _rotation, 1.0f, 1.0f, 1.0f); 320 | modelViewMatrix = GLKMatrix4Multiply(baseModelViewMatrix, modelViewMatrix); 321 | 322 | _normalMatrix = GLKMatrix4GetMatrix3(GLKMatrix4InvertAndTranspose(modelViewMatrix, NULL)); 323 | 324 | _viewProjectionMatrix = GLKMatrix4Multiply(projectionMatrix, baseModelViewMatrix); 325 | _modelViewProjectionMatrix = GLKMatrix4Multiply(projectionMatrix, modelViewMatrix); 326 | 327 | _rotation += self.timeSinceLastUpdate * 0.5f; 328 | } 329 | 330 | - (void)glkView:(GLKView *)view drawInRect:(CGRect)rect 331 | { 332 | // Read configuration 333 | _fbo_scale = [_scaleSlider value]; 334 | _fbo_bias = [_biasSlider value]; 335 | // Start rendering 336 | myglPushGroupMarker("HDR Rendering"); 337 | // enable rendering to HDR buffer 338 | _fbo->Activate(); 339 | // Draw the scene 340 | glClearColor(0.0f, 0.0f, 0.0f, 1.0f); 341 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 342 | // render the cube map 343 | _hdrcubemap->Draw(_viewProjectionMatrix.m); 344 | // Render the object with GLKit 345 | [self.effect prepareToDraw]; 346 | _vbo->Draw(GL_TRIANGLES, 36, GL_UNSIGNED_SHORT, 0); 347 | // Render the object again with plain ES2 348 | _program->Use(); 349 | _program->SetUniformMatrix4(uniforms[UNIFORM_MODELVIEWPROJECTION_MATRIX], _modelViewProjectionMatrix.m); 350 | _program->SetUniformMatrix3(uniforms[UNIFORM_NORMAL_MATRIX], _normalMatrix.m); 351 | _vbo->Draw(GL_TRIANGLES, 36, GL_UNSIGNED_SHORT, 0); 352 | // Optionally read the framebuffer and compute the histogram 353 | if (_histogramButton.on) { 354 | if (_histogramActive == false) { 355 | int width = self.view.bounds.size.width; 356 | int height = self.view.bounds.size.height; 357 | __block float *hdrbuffer = new float[width*height*4]; 358 | __block uint8_t *ldrbuffer = new uint8_t[width*height*4]; 359 | myglPushGroupMarker("Histogram"); 360 | // Should use GL_HALF_FLOAT_OES here, but needs additional conversion routine. Letting the driver do that for now. 361 | if (_renderingHDR) { 362 | glReadPixels(0, 0, width, height, GL_RGBA, GL_FLOAT, hdrbuffer); 363 | } else { 364 | glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, ldrbuffer); 365 | } 366 | OpenGLTools::GetError("histogram_read"); 367 | glPopGroupMarkerEXT(); 368 | _histogramActive = true; 369 | dispatch_async(_histogramQueue, ^{ 370 | //NSLog(@"Running histogram job..."); 371 | // find min max 372 | float min = FLT_MAX; 373 | float max = -FLT_MAX; 374 | int size = width*height; 375 | bool hdr = _renderingHDR; 376 | for (int i=0; i max) max = l; 390 | hdrbuffer[4*i+0] = l; // write back for later use 391 | } 392 | // Clean the histogram 393 | memset(_histogramValues, 0, HISTOGRAM_SIZE*sizeof(float)); 394 | // Build the histogram 395 | float hmin = 0.0f; // change this to min/max to have a closer-fitting histogram 396 | float hmax = 5.0f; 397 | //float hmax = max; 398 | float diff = hmax-hmin; 399 | float step = diff/HISTOGRAM_SIZE; 400 | float increment = 1.0f/float(size); 401 | for (int i=0; i= HISTOGRAM_SIZE) bin = HISTOGRAM_SIZE-1; 406 | _histogramValues[bin] += increment; 407 | } 408 | float binmax = 0.0f; 409 | for (int i=0; i binmax) binmax = v; 412 | } 413 | SAFE_DELETE_ARRAY(ldrbuffer); 414 | SAFE_DELETE_ARRAY(hdrbuffer); 415 | //NSLog(@"Histogram job done: min %f, max %f", min, max); 416 | dispatch_async(dispatch_get_main_queue(), ^{ 417 | _histogramMin.text = [NSString stringWithFormat:@"Darkest pixel: %5.3f", min]; 418 | _histogramMax.text = [NSString stringWithFormat:@"Brightest pixel: %5.3f", max]; 419 | _histogramBinMax.text = [NSString stringWithFormat:@"%i%% of pixels", int(100.0*binmax)]; 420 | _histogramUpperBound.text = [NSString stringWithFormat:@"%1.3f", hmax]; 421 | }); 422 | _histogramActive = false; 423 | }); 424 | } 425 | } 426 | // enable rendering to default FB, apply 427 | _fbo->Deactivate(); 428 | glPopGroupMarkerEXT(); 429 | myglPushGroupMarker("Tonemapping"); 430 | // Now draw HDR as full-screen quad 431 | //glClearColor(0.65f, 0.65f, 0.65f, 1.0f); 432 | glDisable(GL_DEPTH_TEST); 433 | //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 434 | _fbo_program->Use(); 435 | glBindTexture(GL_TEXTURE_2D, _fbo->tex_id()); 436 | _fbo_program->SetUniformi(_fbo_tex_bind, 0); 437 | _fbo_program->SetUniformf(_fbo_lineartonemap_scale, _fbo_scale, _fbo_scale, _fbo_scale, 1.0f); 438 | _fbo_program->SetUniformf(_fbo_lineartonemap_bias, _fbo_bias, _fbo_bias, _fbo_bias, 0.0f); 439 | _fbo_vbo->Draw(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0); 440 | glPopGroupMarkerEXT(); 441 | if (_histogramButton.on) { 442 | myglPushGroupMarker("Histogram Viz"); 443 | _histogramViz->Draw(_histogramValues, self.view.bounds.size.width, self.view.bounds.size.height, _fbo_scale, _fbo_bias); 444 | glPopGroupMarkerEXT(); 445 | } 446 | } 447 | 448 | - (IBAction) toggleHDR { 449 | [self setupHDR]; 450 | } 451 | 452 | - (IBAction) toggleHistogram { 453 | _histogramView.hidden = !_histogramButton.on; 454 | } 455 | 456 | - (IBAction) toggleFilterTextures { 457 | _hdrcubemap->Prepare([_filterTextures isOn]); 458 | } 459 | 460 | @end 461 | -------------------------------------------------------------------------------- /hdrdemo/hdrdemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 9F1272AB141B4B4B006341D1 /* histogramviz.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9F1272A9141B4B4B006341D1 /* histogramviz.cc */; }; 11 | 9F1272B1141B52B4006341D1 /* histogram.vsh in Resources */ = {isa = PBXBuildFile; fileRef = 9F1272AE141B4EB3006341D1 /* histogram.vsh */; }; 12 | 9F1272B2141B52B8006341D1 /* histogram.fsh in Resources */ = {isa = PBXBuildFile; fileRef = 9F1272AD141B4EB3006341D1 /* histogram.fsh */; }; 13 | 9F7513DE141B7EB4007D31E7 /* hdrcubemap.fsh in Resources */ = {isa = PBXBuildFile; fileRef = 9F7513DA141B7EA8007D31E7 /* hdrcubemap.fsh */; }; 14 | 9F7513DF141B7EB8007D31E7 /* hdrcubemap.vsh in Resources */ = {isa = PBXBuildFile; fileRef = 9F7513DB141B7EA8007D31E7 /* hdrcubemap.vsh */; }; 15 | 9F7513F5141B8008007D31E7 /* rnl_nx.pfm in Resources */ = {isa = PBXBuildFile; fileRef = 9F7513EE141B8008007D31E7 /* rnl_nx.pfm */; }; 16 | 9F7513F6141B8008007D31E7 /* rnl_ny.pfm in Resources */ = {isa = PBXBuildFile; fileRef = 9F7513EF141B8008007D31E7 /* rnl_ny.pfm */; }; 17 | 9F7513F7141B8008007D31E7 /* rnl_nz.pfm in Resources */ = {isa = PBXBuildFile; fileRef = 9F7513F0141B8008007D31E7 /* rnl_nz.pfm */; }; 18 | 9F7513F8141B8008007D31E7 /* rnl_px.pfm in Resources */ = {isa = PBXBuildFile; fileRef = 9F7513F1141B8008007D31E7 /* rnl_px.pfm */; }; 19 | 9F7513F9141B8008007D31E7 /* rnl_py.pfm in Resources */ = {isa = PBXBuildFile; fileRef = 9F7513F2141B8008007D31E7 /* rnl_py.pfm */; }; 20 | 9F7513FA141B8008007D31E7 /* rnl_pz.pfm in Resources */ = {isa = PBXBuildFile; fileRef = 9F7513F3141B8008007D31E7 /* rnl_pz.pfm */; }; 21 | 9F7513FD141B8455007D31E7 /* opengltools.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9F7513FB141B8455007D31E7 /* opengltools.mm */; }; 22 | 9F9E737113F6A14C00E6FFD1 /* framebufferobject.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9F9E736E13F6A14C00E6FFD1 /* framebufferobject.mm */; }; 23 | 9F9E737213F6A14C00E6FFD1 /* vertexbufferobject.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9F9E736F13F6A14C00E6FFD1 /* vertexbufferobject.cc */; }; 24 | 9F9E737613F6A15700E6FFD1 /* FBOShader.fsh in Resources */ = {isa = PBXBuildFile; fileRef = 9F9E737413F6A15700E6FFD1 /* FBOShader.fsh */; }; 25 | 9F9E737713F6A15700E6FFD1 /* FBOShader.vsh in Resources */ = {isa = PBXBuildFile; fileRef = 9F9E737513F6A15700E6FFD1 /* FBOShader.vsh */; }; 26 | 9FB1E4C213F7FE31006C7D1E /* hdrcubemap.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9FB1E4C013F7FE31006C7D1E /* hdrcubemap.mm */; }; 27 | 9FFA960E14515BFF008975BF /* lineartonemap.fsh in Resources */ = {isa = PBXBuildFile; fileRef = 9FFA960B14515BCF008975BF /* lineartonemap.fsh */; }; 28 | 9FFE080613EFE4E4002A5AFB /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FFE080513EFE4E4002A5AFB /* UIKit.framework */; }; 29 | 9FFE080813EFE4E4002A5AFB /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FFE080713EFE4E4002A5AFB /* Foundation.framework */; }; 30 | 9FFE080A13EFE4E4002A5AFB /* GLKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FFE080913EFE4E4002A5AFB /* GLKit.framework */; }; 31 | 9FFE080C13EFE4E4002A5AFB /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FFE080B13EFE4E4002A5AFB /* OpenGLES.framework */; }; 32 | 9FFE081213EFE4E4002A5AFB /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 9FFE081013EFE4E4002A5AFB /* InfoPlist.strings */; }; 33 | 9FFE081413EFE4E4002A5AFB /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 9FFE081313EFE4E4002A5AFB /* main.m */; }; 34 | 9FFE081813EFE4E4002A5AFB /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9FFE081713EFE4E4002A5AFB /* AppDelegate.mm */; }; 35 | 9FFE081A13EFE4E4002A5AFB /* Shader.fsh in Resources */ = {isa = PBXBuildFile; fileRef = 9FFE081913EFE4E4002A5AFB /* Shader.fsh */; }; 36 | 9FFE081C13EFE4E4002A5AFB /* Shader.vsh in Resources */ = {isa = PBXBuildFile; fileRef = 9FFE081B13EFE4E4002A5AFB /* Shader.vsh */; }; 37 | 9FFE081F13EFE4E4002A5AFB /* ViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9FFE081E13EFE4E4002A5AFB /* ViewController.mm */; }; 38 | 9FFE082213EFE4E4002A5AFB /* ViewController_iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9FFE082013EFE4E4002A5AFB /* ViewController_iPhone.xib */; }; 39 | 9FFE082513EFE4E4002A5AFB /* ViewController_iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9FFE082313EFE4E4002A5AFB /* ViewController_iPad.xib */; }; 40 | 9FFE083113EFE67E002A5AFB /* glprogram.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9FFE082D13EFE67E002A5AFB /* glprogram.mm */; }; 41 | 9FFE083213EFE67E002A5AFB /* glshader.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9FFE082F13EFE67E002A5AFB /* glshader.cc */; }; 42 | /* End PBXBuildFile section */ 43 | 44 | /* Begin PBXFileReference section */ 45 | 9F1272A9141B4B4B006341D1 /* histogramviz.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = histogramviz.cc; sourceTree = ""; }; 46 | 9F1272AA141B4B4B006341D1 /* histogramviz.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = histogramviz.h; sourceTree = ""; }; 47 | 9F1272AD141B4EB3006341D1 /* histogram.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = histogram.fsh; sourceTree = ""; }; 48 | 9F1272AE141B4EB3006341D1 /* histogram.vsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = histogram.vsh; sourceTree = ""; }; 49 | 9F7513DA141B7EA8007D31E7 /* hdrcubemap.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = hdrcubemap.fsh; sourceTree = ""; }; 50 | 9F7513DB141B7EA8007D31E7 /* hdrcubemap.vsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = hdrcubemap.vsh; sourceTree = ""; }; 51 | 9F7513EE141B8008007D31E7 /* rnl_nx.pfm */ = {isa = PBXFileReference; lastKnownFileType = file; path = rnl_nx.pfm; sourceTree = ""; }; 52 | 9F7513EF141B8008007D31E7 /* rnl_ny.pfm */ = {isa = PBXFileReference; lastKnownFileType = file; path = rnl_ny.pfm; sourceTree = ""; }; 53 | 9F7513F0141B8008007D31E7 /* rnl_nz.pfm */ = {isa = PBXFileReference; lastKnownFileType = file; path = rnl_nz.pfm; sourceTree = ""; }; 54 | 9F7513F1141B8008007D31E7 /* rnl_px.pfm */ = {isa = PBXFileReference; lastKnownFileType = file; path = rnl_px.pfm; sourceTree = ""; }; 55 | 9F7513F2141B8008007D31E7 /* rnl_py.pfm */ = {isa = PBXFileReference; lastKnownFileType = file; path = rnl_py.pfm; sourceTree = ""; }; 56 | 9F7513F3141B8008007D31E7 /* rnl_pz.pfm */ = {isa = PBXFileReference; lastKnownFileType = file; path = rnl_pz.pfm; sourceTree = ""; }; 57 | 9F7513FB141B8455007D31E7 /* opengltools.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = opengltools.mm; sourceTree = ""; }; 58 | 9F7513FC141B8455007D31E7 /* opengltools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = opengltools.h; sourceTree = ""; }; 59 | 9F9E736D13F6A14C00E6FFD1 /* framebufferobject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = framebufferobject.h; sourceTree = ""; }; 60 | 9F9E736E13F6A14C00E6FFD1 /* framebufferobject.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = framebufferobject.mm; sourceTree = ""; }; 61 | 9F9E736F13F6A14C00E6FFD1 /* vertexbufferobject.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = vertexbufferobject.cc; sourceTree = ""; }; 62 | 9F9E737013F6A14C00E6FFD1 /* vertexbufferobject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vertexbufferobject.h; sourceTree = ""; }; 63 | 9F9E737413F6A15700E6FFD1 /* FBOShader.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; name = FBOShader.fsh; path = Shaders/FBOShader.fsh; sourceTree = ""; }; 64 | 9F9E737513F6A15700E6FFD1 /* FBOShader.vsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; name = FBOShader.vsh; path = Shaders/FBOShader.vsh; sourceTree = ""; }; 65 | 9FB1E4C013F7FE31006C7D1E /* hdrcubemap.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = hdrcubemap.mm; sourceTree = ""; }; 66 | 9FB1E4C113F7FE31006C7D1E /* hdrcubemap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hdrcubemap.h; sourceTree = ""; }; 67 | 9FFA960B14515BCF008975BF /* lineartonemap.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; name = lineartonemap.fsh; path = Shaders/lineartonemap.fsh; sourceTree = ""; }; 68 | 9FFE080113EFE4E4002A5AFB /* hdrdemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = hdrdemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 69 | 9FFE080513EFE4E4002A5AFB /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 70 | 9FFE080713EFE4E4002A5AFB /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 71 | 9FFE080913EFE4E4002A5AFB /* GLKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GLKit.framework; path = System/Library/Frameworks/GLKit.framework; sourceTree = SDKROOT; }; 72 | 9FFE080B13EFE4E4002A5AFB /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; 73 | 9FFE080F13EFE4E4002A5AFB /* hdrdemo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "hdrdemo-Info.plist"; sourceTree = ""; }; 74 | 9FFE081113EFE4E4002A5AFB /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 75 | 9FFE081313EFE4E4002A5AFB /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 76 | 9FFE081513EFE4E4002A5AFB /* hdrdemo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "hdrdemo-Prefix.pch"; sourceTree = ""; }; 77 | 9FFE081613EFE4E4002A5AFB /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 78 | 9FFE081713EFE4E4002A5AFB /* AppDelegate.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = AppDelegate.mm; sourceTree = ""; }; 79 | 9FFE081913EFE4E4002A5AFB /* Shader.fsh */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.glsl; name = Shader.fsh; path = Shaders/Shader.fsh; sourceTree = ""; }; 80 | 9FFE081B13EFE4E4002A5AFB /* Shader.vsh */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.glsl; name = Shader.vsh; path = Shaders/Shader.vsh; sourceTree = ""; }; 81 | 9FFE081D13EFE4E4002A5AFB /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 82 | 9FFE081E13EFE4E4002A5AFB /* ViewController.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ViewController.mm; sourceTree = ""; }; 83 | 9FFE082113EFE4E4002A5AFB /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/ViewController_iPhone.xib; sourceTree = ""; }; 84 | 9FFE082413EFE4E4002A5AFB /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/ViewController_iPad.xib; sourceTree = ""; }; 85 | 9FFE082C13EFE67E002A5AFB /* codingguides.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = codingguides.h; sourceTree = ""; }; 86 | 9FFE082D13EFE67E002A5AFB /* glprogram.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = glprogram.mm; sourceTree = ""; }; 87 | 9FFE082E13EFE67E002A5AFB /* glprogram.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glprogram.h; sourceTree = ""; }; 88 | 9FFE082F13EFE67E002A5AFB /* glshader.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = glshader.cc; sourceTree = ""; }; 89 | 9FFE083013EFE67E002A5AFB /* glshader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glshader.h; sourceTree = ""; }; 90 | /* End PBXFileReference section */ 91 | 92 | /* Begin PBXFrameworksBuildPhase section */ 93 | 9FFE07FE13EFE4E4002A5AFB /* Frameworks */ = { 94 | isa = PBXFrameworksBuildPhase; 95 | buildActionMask = 2147483647; 96 | files = ( 97 | 9FFE080613EFE4E4002A5AFB /* UIKit.framework in Frameworks */, 98 | 9FFE080813EFE4E4002A5AFB /* Foundation.framework in Frameworks */, 99 | 9FFE080A13EFE4E4002A5AFB /* GLKit.framework in Frameworks */, 100 | 9FFE080C13EFE4E4002A5AFB /* OpenGLES.framework in Frameworks */, 101 | ); 102 | runOnlyForDeploymentPostprocessing = 0; 103 | }; 104 | /* End PBXFrameworksBuildPhase section */ 105 | 106 | /* Begin PBXGroup section */ 107 | 9F7513EC141B8008007D31E7 /* data */ = { 108 | isa = PBXGroup; 109 | children = ( 110 | 9F7513EE141B8008007D31E7 /* rnl_nx.pfm */, 111 | 9F7513EF141B8008007D31E7 /* rnl_ny.pfm */, 112 | 9F7513F0141B8008007D31E7 /* rnl_nz.pfm */, 113 | 9F7513F1141B8008007D31E7 /* rnl_px.pfm */, 114 | 9F7513F2141B8008007D31E7 /* rnl_py.pfm */, 115 | 9F7513F3141B8008007D31E7 /* rnl_pz.pfm */, 116 | ); 117 | name = data; 118 | path = ../data; 119 | sourceTree = ""; 120 | }; 121 | 9FB1E4BF13F7FE31006C7D1E /* scenes */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | 9F7513DA141B7EA8007D31E7 /* hdrcubemap.fsh */, 125 | 9F7513DB141B7EA8007D31E7 /* hdrcubemap.vsh */, 126 | 9F1272AD141B4EB3006341D1 /* histogram.fsh */, 127 | 9F1272AE141B4EB3006341D1 /* histogram.vsh */, 128 | 9F1272A9141B4B4B006341D1 /* histogramviz.cc */, 129 | 9F1272AA141B4B4B006341D1 /* histogramviz.h */, 130 | 9FB1E4C013F7FE31006C7D1E /* hdrcubemap.mm */, 131 | 9FB1E4C113F7FE31006C7D1E /* hdrcubemap.h */, 132 | ); 133 | name = scenes; 134 | path = ../scenes; 135 | sourceTree = ""; 136 | }; 137 | 9FFE07F613EFE4E4002A5AFB = { 138 | isa = PBXGroup; 139 | children = ( 140 | 9F7513EC141B8008007D31E7 /* data */, 141 | 9FB1E4BF13F7FE31006C7D1E /* scenes */, 142 | 9FFE082B13EFE67E002A5AFB /* shared */, 143 | 9FFE080D13EFE4E4002A5AFB /* hdrdemo */, 144 | 9FFE080413EFE4E4002A5AFB /* Frameworks */, 145 | 9FFE080213EFE4E4002A5AFB /* Products */, 146 | ); 147 | sourceTree = ""; 148 | }; 149 | 9FFE080213EFE4E4002A5AFB /* Products */ = { 150 | isa = PBXGroup; 151 | children = ( 152 | 9FFE080113EFE4E4002A5AFB /* hdrdemo.app */, 153 | ); 154 | name = Products; 155 | sourceTree = ""; 156 | }; 157 | 9FFE080413EFE4E4002A5AFB /* Frameworks */ = { 158 | isa = PBXGroup; 159 | children = ( 160 | 9FFE080513EFE4E4002A5AFB /* UIKit.framework */, 161 | 9FFE080713EFE4E4002A5AFB /* Foundation.framework */, 162 | 9FFE080913EFE4E4002A5AFB /* GLKit.framework */, 163 | 9FFE080B13EFE4E4002A5AFB /* OpenGLES.framework */, 164 | ); 165 | name = Frameworks; 166 | sourceTree = ""; 167 | }; 168 | 9FFE080D13EFE4E4002A5AFB /* hdrdemo */ = { 169 | isa = PBXGroup; 170 | children = ( 171 | 9F9E737413F6A15700E6FFD1 /* FBOShader.fsh */, 172 | 9F9E737513F6A15700E6FFD1 /* FBOShader.vsh */, 173 | 9FFE081613EFE4E4002A5AFB /* AppDelegate.h */, 174 | 9FFE081713EFE4E4002A5AFB /* AppDelegate.mm */, 175 | 9FFE081913EFE4E4002A5AFB /* Shader.fsh */, 176 | 9FFE081B13EFE4E4002A5AFB /* Shader.vsh */, 177 | 9FFE081D13EFE4E4002A5AFB /* ViewController.h */, 178 | 9FFE081E13EFE4E4002A5AFB /* ViewController.mm */, 179 | 9FFE082013EFE4E4002A5AFB /* ViewController_iPhone.xib */, 180 | 9FFE082313EFE4E4002A5AFB /* ViewController_iPad.xib */, 181 | 9FFE080E13EFE4E4002A5AFB /* Supporting Files */, 182 | ); 183 | path = hdrdemo; 184 | sourceTree = ""; 185 | }; 186 | 9FFE080E13EFE4E4002A5AFB /* Supporting Files */ = { 187 | isa = PBXGroup; 188 | children = ( 189 | 9FFA960B14515BCF008975BF /* lineartonemap.fsh */, 190 | 9FFE080F13EFE4E4002A5AFB /* hdrdemo-Info.plist */, 191 | 9FFE081013EFE4E4002A5AFB /* InfoPlist.strings */, 192 | 9FFE081313EFE4E4002A5AFB /* main.m */, 193 | 9FFE081513EFE4E4002A5AFB /* hdrdemo-Prefix.pch */, 194 | ); 195 | name = "Supporting Files"; 196 | sourceTree = ""; 197 | }; 198 | 9FFE082B13EFE67E002A5AFB /* shared */ = { 199 | isa = PBXGroup; 200 | children = ( 201 | 9F7513FB141B8455007D31E7 /* opengltools.mm */, 202 | 9F7513FC141B8455007D31E7 /* opengltools.h */, 203 | 9F9E736D13F6A14C00E6FFD1 /* framebufferobject.h */, 204 | 9F9E736E13F6A14C00E6FFD1 /* framebufferobject.mm */, 205 | 9F9E736F13F6A14C00E6FFD1 /* vertexbufferobject.cc */, 206 | 9F9E737013F6A14C00E6FFD1 /* vertexbufferobject.h */, 207 | 9FFE082C13EFE67E002A5AFB /* codingguides.h */, 208 | 9FFE082D13EFE67E002A5AFB /* glprogram.mm */, 209 | 9FFE082E13EFE67E002A5AFB /* glprogram.h */, 210 | 9FFE082F13EFE67E002A5AFB /* glshader.cc */, 211 | 9FFE083013EFE67E002A5AFB /* glshader.h */, 212 | ); 213 | name = shared; 214 | path = ../shared; 215 | sourceTree = ""; 216 | }; 217 | /* End PBXGroup section */ 218 | 219 | /* Begin PBXNativeTarget section */ 220 | 9FFE080013EFE4E4002A5AFB /* hdrdemo */ = { 221 | isa = PBXNativeTarget; 222 | buildConfigurationList = 9FFE082813EFE4E4002A5AFB /* Build configuration list for PBXNativeTarget "hdrdemo" */; 223 | buildPhases = ( 224 | 9FFE07FD13EFE4E4002A5AFB /* Sources */, 225 | 9FFE07FE13EFE4E4002A5AFB /* Frameworks */, 226 | 9FFE07FF13EFE4E4002A5AFB /* Resources */, 227 | ); 228 | buildRules = ( 229 | ); 230 | dependencies = ( 231 | ); 232 | name = hdrdemo; 233 | productName = hdrdemo; 234 | productReference = 9FFE080113EFE4E4002A5AFB /* hdrdemo.app */; 235 | productType = "com.apple.product-type.application"; 236 | }; 237 | /* End PBXNativeTarget section */ 238 | 239 | /* Begin PBXProject section */ 240 | 9FFE07F813EFE4E4002A5AFB /* Project object */ = { 241 | isa = PBXProject; 242 | attributes = { 243 | LastUpgradeCheck = 0420; 244 | }; 245 | buildConfigurationList = 9FFE07FB13EFE4E4002A5AFB /* Build configuration list for PBXProject "hdrdemo" */; 246 | compatibilityVersion = "Xcode 3.2"; 247 | developmentRegion = English; 248 | hasScannedForEncodings = 0; 249 | knownRegions = ( 250 | en, 251 | ); 252 | mainGroup = 9FFE07F613EFE4E4002A5AFB; 253 | productRefGroup = 9FFE080213EFE4E4002A5AFB /* Products */; 254 | projectDirPath = ""; 255 | projectRoot = ""; 256 | targets = ( 257 | 9FFE080013EFE4E4002A5AFB /* hdrdemo */, 258 | ); 259 | }; 260 | /* End PBXProject section */ 261 | 262 | /* Begin PBXResourcesBuildPhase section */ 263 | 9FFE07FF13EFE4E4002A5AFB /* Resources */ = { 264 | isa = PBXResourcesBuildPhase; 265 | buildActionMask = 2147483647; 266 | files = ( 267 | 9FFE081213EFE4E4002A5AFB /* InfoPlist.strings in Resources */, 268 | 9FFE081A13EFE4E4002A5AFB /* Shader.fsh in Resources */, 269 | 9FFE081C13EFE4E4002A5AFB /* Shader.vsh in Resources */, 270 | 9FFE082213EFE4E4002A5AFB /* ViewController_iPhone.xib in Resources */, 271 | 9FFE082513EFE4E4002A5AFB /* ViewController_iPad.xib in Resources */, 272 | 9F9E737613F6A15700E6FFD1 /* FBOShader.fsh in Resources */, 273 | 9F9E737713F6A15700E6FFD1 /* FBOShader.vsh in Resources */, 274 | 9F1272B1141B52B4006341D1 /* histogram.vsh in Resources */, 275 | 9F1272B2141B52B8006341D1 /* histogram.fsh in Resources */, 276 | 9F7513DE141B7EB4007D31E7 /* hdrcubemap.fsh in Resources */, 277 | 9F7513DF141B7EB8007D31E7 /* hdrcubemap.vsh in Resources */, 278 | 9FFA960E14515BFF008975BF /* lineartonemap.fsh in Resources */, 279 | 9F7513F5141B8008007D31E7 /* rnl_nx.pfm in Resources */, 280 | 9F7513F6141B8008007D31E7 /* rnl_ny.pfm in Resources */, 281 | 9F7513F7141B8008007D31E7 /* rnl_nz.pfm in Resources */, 282 | 9F7513F8141B8008007D31E7 /* rnl_px.pfm in Resources */, 283 | 9F7513F9141B8008007D31E7 /* rnl_py.pfm in Resources */, 284 | 9F7513FA141B8008007D31E7 /* rnl_pz.pfm in Resources */, 285 | ); 286 | runOnlyForDeploymentPostprocessing = 0; 287 | }; 288 | /* End PBXResourcesBuildPhase section */ 289 | 290 | /* Begin PBXSourcesBuildPhase section */ 291 | 9FFE07FD13EFE4E4002A5AFB /* Sources */ = { 292 | isa = PBXSourcesBuildPhase; 293 | buildActionMask = 2147483647; 294 | files = ( 295 | 9FFE081413EFE4E4002A5AFB /* main.m in Sources */, 296 | 9FFE081813EFE4E4002A5AFB /* AppDelegate.mm in Sources */, 297 | 9FFE081F13EFE4E4002A5AFB /* ViewController.mm in Sources */, 298 | 9FFE083113EFE67E002A5AFB /* glprogram.mm in Sources */, 299 | 9FFE083213EFE67E002A5AFB /* glshader.cc in Sources */, 300 | 9F9E737113F6A14C00E6FFD1 /* framebufferobject.mm in Sources */, 301 | 9F9E737213F6A14C00E6FFD1 /* vertexbufferobject.cc in Sources */, 302 | 9FB1E4C213F7FE31006C7D1E /* hdrcubemap.mm in Sources */, 303 | 9F1272AB141B4B4B006341D1 /* histogramviz.cc in Sources */, 304 | 9F7513FD141B8455007D31E7 /* opengltools.mm in Sources */, 305 | ); 306 | runOnlyForDeploymentPostprocessing = 0; 307 | }; 308 | /* End PBXSourcesBuildPhase section */ 309 | 310 | /* Begin PBXVariantGroup section */ 311 | 9FFE081013EFE4E4002A5AFB /* InfoPlist.strings */ = { 312 | isa = PBXVariantGroup; 313 | children = ( 314 | 9FFE081113EFE4E4002A5AFB /* en */, 315 | ); 316 | name = InfoPlist.strings; 317 | sourceTree = ""; 318 | }; 319 | 9FFE082013EFE4E4002A5AFB /* ViewController_iPhone.xib */ = { 320 | isa = PBXVariantGroup; 321 | children = ( 322 | 9FFE082113EFE4E4002A5AFB /* en */, 323 | ); 324 | name = ViewController_iPhone.xib; 325 | sourceTree = ""; 326 | }; 327 | 9FFE082313EFE4E4002A5AFB /* ViewController_iPad.xib */ = { 328 | isa = PBXVariantGroup; 329 | children = ( 330 | 9FFE082413EFE4E4002A5AFB /* en */, 331 | ); 332 | name = ViewController_iPad.xib; 333 | sourceTree = ""; 334 | }; 335 | /* End PBXVariantGroup section */ 336 | 337 | /* Begin XCBuildConfiguration section */ 338 | 9FFE082613EFE4E4002A5AFB /* Debug */ = { 339 | isa = XCBuildConfiguration; 340 | buildSettings = { 341 | ALWAYS_SEARCH_USER_PATHS = NO; 342 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 343 | CLANG_ENABLE_OBJC_ARC = YES; 344 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 345 | COPY_PHASE_STRIP = NO; 346 | GCC_C_LANGUAGE_STANDARD = gnu99; 347 | GCC_DYNAMIC_NO_PIC = NO; 348 | GCC_OPTIMIZATION_LEVEL = 0; 349 | GCC_PREPROCESSOR_DEFINITIONS = ( 350 | "DEBUG=1", 351 | "$(inherited)", 352 | ); 353 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 354 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 355 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; 356 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 357 | GCC_WARN_UNUSED_VARIABLE = YES; 358 | IPHONEOS_DEPLOYMENT_TARGET = 5.0; 359 | SDKROOT = iphoneos; 360 | TARGETED_DEVICE_FAMILY = "1,2"; 361 | }; 362 | name = Debug; 363 | }; 364 | 9FFE082713EFE4E4002A5AFB /* Release */ = { 365 | isa = XCBuildConfiguration; 366 | buildSettings = { 367 | ALWAYS_SEARCH_USER_PATHS = NO; 368 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 369 | CLANG_ENABLE_OBJC_ARC = YES; 370 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 371 | COPY_PHASE_STRIP = YES; 372 | GCC_C_LANGUAGE_STANDARD = gnu99; 373 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 374 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; 375 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 376 | GCC_WARN_UNUSED_VARIABLE = YES; 377 | IPHONEOS_DEPLOYMENT_TARGET = 5.0; 378 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 379 | SDKROOT = iphoneos; 380 | TARGETED_DEVICE_FAMILY = "1,2"; 381 | VALIDATE_PRODUCT = YES; 382 | }; 383 | name = Release; 384 | }; 385 | 9FFE082913EFE4E4002A5AFB /* Debug */ = { 386 | isa = XCBuildConfiguration; 387 | buildSettings = { 388 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 389 | GCC_PREFIX_HEADER = "hdrdemo/hdrdemo-Prefix.pch"; 390 | "GCC_THUMB_SUPPORT[arch=armv6]" = ""; 391 | HEADER_SEARCH_PATHS = ../; 392 | INFOPLIST_FILE = "hdrdemo/hdrdemo-Info.plist"; 393 | PRODUCT_NAME = "$(TARGET_NAME)"; 394 | TARGETED_DEVICE_FAMILY = 2; 395 | WRAPPER_EXTENSION = app; 396 | }; 397 | name = Debug; 398 | }; 399 | 9FFE082A13EFE4E4002A5AFB /* Release */ = { 400 | isa = XCBuildConfiguration; 401 | buildSettings = { 402 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 403 | GCC_PREFIX_HEADER = "hdrdemo/hdrdemo-Prefix.pch"; 404 | "GCC_THUMB_SUPPORT[arch=armv6]" = ""; 405 | HEADER_SEARCH_PATHS = ../; 406 | INFOPLIST_FILE = "hdrdemo/hdrdemo-Info.plist"; 407 | PRODUCT_NAME = "$(TARGET_NAME)"; 408 | TARGETED_DEVICE_FAMILY = 2; 409 | WRAPPER_EXTENSION = app; 410 | }; 411 | name = Release; 412 | }; 413 | /* End XCBuildConfiguration section */ 414 | 415 | /* Begin XCConfigurationList section */ 416 | 9FFE07FB13EFE4E4002A5AFB /* Build configuration list for PBXProject "hdrdemo" */ = { 417 | isa = XCConfigurationList; 418 | buildConfigurations = ( 419 | 9FFE082613EFE4E4002A5AFB /* Debug */, 420 | 9FFE082713EFE4E4002A5AFB /* Release */, 421 | ); 422 | defaultConfigurationIsVisible = 0; 423 | defaultConfigurationName = Release; 424 | }; 425 | 9FFE082813EFE4E4002A5AFB /* Build configuration list for PBXNativeTarget "hdrdemo" */ = { 426 | isa = XCConfigurationList; 427 | buildConfigurations = ( 428 | 9FFE082913EFE4E4002A5AFB /* Debug */, 429 | 9FFE082A13EFE4E4002A5AFB /* Release */, 430 | ); 431 | defaultConfigurationIsVisible = 0; 432 | defaultConfigurationName = Release; 433 | }; 434 | /* End XCConfigurationList section */ 435 | }; 436 | rootObject = 9FFE07F813EFE4E4002A5AFB /* Project object */; 437 | } 438 | -------------------------------------------------------------------------------- /hdrdemo/hdrdemo/en.lproj/ViewController_iPad.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1280 5 | 11C74 6 | 1938 7 | 1138.23 8 | 567.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 933 12 | 13 | 14 | YES 15 | IBUISlider 16 | IBUISwitch 17 | IBUIView 18 | IBUILabel 19 | IBProxyObject 20 | 21 | 22 | YES 23 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 24 | 25 | 26 | PluginDependencyRecalculationVersion 27 | 28 | 29 | 30 | YES 31 | 32 | IBFilesOwner 33 | IBIPadFramework 34 | 35 | 36 | IBFirstResponder 37 | IBIPadFramework 38 | 39 | 40 | 41 | 274 42 | 43 | YES 44 | 45 | 46 | 292 47 | {{70, 20}, {94, 27}} 48 | 49 | 50 | 51 | _NS:472 52 | NO 53 | IBIPadFramework 54 | 0 55 | 0 56 | YES 57 | 58 | 59 | 60 | 292 61 | {{15, 20}, {42, 21}} 62 | 63 | 64 | 65 | _NS:121 66 | NO 67 | YES 68 | 7 69 | NO 70 | IBIPadFramework 71 | HDR 72 | 73 | 1 74 | MSAxIDEAA 75 | 76 | 77 | 78 | 1 79 | MCAwIDAAA 80 | 81 | {1, 1} 82 | 1 83 | 10 84 | 85 | 1 86 | 14 87 | 88 | 89 | Helvetica 90 | 14 91 | 16 92 | 93 | 94 | 95 | 96 | 292 97 | {{70, 52}, {94, 27}} 98 | 99 | 100 | 101 | _NS:472 102 | NO 103 | IBIPadFramework 104 | 0 105 | 0 106 | YES 107 | 108 | 109 | 110 | 292 111 | {{15, 55}, {66, 21}} 112 | 113 | 114 | 115 | _NS:121 116 | NO 117 | YES 118 | 7 119 | NO 120 | IBIPadFramework 121 | Histogram 122 | 123 | 124 | 125 | {1, 1} 126 | 1 127 | 10 128 | 129 | 130 | 131 | 132 | 133 | 292 134 | {{70, 87}, {94, 27}} 135 | 136 | 137 | 138 | _NS:472 139 | NO 140 | IBIPadFramework 141 | 0 142 | 0 143 | YES 144 | 145 | 146 | 147 | 292 148 | {{15, 90}, {66, 21}} 149 | 150 | 151 | 152 | _NS:121 153 | NO 154 | YES 155 | 7 156 | NO 157 | IBIPadFramework 158 | Filter Tex 159 | 160 | 161 | 162 | {1, 1} 163 | 1 164 | 10 165 | 166 | 167 | 168 | 169 | 170 | 292 171 | {{15, 125}, {88, 21}} 172 | 173 | 174 | 175 | _NS:121 176 | NO 177 | YES 178 | 7 179 | NO 180 | IBIPadFramework 181 | Tonemapping 182 | 183 | 184 | 185 | {1, 1} 186 | 1 187 | 10 188 | 189 | 190 | 191 | 192 | 193 | 292 194 | {{15, 154}, {88, 21}} 195 | 196 | 197 | 198 | _NS:121 199 | NO 200 | YES 201 | 7 202 | NO 203 | IBIPadFramework 204 | Scale 205 | 206 | 207 | 208 | {1, 1} 209 | 1 210 | 10 211 | 212 | 213 | 214 | 215 | 216 | 268 217 | 218 | YES 219 | 220 | 221 | 292 222 | {{420, 57}, {177, 21}} 223 | 224 | 225 | 226 | _NS:345 227 | NO 228 | YES 229 | 7 230 | NO 231 | IBIPadFramework 232 | Min 233 | 234 | 1 235 | MSAxIDEAA 236 | 237 | 1 238 | 239 | 240 | 241 | 242 | 1 243 | 10 244 | 245 | 1 246 | 17 247 | 248 | 249 | Helvetica 250 | 17 251 | 16 252 | 253 | 254 | 255 | 256 | 292 257 | {{260, 40}, {177, 22}} 258 | 259 | 260 | 261 | _NS:345 262 | NO 263 | YES 264 | 7 265 | NO 266 | IBIPadFramework 267 | 100% of pixels 268 | 269 | 1 270 | MSAxIDEAA 271 | 272 | 273 | 274 | 275 | 1 276 | 10 277 | 278 | 279 | 280 | 281 | 282 | 292 283 | {{260, 125}, {177, 22}} 284 | 285 | 286 | 287 | _NS:345 288 | NO 289 | YES 290 | 7 291 | NO 292 | IBIPadFramework 293 | 0% of pixels 294 | 295 | 1 296 | MSAxIDEAA 297 | 298 | 299 | 300 | 301 | 1 302 | 10 303 | 304 | 305 | 306 | 307 | 308 | 292 309 | {{0, 24}, {177, 22}} 310 | 311 | 312 | 313 | _NS:345 314 | NO 315 | YES 316 | 7 317 | NO 318 | IBIPadFramework 319 | 0.0 320 | 321 | 1 322 | MSAxIDEAA 323 | 324 | 325 | 326 | 327 | 1 328 | 10 329 | 330 | 331 | 332 | 333 | 334 | 292 335 | {{241, 25}, {177, 22}} 336 | 337 | 338 | 339 | _NS:345 340 | NO 341 | YES 342 | 7 343 | NO 344 | IBIPadFramework 345 | 5.0 346 | 347 | 1 348 | MSAxIDEAA 349 | 350 | 351 | 352 | 353 | 1 354 | 10 355 | 356 | 357 | 358 | 359 | 360 | 292 361 | {{420, 80}, {177, 21}} 362 | 363 | 364 | 365 | _NS:345 366 | NO 367 | YES 368 | 7 369 | NO 370 | IBIPadFramework 371 | Max 372 | 373 | 1 374 | MSAxIDEAA 375 | 376 | 377 | 378 | 379 | 1 380 | 10 381 | 382 | 383 | 384 | 385 | {{0, 858}, {768, 146}} 386 | 387 | 388 | 389 | _NS:212 390 | 391 | 1 392 | MCAwIDAgMAA 393 | 394 | IBIPadFramework 395 | 396 | 397 | 398 | 292 399 | {{109, 154}, {237, 23}} 400 | 401 | 402 | 403 | _NS:624 404 | NO 405 | IBIPadFramework 406 | 0 407 | 0 408 | 1 409 | 3 410 | 411 | 412 | 413 | 292 414 | {{15, 184}, {88, 21}} 415 | 416 | 417 | 418 | _NS:121 419 | NO 420 | YES 421 | 7 422 | NO 423 | IBIPadFramework 424 | Bias 425 | 426 | 427 | 428 | {1, 1} 429 | 1 430 | 10 431 | 432 | 433 | 434 | 435 | 436 | 292 437 | {{109, 185}, {237, 23}} 438 | 439 | 440 | 441 | _NS:624 442 | NO 443 | IBIPadFramework 444 | 0 445 | 0 446 | -5 447 | 0.0 448 | 449 | 450 | {{0, 20}, {768, 1004}} 451 | 452 | 453 | 454 | 455 | 456 | 2 457 | 458 | IBIPadFramework 459 | 460 | 461 | 462 | 463 | YES 464 | 465 | 466 | view 467 | 468 | 469 | 470 | 3 471 | 472 | 473 | 474 | _hdrButton 475 | 476 | 477 | 478 | 20 479 | 480 | 481 | 482 | _histogramButton 483 | 484 | 485 | 486 | 21 487 | 488 | 489 | 490 | _histogramMax 491 | 492 | 493 | 494 | 22 495 | 496 | 497 | 498 | _histogramMin 499 | 500 | 501 | 502 | 23 503 | 504 | 505 | 506 | _histogramView 507 | 508 | 509 | 510 | 24 511 | 512 | 513 | 514 | _histogramBinMax 515 | 516 | 517 | 518 | 29 519 | 520 | 521 | 522 | _histogramUpperBound 523 | 524 | 525 | 526 | 30 527 | 528 | 529 | 530 | _filterTextures 531 | 532 | 533 | 534 | 36 535 | 536 | 537 | 538 | _scaleSlider 539 | 540 | 541 | 542 | 43 543 | 544 | 545 | 546 | _biasSlider 547 | 548 | 549 | 550 | 44 551 | 552 | 553 | 554 | toggleHDR 555 | 556 | 557 | 13 558 | 559 | 7 560 | 561 | 562 | 563 | toggleHistogram 564 | 565 | 566 | 13 567 | 568 | 35 569 | 570 | 571 | 572 | toggleFilterTextures 573 | 574 | 575 | 7 576 | 577 | 37 578 | 579 | 580 | 581 | 582 | YES 583 | 584 | 0 585 | 586 | YES 587 | 588 | 589 | 590 | 591 | 592 | 1 593 | 594 | 595 | YES 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | -1 613 | 614 | 615 | File's Owner 616 | 617 | 618 | -2 619 | 620 | 621 | 622 | 623 | 4 624 | 625 | 626 | 627 | 628 | 5 629 | 630 | 631 | 632 | 633 | 8 634 | 635 | 636 | 637 | 638 | 9 639 | 640 | 641 | 642 | 643 | 12 644 | 645 | 646 | YES 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | Histogram View 656 | 657 | 658 | 13 659 | 660 | 661 | 662 | 663 | 14 664 | 665 | 666 | 667 | 668 | 25 669 | 670 | 671 | 672 | 673 | 26 674 | 675 | 676 | 677 | 678 | 27 679 | 680 | 681 | 682 | 683 | 28 684 | 685 | 686 | 687 | 688 | 31 689 | 690 | 691 | 692 | 693 | 32 694 | 695 | 696 | 697 | 698 | 38 699 | 700 | 701 | 702 | 703 | 39 704 | 705 | 706 | 707 | 708 | 40 709 | 710 | 711 | 712 | 713 | 41 714 | 715 | 716 | 717 | 718 | 42 719 | 720 | 721 | 722 | 723 | 724 | 725 | YES 726 | 727 | YES 728 | -1.CustomClassName 729 | -1.IBPluginDependency 730 | -2.CustomClassName 731 | -2.IBPluginDependency 732 | 1.CustomClassName 733 | 1.IBPluginDependency 734 | 12.IBPluginDependency 735 | 13.IBPluginDependency 736 | 14.IBPluginDependency 737 | 25.IBPluginDependency 738 | 26.IBPluginDependency 739 | 27.IBPluginDependency 740 | 28.IBPluginDependency 741 | 31.IBPluginDependency 742 | 32.IBPluginDependency 743 | 38.IBPluginDependency 744 | 39.IBPluginDependency 745 | 4.IBPluginDependency 746 | 40.IBPluginDependency 747 | 41.IBPluginDependency 748 | 42.IBPluginDependency 749 | 5.IBPluginDependency 750 | 8.IBPluginDependency 751 | 9.IBPluginDependency 752 | 753 | 754 | YES 755 | ViewController 756 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 757 | UIResponder 758 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 759 | GLKView 760 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 761 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 762 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 763 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 764 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 765 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 766 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 767 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 768 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 769 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 770 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 771 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 772 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 773 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 774 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 775 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 776 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 777 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 778 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 779 | 780 | 781 | 782 | YES 783 | 784 | 785 | 786 | 787 | 788 | YES 789 | 790 | 791 | 792 | 793 | 48 794 | 795 | 796 | 797 | YES 798 | 799 | ViewController 800 | GLKViewController 801 | 802 | YES 803 | 804 | YES 805 | toggleFilterTextures 806 | toggleHDR 807 | toggleHistogram 808 | 809 | 810 | YES 811 | id 812 | id 813 | id 814 | 815 | 816 | 817 | YES 818 | 819 | YES 820 | toggleFilterTextures 821 | toggleHDR 822 | toggleHistogram 823 | 824 | 825 | YES 826 | 827 | toggleFilterTextures 828 | id 829 | 830 | 831 | toggleHDR 832 | id 833 | 834 | 835 | toggleHistogram 836 | id 837 | 838 | 839 | 840 | 841 | YES 842 | 843 | YES 844 | _biasSlider 845 | _filterTextures 846 | _hdrButton 847 | _histogramBinMax 848 | _histogramButton 849 | _histogramMax 850 | _histogramMin 851 | _histogramUpperBound 852 | _histogramView 853 | _linearSwitch 854 | _scaleSlider 855 | 856 | 857 | YES 858 | UISlider 859 | UISwitch 860 | UISwitch 861 | UILabel 862 | UISwitch 863 | UILabel 864 | UILabel 865 | UILabel 866 | UIView 867 | UISwitch 868 | UISlider 869 | 870 | 871 | 872 | YES 873 | 874 | YES 875 | _biasSlider 876 | _filterTextures 877 | _hdrButton 878 | _histogramBinMax 879 | _histogramButton 880 | _histogramMax 881 | _histogramMin 882 | _histogramUpperBound 883 | _histogramView 884 | _linearSwitch 885 | _scaleSlider 886 | 887 | 888 | YES 889 | 890 | _biasSlider 891 | UISlider 892 | 893 | 894 | _filterTextures 895 | UISwitch 896 | 897 | 898 | _hdrButton 899 | UISwitch 900 | 901 | 902 | _histogramBinMax 903 | UILabel 904 | 905 | 906 | _histogramButton 907 | UISwitch 908 | 909 | 910 | _histogramMax 911 | UILabel 912 | 913 | 914 | _histogramMin 915 | UILabel 916 | 917 | 918 | _histogramUpperBound 919 | UILabel 920 | 921 | 922 | _histogramView 923 | UIView 924 | 925 | 926 | _linearSwitch 927 | UISwitch 928 | 929 | 930 | _scaleSlider 931 | UISlider 932 | 933 | 934 | 935 | 936 | IBProjectSource 937 | ./Classes/ViewController.h 938 | 939 | 940 | 941 | 942 | 0 943 | IBIPadFramework 944 | 945 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 946 | 947 | 948 | YES 949 | 3 950 | 933 951 | 952 | 953 | --------------------------------------------------------------------------------