├── .gitignore ├── L01_Camera ├── include │ └── Resources.h ├── resources │ ├── CinderApp.icns │ └── cinder_app_icon.ico ├── src │ └── L01_CameraApp.cpp ├── vc2013 │ ├── L01_Camera.sln │ ├── L01_Camera.vcxproj │ ├── L01_Camera.vcxproj.filters │ ├── L01_Camera.vcxproj.user │ └── Resources.rc └── xcode │ ├── Info.plist │ ├── L01_Camera.xcodeproj │ └── project.pbxproj │ └── L01_Camera_Prefix.pch ├── L02_BasicScene ├── assets │ └── shaders │ │ ├── plane_frag.glsl │ │ ├── plane_vert.glsl │ │ ├── sphere_frag.glsl │ │ └── sphere_vert.glsl ├── include │ └── Resources.h ├── resources │ ├── CinderApp.icns │ └── cinder_app_icon.ico ├── src │ └── L02_BasicSceneApp.cpp ├── vc2013 │ ├── L02_BasicScene.sln │ ├── L02_BasicScene.vcxproj │ ├── L02_BasicScene.vcxproj.filters │ └── Resources.rc └── xcode │ ├── Info.plist │ ├── L02_BasicScene.xcodeproj │ └── project.pbxproj │ └── L02_BasicScene_Prefix.pch ├── L03_Lighting_I ├── assets │ └── shaders │ │ ├── plane_frag.glsl │ │ ├── plane_vert.glsl │ │ ├── sphere_frag.glsl │ │ └── sphere_vert.glsl ├── include │ └── Resources.h ├── resources │ ├── CinderApp.icns │ └── cinder_app_icon.ico ├── src │ └── L03_Lighting_IApp.cpp ├── vc2013 │ ├── L03_Lighting_I.sln │ ├── L03_Lighting_I.vcxproj │ ├── L03_Lighting_I.vcxproj.filters │ └── Resources.rc └── xcode │ ├── Info.plist │ ├── L03_Lighting_I.xcodeproj │ └── project.pbxproj │ └── L03_Lighting_I_Prefix.pch ├── L04_Lighting_II ├── assets │ └── shaders │ │ ├── plane_frag.glsl │ │ ├── plane_vert.glsl │ │ ├── sphere_frag.glsl │ │ └── sphere_vert.glsl ├── include │ └── Resources.h ├── resources │ ├── CinderApp.icns │ └── cinder_app_icon.ico ├── src │ └── L04_Lighting_IIApp.cpp ├── vc2013 │ ├── L04_Lighting_II.sln │ ├── L04_Lighting_II.vcxproj │ ├── L04_Lighting_II.vcxproj.filters │ └── Resources.rc └── xcode │ ├── Info.plist │ ├── L04_Lighting_II.xcodeproj │ └── project.pbxproj │ └── L04_Lighting_II_Prefix.pch ├── L05_Lighting_III ├── assets │ ├── shaders │ │ ├── plane_frag.glsl │ │ ├── plane_vert.glsl │ │ ├── shape_reflect_frag.glsl │ │ ├── shape_refract_frag.glsl │ │ ├── shape_vert.glsl │ │ ├── skybox_frag.glsl │ │ └── skybox_vert.glsl │ └── textures │ │ └── skybox.png ├── include │ └── Resources.h ├── resources │ ├── CinderApp.icns │ └── cinder_app_icon.ico ├── src │ ├── L05_Lighting_IIIApp.cpp │ └── L05_Lighting_IIIApp.h ├── vc2013 │ ├── L05_Lighting_III.sln │ ├── L05_Lighting_III.vcxproj │ ├── L05_Lighting_III.vcxproj.filters │ └── Resources.rc └── xcode │ ├── Info.plist │ ├── L05_Lighting_III.xcodeproj │ └── project.pbxproj │ └── L05_Lighting_III_Prefix.pch ├── L06_Instancing ├── assets │ ├── shaders │ │ ├── shape_reflect_frag.glsl │ │ ├── shape_refract_frag.glsl │ │ ├── shape_vert.glsl │ │ ├── skybox_frag.glsl │ │ └── skybox_vert.glsl │ └── textures │ │ └── skybox.png ├── include │ └── Resources.h ├── resources │ ├── CinderApp.icns │ └── cinder_app_icon.ico ├── src │ ├── L06_InstancingApp.cpp │ └── L06_InstancingApp.h ├── vc2013 │ ├── L06_Instancing.sln │ ├── L06_Instancing.vcxproj │ ├── L06_Instancing.vcxproj.filters │ └── Resources.rc └── xcode │ ├── Info.plist │ ├── L06_Instancing.xcodeproj │ └── project.pbxproj │ └── L06_Instancing_Prefix.pch ├── L07_Motion_I ├── assets │ ├── shaders │ │ ├── shape_reflect_frag.glsl │ │ ├── shape_refract_frag.glsl │ │ ├── shape_vert.glsl │ │ ├── skybox_frag.glsl │ │ └── skybox_vert.glsl │ └── textures │ │ └── skybox.png ├── include │ └── Resources.h ├── resources │ ├── CinderApp.icns │ └── cinder_app_icon.ico ├── src │ ├── L07_Motion_IApp.cpp │ └── L07_Motion_IApp.h ├── vc2013 │ ├── L07_Motion_I.sln │ ├── L07_Motion_I.vcxproj │ ├── L07_Motion_I.vcxproj.filters │ └── Resources.rc └── xcode │ ├── Info.plist │ ├── L07_Motion_I.xcodeproj │ └── project.pbxproj │ └── L07_Motion_I_Prefix.pch ├── L08_Motion_II ├── assets │ ├── shaders │ │ ├── shape_reflect_frag.glsl │ │ ├── shape_refract_frag.glsl │ │ ├── shape_vert.glsl │ │ ├── skybox_frag.glsl │ │ └── skybox_vert.glsl │ └── textures │ │ └── skybox.png ├── include │ └── Resources.h ├── resources │ ├── CinderApp.icns │ └── cinder_app_icon.ico ├── src │ ├── L08_Motion_IIApp.cpp │ └── L08_Motion_IIApp.h ├── vc2013 │ ├── L08_Motion_II.sln │ ├── L08_Motion_II.vcxproj │ ├── L08_Motion_II.vcxproj.filters │ └── Resources.rc └── xcode │ ├── Info.plist │ ├── L08_Motion_II.xcodeproj │ └── project.pbxproj │ └── L08_Motion_II_Prefix.pch ├── L09_Motion_III ├── assets │ ├── shaders │ │ ├── shape_reflect_frag.glsl │ │ ├── shape_refract_frag.glsl │ │ ├── shape_vert.glsl │ │ ├── skybox_frag.glsl │ │ └── skybox_vert.glsl │ └── textures │ │ └── skybox.png ├── include │ └── Resources.h ├── resources │ ├── CinderApp.icns │ └── cinder_app_icon.ico ├── src │ ├── L09_Motion_IIIApp.cpp │ ├── L09_Motion_IIIApp.h │ └── Particle.h ├── vc2013 │ ├── L09_Motion_III.sln │ ├── L09_Motion_III.vcxproj │ ├── L09_Motion_III.vcxproj.filters │ └── Resources.rc └── xcode │ ├── Info.plist │ ├── L09_Motion_III.xcodeproj │ └── project.pbxproj │ └── L09_Motion_III_Prefix.pch ├── L10_FBO ├── assets │ ├── shaders │ │ ├── blur_frag.glsl │ │ ├── blur_vert.glsl │ │ ├── highpass_frag.glsl │ │ ├── passthru_vert.glsl │ │ ├── shape_reflect_frag.glsl │ │ ├── shape_refract_frag.glsl │ │ ├── shape_vert.glsl │ │ ├── skybox_frag.glsl │ │ └── skybox_vert.glsl │ └── textures │ │ └── skybox.png ├── include │ └── Resources.h ├── resources │ ├── CinderApp.icns │ └── cinder_app_icon.ico ├── src │ ├── L10_FBOApp.cpp │ ├── L10_FBOApp.h │ └── Particle.h ├── vc2013 │ ├── L10_FBO.sln │ ├── L10_FBO.vcxproj │ ├── L10_FBO.vcxproj.filters │ └── Resources.rc └── xcode │ ├── Info.plist │ ├── L10_FBO.xcodeproj │ └── project.pbxproj │ └── L10_FBO_Prefix.pch ├── L11_Attributes ├── include │ └── Resources.h ├── resources │ └── cinder_app_icon.ico ├── src │ └── L11_AttributesApp.cpp └── vc2013 │ ├── L11_Attributes.sln │ ├── L11_Attributes.vcxproj │ ├── L11_Attributes.vcxproj.filters │ └── Resources.rc ├── LearnCinderGL.sln ├── README.md └── Solutions ├── L01_Ex1 ├── include │ └── Resources.h ├── resources │ └── cinder_app_icon.ico ├── src │ └── L01_Ex1App.cpp └── vc2013 │ ├── L01_Ex1.sln │ ├── L01_Ex1.vcxproj │ ├── L01_Ex1.vcxproj.filters │ └── Resources.rc ├── L01_Ex2 ├── include │ └── Resources.h ├── resources │ └── cinder_app_icon.ico ├── src │ └── L01_Ex2.cpp └── vc2013 │ ├── L01_Ex2.sln │ ├── L01_Ex2.vcxproj │ ├── L01_Ex2.vcxproj.filters │ └── Resources.rc ├── L01_Ex3 ├── include │ └── Resources.h ├── resources │ └── cinder_app_icon.ico ├── src │ └── L01_Ex3.cpp └── vc2013 │ ├── L01_Ex3.sln │ ├── L01_Ex3.vcxproj │ ├── L01_Ex3.vcxproj.filters │ └── Resources.rc ├── L02_Ex1 ├── include │ └── Resources.h ├── resources │ └── cinder_app_icon.ico ├── src │ └── L02_Ex1App.cpp └── vc2013 │ ├── L02_Ex1.sln │ ├── L02_Ex1.vcxproj │ ├── L02_Ex1.vcxproj.filters │ └── Resources.rc ├── L02_Ex2 ├── include │ └── Resources.h ├── resources │ └── cinder_app_icon.ico ├── src │ └── L01_Ex1App.cpp └── vc2013 │ ├── L02_Ex2.sln │ ├── L02_Ex2.vcxproj │ ├── L02_Ex2.vcxproj.filters │ └── Resources.rc ├── L02_Ex3 ├── include │ └── Resources.h ├── resources │ └── cinder_app_icon.ico ├── src │ └── L01_Ex1App.cpp └── vc2013 │ ├── L01_Ex1.sln │ ├── L01_Ex1.vcxproj │ ├── L01_Ex1.vcxproj.filters │ └── Resources.rc ├── L03_Ex1 ├── include │ └── Resources.h ├── resources │ └── cinder_app_icon.ico ├── src │ └── L03_Ex1.cpp └── vc2013 │ ├── L03_Ex1.sln │ ├── L03_Ex1.vcxproj │ ├── L03_Ex1.vcxproj.filters │ └── Resources.rc ├── L03_Ex2 ├── include │ └── Resources.h ├── resources │ └── cinder_app_icon.ico ├── src │ └── L03_Ex2.cpp └── vc2013 │ ├── L03_Ex2.sln │ ├── L03_Ex2.vcxproj │ ├── L03_Ex2.vcxproj.filters │ └── Resources.rc └── L03_Ex3 ├── include └── Resources.h ├── resources └── cinder_app_icon.ico ├── src └── L03_Ex3.cpp └── vc2013 ├── L03_Ex3.sln ├── L03_Ex3.vcxproj ├── L03_Ex3.vcxproj.filters └── Resources.rc /.gitignore: -------------------------------------------------------------------------------- 1 | x64 2 | *.opensdf 3 | *.sdf 4 | *.suo 5 | 6 | # Mac OS X cruft 7 | *.pbxuser 8 | *.mode1v3 9 | *.mode2v3 10 | *.user 11 | *.xcworkspace/ 12 | xcuserdata/ 13 | .DS_Store 14 | build/ -------------------------------------------------------------------------------- /L01_Camera/include/Resources.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "cinder/CinderResources.h" 3 | 4 | //#define RES_MY_RES CINDER_RESOURCE( ../resources/, image_name.png, 128, IMAGE ) 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /L01_Camera/resources/CinderApp.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SethGibson/LearnCinderGL/3ab8fb94b6961e3d43e132e1d48c35f22c07cae0/L01_Camera/resources/CinderApp.icns -------------------------------------------------------------------------------- /L01_Camera/resources/cinder_app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SethGibson/LearnCinderGL/3ab8fb94b6961e3d43e132e1d48c35f22c07cae0/L01_Camera/resources/cinder_app_icon.ico -------------------------------------------------------------------------------- /L01_Camera/src/L01_CameraApp.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Lesson 01: In Which We Learn To Setup A Camera 3 | Topics Covered: 4 | Perspective Camera 5 | Camera Controls 6 | Simple shape drawing 7 | */ 8 | 9 | #include "cinder/app/App.h" 10 | #include "cinder/app/RendererGl.h" 11 | #include "cinder/Camera.h" // Include this for camera support 12 | #include "cinder/CameraUi.h" // Include this for camera controls 13 | #include "cinder/gl/gl.h" 14 | 15 | using namespace ci; 16 | using namespace ci::app; 17 | using namespace std; 18 | 19 | class L01_CameraApp : public App 20 | { 21 | public: 22 | void setup() override; 23 | void mouseDown( MouseEvent event ) override; 24 | void update() override; 25 | void draw() override; 26 | 27 | private: 28 | CameraPersp mCamera; 29 | CameraUi mCameraCtrl; 30 | }; 31 | 32 | void L01_CameraApp::setup() 33 | { 34 | float verticalFOV = 45.0f; 35 | float aspectRatio = getWindowAspectRatio(); 36 | float nearClip = 0.1f; 37 | float farClip = 10.0f; 38 | vec3 cameraPosition = vec3(0, 0, -1); 39 | vec3 cameraTarget = vec3(0); 40 | vec3 cameraUpAxis = vec3(0, 1, 0); 41 | 42 | /* 43 | Think of Cinder's CameraPersp as being similar to any other camera 44 | object from any other 3d context/application. Setting up intrinsics 45 | and extrinisics is pretty simple, we just use the following two 46 | functions: 47 | */ 48 | mCamera.setPerspective(verticalFOV, aspectRatio, nearClip, farClip); 49 | mCamera.lookAt(cameraPosition, cameraTarget, cameraUpAxis); 50 | 51 | // and now we bind our camera to the controller object 52 | mCameraCtrl = CameraUi(&mCamera, getWindow()); 53 | } 54 | 55 | void L01_CameraApp::mouseDown( MouseEvent event ) 56 | { 57 | } 58 | 59 | void L01_CameraApp::update() 60 | { 61 | } 62 | 63 | void L01_CameraApp::draw() 64 | { 65 | gl::clear( Color( 0, 0, 0 ) ); 66 | 67 | /* 68 | To draw things in OpenGL, we have to know how to transform 69 | positional data (vertices, normals, etc) from object coordinates 70 | to world coordinates to screen space coordinates, so we use 71 | setMatrices to tell Cinder/OpenGL where to get that transform stack from, 72 | in this case our CameraPersp object. 73 | */ 74 | gl::setMatrices(mCamera); 75 | 76 | gl::enableDepthRead(); // try commenting this out to see the effect! 77 | 78 | vec3 cubeCenter = vec3(0); 79 | vec3 cubeSize = vec3(0.5); 80 | 81 | // and now we draw an object just so we don't have a black screen 82 | gl::drawColorCube(cubeCenter, cubeSize); 83 | } 84 | 85 | 86 | /* EXERCISES: 87 | Try changing the camera intrinsics (FOV, aspect, etc) to see the effect on drawing 88 | 89 | Try drawing a different object 90 | Hint: use gl::color to set a drawing color, then use one of the gl::draw functions 91 | to draw a new shape (e.g. gl::drawSphere(), gl::drawSolidRect(), use intellisense!) 92 | 93 | Try drawing two objects in different spots 94 | 95 | */ 96 | 97 | 98 | CINDER_APP( L01_CameraApp, RendererGl ) 99 | -------------------------------------------------------------------------------- /L01_Camera/vc2013/L01_Camera.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "L01_Camera", "L01_Camera.vcxproj", "{8E43D05F-88F2-4C3C-AF1C-18785D872B30}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x64 = Debug|x64 9 | Release|x64 = Release|x64 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {8E43D05F-88F2-4C3C-AF1C-18785D872B30}.Debug|x64.ActiveCfg = Debug|x64 13 | {8E43D05F-88F2-4C3C-AF1C-18785D872B30}.Debug|x64.Build.0 = Debug|x64 14 | {8E43D05F-88F2-4C3C-AF1C-18785D872B30}.Release|x64.ActiveCfg = Release|x64 15 | {8E43D05F-88F2-4C3C-AF1C-18785D872B30}.Release|x64.Build.0 = Release|x64 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /L01_Camera/vc2013/L01_Camera.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 5 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 6 | 7 | 8 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 9 | h;hpp;hxx;hm;inl;inc;xsd 10 | 11 | 12 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 13 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 14 | 15 | 16 | 17 | 18 | Source Files 19 | 20 | 21 | Source Files 22 | 23 | 24 | Header Files 25 | 26 | 27 | 28 | 29 | Header Files 30 | 31 | 32 | 33 | 34 | Resource Files 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /L01_Camera/vc2013/L01_Camera.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /L01_Camera/vc2013/Resources.rc: -------------------------------------------------------------------------------- 1 | #include "../include/Resources.h" 2 | 3 | 1 ICON "..\\resources\\cinder_app_icon.ico" 4 | -------------------------------------------------------------------------------- /L01_Camera/xcode/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | CinderApp.icns 11 | CFBundleIdentifier 12 | org.libcinder.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2013 __MyCompanyName__. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /L01_Camera/xcode/L01_Camera_Prefix.pch: -------------------------------------------------------------------------------- 1 | #if defined( __cplusplus ) 2 | #include "cinder/Cinder.h" 3 | 4 | #include "cinder/app/App.h" 5 | 6 | #include "cinder/gl/gl.h" 7 | 8 | #include "cinder/CinderMath.h" 9 | #include "cinder/Matrix.h" 10 | #include "cinder/Vector.h" 11 | #include "cinder/Quaternion.h" 12 | #endif 13 | -------------------------------------------------------------------------------- /L02_BasicScene/assets/shaders/plane_frag.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | 3 | out vec4 FragColor; 4 | 5 | void main() 6 | { 7 | FragColor = vec4(0.5,0.5,0.5,1.0); 8 | } -------------------------------------------------------------------------------- /L02_BasicScene/assets/shaders/plane_vert.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform mat4 ciModelViewProjection; 3 | 4 | in vec4 ciPosition; 5 | 6 | void main() 7 | { 8 | gl_Position = ciModelViewProjection * ciPosition; 9 | } -------------------------------------------------------------------------------- /L02_BasicScene/assets/shaders/sphere_frag.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | 3 | out vec4 FragColor; 4 | 5 | void main() 6 | { 7 | FragColor = vec4(0.5,0.1,0.25,1.0); 8 | } -------------------------------------------------------------------------------- /L02_BasicScene/assets/shaders/sphere_vert.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform mat4 ciModelViewProjection; 3 | 4 | in vec4 ciPosition; 5 | 6 | void main() 7 | { 8 | gl_Position = ciModelViewProjection * ciPosition; 9 | } -------------------------------------------------------------------------------- /L02_BasicScene/include/Resources.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "cinder/CinderResources.h" 3 | 4 | //#define RES_MY_RES CINDER_RESOURCE( ../resources/, image_name.png, 128, IMAGE ) 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /L02_BasicScene/resources/CinderApp.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SethGibson/LearnCinderGL/3ab8fb94b6961e3d43e132e1d48c35f22c07cae0/L02_BasicScene/resources/CinderApp.icns -------------------------------------------------------------------------------- /L02_BasicScene/resources/cinder_app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SethGibson/LearnCinderGL/3ab8fb94b6961e3d43e132e1d48c35f22c07cae0/L02_BasicScene/resources/cinder_app_icon.ico -------------------------------------------------------------------------------- /L02_BasicScene/src/L02_BasicSceneApp.cpp: -------------------------------------------------------------------------------- 1 | /* Lesson 02: In Which We Learn to setup shaders and use batches to draw basic shapes. 2 | 3 | Topics Covered: 4 | Drawing simple primitives with BatchRefs 5 | Writing shaders and using GlslProgRef to apply GLSL shaders to our shapes 6 | Basic object positioning using glm, the GL Math library 7 | */ 8 | 9 | #include "cinder/app/App.h" 10 | #include "cinder/app/RendererGl.h" 11 | #include "cinder/Camera.h" 12 | #include "cinder/CameraUi.h" 13 | #include "cinder/gl/gl.h" 14 | #include "cinder/gl/Batch.h" 15 | #include "cinder/gl/GlslProg.h" 16 | 17 | using namespace ci; 18 | using namespace ci::app; 19 | using namespace std; 20 | 21 | class L02_BasicScene : public App 22 | { 23 | public: 24 | void setup() override; 25 | void mouseDown(MouseEvent event) override; 26 | void update() override; 27 | void draw() override; 28 | 29 | private: 30 | void setupCamera(); 31 | 32 | CameraPersp mCamera; 33 | CameraUi mCameraCtrl; 34 | 35 | /* Declaring Scene Objects: 36 | Our "scene" is going to be a simple sphere "hovering" over a plane. 37 | In Cinder, we use "Batch" objects to encapsulate information about 38 | geometry (shapes, shaders, etc) and later draw the objects. 39 | 40 | */ 41 | gl::BatchRef mPlaneBatch; 42 | gl::BatchRef mSphereBatch; 43 | 44 | /* Declaring Shaders: 45 | In Modern OpenGL, nothing gets done without shaders (or "GLSL programs"). 46 | Cinder encapsulates shader information in GlslProg objects. 47 | */ 48 | gl::GlslProgRef mPlaneShader; 49 | gl::GlslProgRef mSphereShader; 50 | }; 51 | 52 | void L02_BasicScene::setup() 53 | { 54 | // We've moved all our camera setup into its own function 55 | // If we were to define an app constructor, we could do that 56 | // there as well. 57 | setupCamera(); 58 | 59 | /* Defining Scene Objects: Shaders 60 | Alright, let's set up our scene objects. Shader objects are pretty simple, 61 | we just pass in paths to shaders, in this case, we're using asset folder relative 62 | paths so we can make use of Cinder's built in loadAsset(). For these examples, 63 | we're just using vertex and fragment programs, altho Cinder supports geometry shaders, 64 | tesselation shaders, and compute shaders 65 | */ 66 | string planeVertShader = "shaders/plane_vert.glsl"; 67 | string planeFragShader = "shaders/plane_frag.glsl"; 68 | mPlaneShader = gl::GlslProg::create(loadAsset(planeVertShader), loadAsset(planeFragShader)); 69 | 70 | /* Defining Scene Objects: Draw Batches 71 | Now let's set up our draw batches. While there's nothing in OpenGL quite analogous to a batch, 72 | the concept of batches is all over modern computer graphics. This is the simplest way to 73 | set up a batch, wherein we pass in a geometry definition using geom::, in this case geom::Plane to 74 | define a plane, and then we pass in our shader object as well. geom::Plane() and the related objects are collectively 75 | known as geom::Source objects, which you can think of as geometry generators. in fact, if you remember from our 76 | last lesson where we drew a cube, you could just as well have issued this statement: 77 | 78 | gl::draw(geom::Cube()); 79 | */ 80 | vec3 planeNormal(0, 1, 0); 81 | vec2 planeSize(2.0f); 82 | mPlaneBatch = gl::Batch::create(geom::Plane().normal(planeNormal).size(planeSize), mPlaneShader); 83 | 84 | // We'll setup our sphere pretty much the same way we setup our plane: 85 | string sphereVertShader = "shaders/sphere_vert.glsl"; 86 | string sphereFragShader = "shaders/sphere_frag.glsl"; 87 | mSphereShader = gl::GlslProg::create(loadAsset(sphereVertShader), loadAsset(sphereFragShader)); 88 | 89 | float sphereRadius = 0.1f; 90 | int sphereResolution = 16; 91 | mSphereBatch = gl::Batch::create(geom::Sphere().radius(sphereRadius).subdivisions(sphereResolution),mSphereShader); 92 | } 93 | 94 | void L02_BasicScene::setupCamera() 95 | { 96 | float verticalFOV = 45.0f; 97 | float aspectRatio = getWindowAspectRatio(); 98 | float nearClip = 0.1f; 99 | float farClip = 10.0f; 100 | vec3 cameraPosition = vec3(0, 0.1, -1); 101 | vec3 cameraTarget = vec3(0); 102 | vec3 cameraUpAxis = vec3(0, 1, 0); 103 | 104 | mCamera.setPerspective(verticalFOV, aspectRatio, nearClip, farClip); 105 | mCamera.lookAt(cameraPosition, cameraTarget, cameraUpAxis); 106 | mCameraCtrl = CameraUi(&mCamera, getWindow()); 107 | } 108 | 109 | void L02_BasicScene::mouseDown(MouseEvent event) 110 | { 111 | } 112 | 113 | void L02_BasicScene::update() 114 | { 115 | } 116 | 117 | void L02_BasicScene::draw() 118 | { 119 | gl::clear(Color(0, 0, 0)); 120 | gl::setMatrices(mCamera); 121 | gl::enableDepthRead(); 122 | 123 | // drawing our plane is just as simple as calling the batch's draw() method 124 | mPlaneBatch->draw(); 125 | 126 | /* Drawing The Sphere 127 | Drawing our sphere requires an extra step. By default, objects are drawn at the origin, or 128 | 0,0,0 on the x,y, and z axes. Some geom::Sources and gl::draw()s allow you to specify an object's center, but 129 | let's avoid those to minimize confusion. Instead, we'll use proper matrix transformation to "move our 130 | object." Under the hood, it's a bit more complicated than that, but for now let's keep it simple: 131 | */ 132 | gl::pushModelMatrix(); // Preserve the current transformation 133 | gl::translate(vec3(0, 0.1, 0)); // translate 0.1 units up the y axis 134 | mSphereBatch->draw(); // Now draw 135 | gl::popModelMatrix(); // Restore the last transformation, which undoes any transforms we just did 136 | } 137 | 138 | /* EXERCISES 139 | If you're familiar with 3d, you probably are familiar with the concept of translating, rotating, and scaling. Try 140 | scaling the sphere up or down a bit. 141 | HINT: Maybe there's a gl:: function for scaling? 142 | 143 | Try drawing multiple objects using the same sphere batch 144 | HINT: See this post on the cinder forums: https://forum.libcinder.org/#Topic/23286000002367065 145 | 146 | Set up another batch with a different geom::Source or sources. For example, try drawing a silo by creating 147 | a batch with a geom::Cylinder and a geom::Cone 148 | HINT: Batches can share the same shader 149 | HINT: Use gl::translate to place the cone on top of the cylinder 150 | */ 151 | CINDER_APP(L02_BasicScene, RendererGl) 152 | 153 | -------------------------------------------------------------------------------- /L02_BasicScene/vc2013/L02_BasicScene.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "L02_BasicScene", "L02_BasicScene.vcxproj", "{D55A3A6A-39EC-469A-8706-39BFDBFE01CE}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x64 = Debug|x64 9 | Release|x64 = Release|x64 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {D55A3A6A-39EC-469A-8706-39BFDBFE01CE}.Debug|x64.ActiveCfg = Debug|x64 13 | {D55A3A6A-39EC-469A-8706-39BFDBFE01CE}.Debug|x64.Build.0 = Debug|x64 14 | {D55A3A6A-39EC-469A-8706-39BFDBFE01CE}.Release|x64.ActiveCfg = Release|x64 15 | {D55A3A6A-39EC-469A-8706-39BFDBFE01CE}.Release|x64.Build.0 = Release|x64 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /L02_BasicScene/vc2013/L02_BasicScene.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 15 | 16 | 17 | {07b8a9f8-9f87-43a6-9736-779d2592a3e2} 18 | 19 | 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Header Files 34 | 35 | 36 | 37 | 38 | Resource Files 39 | 40 | 41 | 42 | 43 | Source Files\shaders 44 | 45 | 46 | Source Files\shaders 47 | 48 | 49 | Source Files\shaders 50 | 51 | 52 | Source Files\shaders 53 | 54 | 55 | -------------------------------------------------------------------------------- /L02_BasicScene/vc2013/Resources.rc: -------------------------------------------------------------------------------- 1 | #include "../include/Resources.h" 2 | 3 | 1 ICON "..\\resources\\cinder_app_icon.ico" 4 | -------------------------------------------------------------------------------- /L02_BasicScene/xcode/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | CinderApp.icns 11 | CFBundleIdentifier 12 | org.libcinder.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2013 __MyCompanyName__. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /L02_BasicScene/xcode/L02_BasicScene_Prefix.pch: -------------------------------------------------------------------------------- 1 | #if defined( __cplusplus ) 2 | #include "cinder/Cinder.h" 3 | 4 | #include "cinder/app/App.h" 5 | 6 | #include "cinder/gl/gl.h" 7 | 8 | #include "cinder/CinderMath.h" 9 | #include "cinder/Matrix.h" 10 | #include "cinder/Vector.h" 11 | #include "cinder/Quaternion.h" 12 | #endif 13 | -------------------------------------------------------------------------------- /L03_Lighting_I/assets/shaders/plane_frag.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | 3 | out vec4 FragColor; 4 | 5 | void main() 6 | { 7 | FragColor = vec4(0.5,0.5,0.5,1.0); 8 | } -------------------------------------------------------------------------------- /L03_Lighting_I/assets/shaders/plane_vert.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform mat4 ciModelViewProjection; 3 | 4 | in vec4 ciPosition; 5 | 6 | void main() 7 | { 8 | gl_Position = ciModelViewProjection * ciPosition; 9 | } -------------------------------------------------------------------------------- /L03_Lighting_I/assets/shaders/sphere_frag.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform vec3 uLightPosition = vec3(0.0,0.5,-0.5); 3 | uniform vec3 uBaseColor = vec3(0.5,0.1,0.25); 4 | uniform float uAmbientStrength = 0.25; 5 | 6 | in vec3 Normal; 7 | in vec3 WorldPos; 8 | 9 | out vec4 FragColor; 10 | 11 | void main() 12 | { 13 | vec3 lightDirection = normalize(uLightPosition-WorldPos); 14 | vec3 normal = normalize(Normal); 15 | float diffuse = max(dot(normal,lightDirection), 0.0); 16 | 17 | FragColor = vec4(uBaseColor*diffuse+uBaseColor*uAmbientStrength,1.0); 18 | } -------------------------------------------------------------------------------- /L03_Lighting_I/assets/shaders/sphere_vert.glsl: -------------------------------------------------------------------------------- 1 | /* SHADERS!! ------------------------------------------------------------------------------------------------------ 2 | Ok so you've probably heard a ton about shaders in your readings and discussions and such 3 | or you may be familiar with the idea of shaders from other 3d contexts. In OpenGL/DirectX/Cinder/Realtime 3d graphics land, 4 | a shader is basically just a program that runs specifically on the GPU and defines part of the 5 | rendering pipeline. You may have heard the terms "fixed function pipeline" vs "programmable pipeline", 6 | well, in dark times, the OpenGL rendering pipeline was, erm, fixed, which basically meant that you could 7 | only define so much of the input and output. Now in Modern OpenGL, we can pretty much control every step 8 | of the rendering process with shaders, so we can control vertices, fragments, primitives, the horizontal, 9 | the vertical, etc. For these tutorials we'll mainly be focusing on vertices and fragments, so here we go... 10 | -----------------------------------------------------------------------------------------------------------------*/ 11 | 12 | // this is similar to a c++ preprocessor define, wherein we tell the shader compiler certain things 13 | // about our shader prior to the main compilation. Here we set the GLSL version, which gives us 14 | // access to certain features 15 | #version 150 16 | 17 | /* Communicating Between The App/Context And The Shaders: Uniforms, Ins, and Outs 18 | As you've probably guessed, there are a few things we need to be able to do with our shaders. 19 | If you think about that term "pipeline", here it's used for a good reason. Think of it as 20 | passing data from the application, through each shader, then back to the application, and eventually 21 | the screen. So we need some way to get data from the app into the shader, then from one shader to the next 22 | shader. Enter uniforms, ins, and outs. 23 | 24 | Now, for the most part, when we're working with data in a shader, the actual types you're already familiar with, 25 | e.g. floats, ints, vectors, etc. To tell the pipeline what we're using a specific variable of type for, we add what's 26 | called a "storage qualifier" or "type qualifier". Prior to GLSL version 150, you would've seen things like uniform, attribute, varying, etc. 27 | Nowadays, things have been simplified a bit and we use the qualifiers "uniform", "in", and "out" (note that if we hadn't 28 | added the above version statement, we wouldn't be able to use "uniform", "in", and "out" and instead would have to use 29 | "uniform", "varying", and "attribute". So what does each one do? 30 | 31 | UNIFORM (UNIFORM) 32 | Think of a uniform like a global variable, that is, once a shader program starts to run, the uniform remains the same 33 | for the entire execution of the program. Another way to think of it is as a piece of data that doesn't change per 34 | component in the shader stage, so in a vertex shader, a uniform value will be the same for every vertex in the 35 | object that's using said shader. Uniforms often times come from the calling app, but you can define and declare a uniform 36 | within the shader (check out sphere_frag.glsl for an example). If you're porting pre-existing shader code from an earlier 37 | version of glsl, "uniform" == "uniform" 38 | 39 | IN (ATTRIBUTE) 40 | In variables are data that are passed into a shader from the preceeding stage in the pipeline, and can be different 41 | per component. For example, in a vertex shader, an in variable is data coming into the app, and the data is applied per-vertex 42 | rather than per instance of the shader as with a uniform (which is why in the case of vertex shaders, you'll hear ins referred 43 | to as "vertex attributes"). An example of a vertex in would be per vertex color. If you're porting pre-existing shader code from an earlier 44 | version of glsl, "in" == "attribute" 45 | 46 | OUT (VARYING) 47 | Out variables are data that are passed from the current pipeline stage to the next stage, for example, a fragment shader 48 | defines a single out of type vec4 which goes from the fragment shader to the rendering context, which could be the screen 49 | in the case of drawing an object, or could be a separate frame buffer in the case of full screen effects (we'll explore those in 50 | Lesson 10). One thing to keep in mind is that an out from one stage will have the same variable name as the corresponding 51 | in in the next stage, for example, here in sphere_vert, we define "out vec3 Normal", which maps to "in vec3 Normal" in 52 | sphere_frag. If you're porting pre-existing shader code from an earlier version of glsl, "out" == "varying" 53 | */ 54 | 55 | /* Cinder Shader Variables 56 | 99% of the time, there are certain bits of data that a shader is going to expect from the application to get its job done, 57 | things like vertex positions, normals, uvs, matrices, etc. Ordinarily you would have to set these up in your host app 58 | and pass them through to the shader, but Cinder handles many of these for you. Anytime you see a shader variable that starts 59 | with "ci", that's one of our Cinder defined vars. You can find the full list of these in cinder/source/gl/GlslProg.cpp. 60 | */ 61 | 62 | // Alright so, with all that context set, let's get to the specifics of our shader: 63 | 64 | /* Uniforms: 65 | 66 | */ 67 | uniform mat4 ciModelViewProjection; 68 | uniform mat4 ciModelMatrix; 69 | 70 | /* Ins: 71 | */ 72 | in vec4 ciPosition; 73 | in vec4 ciNormal; 74 | 75 | /* Outs: 76 | */ 77 | out vec3 Normal; 78 | out vec3 WorldPos; 79 | 80 | 81 | void main() 82 | { 83 | WorldPos = vec3(ciModelMatrix*ciPosition); 84 | Normal = vec3(ciModelMatrix*ciNormal); 85 | gl_Position = ciModelViewProjection * ciPosition; 86 | } -------------------------------------------------------------------------------- /L03_Lighting_I/include/Resources.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "cinder/CinderResources.h" 3 | 4 | //#define RES_MY_RES CINDER_RESOURCE( ../resources/, image_name.png, 128, IMAGE ) 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /L03_Lighting_I/resources/CinderApp.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SethGibson/LearnCinderGL/3ab8fb94b6961e3d43e132e1d48c35f22c07cae0/L03_Lighting_I/resources/CinderApp.icns -------------------------------------------------------------------------------- /L03_Lighting_I/resources/cinder_app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SethGibson/LearnCinderGL/3ab8fb94b6961e3d43e132e1d48c35f22c07cae0/L03_Lighting_I/resources/cinder_app_icon.ico -------------------------------------------------------------------------------- /L03_Lighting_I/src/L03_Lighting_IApp.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Lesson 03: In Which We Learn basic lighting with shaders 3 | Topics Covered: 4 | Simple diffuse lighting with GLSL 5 | Shaders! 6 | 7 | "Lighting" is a bit of a misnomer as this lesson serves as our introduction to shaders/GLSL. 8 | */ 9 | 10 | #include "cinder/app/App.h" 11 | #include "cinder/app/RendererGl.h" 12 | #include "cinder/Camera.h" 13 | #include "cinder/CameraUi.h" 14 | #include "cinder/gl/gl.h" 15 | #include "cinder/gl/Batch.h" 16 | #include "cinder/gl/GlslProg.h" 17 | 18 | using namespace ci; 19 | using namespace ci::app; 20 | using namespace std; 21 | 22 | class L03_Lighting_I : public App 23 | { 24 | public: 25 | void setup() override; 26 | void mouseDown(MouseEvent event) override; 27 | void update() override; 28 | void draw() override; 29 | 30 | private: 31 | void setupCamera(); 32 | void setupBatches(); 33 | 34 | CameraPersp mCamera; 35 | CameraUi mCameraCtrl; 36 | 37 | gl::BatchRef mPlaneBatch; 38 | gl::GlslProgRef mPlaneShader; 39 | 40 | gl::BatchRef mSphereBatch; 41 | gl::GlslProgRef mSphereShader; 42 | }; 43 | 44 | void L03_Lighting_I::setup() 45 | { 46 | setupCamera(); 47 | setupBatches(); 48 | } 49 | 50 | void L03_Lighting_I::setupCamera() 51 | { 52 | float verticalFOV = 45.0f; 53 | float aspectRatio = getWindowAspectRatio(); 54 | float nearClip = 0.1f; 55 | float farClip = 10.0f; 56 | vec3 cameraPosition = vec3(0, 0.1, -1); 57 | vec3 cameraTarget = vec3(0); 58 | vec3 cameraUpAxis = vec3(0, 1, 0); 59 | 60 | mCamera.setPerspective(verticalFOV, aspectRatio, nearClip, farClip); 61 | mCamera.lookAt(cameraPosition, cameraTarget, cameraUpAxis); 62 | mCameraCtrl = CameraUi(&mCamera, getWindow()); 63 | } 64 | 65 | void L03_Lighting_I::setupBatches() 66 | { 67 | vec3 planeNormal(0, 1, 0); 68 | vec2 planeSize(2.0f); 69 | string planeVertShader = "shaders/plane_vert.glsl"; 70 | string planeFragShader = "shaders/plane_frag.glsl"; 71 | mPlaneShader = gl::GlslProg::create(loadAsset(planeVertShader), loadAsset(planeFragShader)); 72 | mPlaneBatch = gl::Batch::create(geom::Plane().normal(planeNormal).size(planeSize), mPlaneShader); 73 | 74 | float sphereRadius = 0.1f; 75 | int sphereResolution = 16; 76 | string sphereVertShader = "shaders/sphere_vert.glsl"; 77 | string sphereFragShader = "shaders/sphere_frag.glsl"; 78 | mSphereShader = gl::GlslProg::create(loadAsset(sphereVertShader), loadAsset(sphereFragShader)); 79 | mSphereBatch = gl::Batch::create(geom::Sphere().radius(sphereRadius).subdivisions(sphereResolution), mSphereShader); 80 | } 81 | 82 | void L03_Lighting_I::mouseDown(MouseEvent event) 83 | { 84 | } 85 | 86 | void L03_Lighting_I::update() 87 | { 88 | } 89 | 90 | void L03_Lighting_I::draw() 91 | { 92 | /* Working With Shaders 93 | So you'll notice that other than moving the batch setup into its own method 94 | the code in the cpp file is practically identical to the previous lesson... 95 | What's up with that? Well, once we want to start drawing objects, all the magic is 96 | performed by the shaders, so we'll be working in the .glsl files for this lesson... 97 | */ 98 | gl::clear(Color(0, 0, 0)); 99 | gl::setMatrices(mCamera); 100 | gl::enableDepthRead(); 101 | 102 | mPlaneBatch->draw(); 103 | 104 | gl::pushModelMatrix(); 105 | gl::translate(vec3(0, 0.1, 0)); 106 | mSphereBatch->draw(); 107 | gl::popModelMatrix(); 108 | 109 | /* EXERCISES 110 | Change the color of the of the sphere 111 | 112 | Right now, we just assume a white light. Implement color for the light 113 | HINT: define another uniform for color, then modulate the surface color 114 | of the sphere by the new color and the diffuse term in the shader 115 | 116 | Copy sphere_vert and sphere_frag, add a new object to the scene with those shaders, and 117 | color them something else (we'll explore a simpler way to do this in a future lesson, but try this for now) 118 | HINT: you'll need a new gl::BatchRef and gl::GlslProgRef 119 | */ 120 | } 121 | 122 | CINDER_APP(L03_Lighting_I, RendererGl) 123 | 124 | -------------------------------------------------------------------------------- /L03_Lighting_I/vc2013/L03_Lighting_I.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "L03_Lighting_I", "L03_Lighting_I.vcxproj", "{C19B3663-D8E5-4874-B303-602BCA492DCB}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x64 = Debug|x64 9 | Release|x64 = Release|x64 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {C19B3663-D8E5-4874-B303-602BCA492DCB}.Debug|x64.ActiveCfg = Debug|x64 13 | {C19B3663-D8E5-4874-B303-602BCA492DCB}.Debug|x64.Build.0 = Debug|x64 14 | {C19B3663-D8E5-4874-B303-602BCA492DCB}.Release|x64.ActiveCfg = Release|x64 15 | {C19B3663-D8E5-4874-B303-602BCA492DCB}.Release|x64.Build.0 = Release|x64 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /L03_Lighting_I/vc2013/L03_Lighting_I.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 15 | 16 | 17 | {a319d1bd-ccbe-4930-ba61-dfc511fb7cfa} 18 | 19 | 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Header Files 34 | 35 | 36 | 37 | 38 | Resource Files 39 | 40 | 41 | 42 | 43 | Source Files\shaders 44 | 45 | 46 | Source Files\shaders 47 | 48 | 49 | Source Files\shaders 50 | 51 | 52 | Source Files\shaders 53 | 54 | 55 | -------------------------------------------------------------------------------- /L03_Lighting_I/vc2013/Resources.rc: -------------------------------------------------------------------------------- 1 | #include "../include/Resources.h" 2 | 3 | 1 ICON "..\\resources\\cinder_app_icon.ico" 4 | -------------------------------------------------------------------------------- /L03_Lighting_I/xcode/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | CinderApp.icns 11 | CFBundleIdentifier 12 | org.libcinder.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2013 __MyCompanyName__. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /L03_Lighting_I/xcode/L03_Lighting_I_Prefix.pch: -------------------------------------------------------------------------------- 1 | #if defined( __cplusplus ) 2 | #include "cinder/Cinder.h" 3 | 4 | #include "cinder/app/App.h" 5 | 6 | #include "cinder/gl/gl.h" 7 | 8 | #include "cinder/CinderMath.h" 9 | #include "cinder/Matrix.h" 10 | #include "cinder/Vector.h" 11 | #include "cinder/Quaternion.h" 12 | #endif 13 | -------------------------------------------------------------------------------- /L04_Lighting_II/assets/shaders/plane_frag.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | 3 | out vec4 FragColor; 4 | 5 | void main() 6 | { 7 | FragColor = vec4(0.5,0.5,0.5,1.0); 8 | } -------------------------------------------------------------------------------- /L04_Lighting_II/assets/shaders/plane_vert.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform mat4 ciModelViewProjection; 3 | 4 | in vec4 ciPosition; 5 | 6 | void main() 7 | { 8 | gl_Position = ciModelViewProjection * ciPosition; 9 | } -------------------------------------------------------------------------------- /L04_Lighting_II/assets/shaders/sphere_frag.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform vec3 uCameraPos; 3 | uniform vec3 uLightPos; 4 | uniform vec3 uColor; 5 | uniform float uSpecularStrength; 6 | uniform float uSpecularPower; 7 | uniform float uAmbientStrength; 8 | 9 | in vec3 Normal; 10 | in vec3 WorldPos; 11 | 12 | out vec4 FragColor; 13 | 14 | void main() 15 | { 16 | vec3 normal = normalize(Normal); 17 | vec3 lightDirection = normalize(uLightPos-WorldPos); 18 | vec3 viewDirection = normalize(uCameraPos-WorldPos); 19 | vec3 viewReflect = reflect(viewDirection, normal); 20 | 21 | vec3 diffuse = uColor*max(dot(normal,lightDirection), 0.0); 22 | vec3 ambient = uColor*uAmbientStrength; 23 | float specular = pow(max(dot(-lightDirection, viewReflect),0.0), uSpecularPower)*uSpecularStrength; 24 | 25 | FragColor = vec4(diffuse+specular+ambient,1.0); 26 | } -------------------------------------------------------------------------------- /L04_Lighting_II/assets/shaders/sphere_vert.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform mat4 ciModelViewProjection; 3 | uniform mat4 ciNormalMatrix; 4 | uniform mat4 ciModelMatrix; 5 | 6 | in vec4 ciPosition; 7 | in vec4 ciNormal; 8 | 9 | out vec3 Normal; 10 | out vec3 WorldPos; 11 | 12 | void main() 13 | { 14 | WorldPos = vec3(ciModelMatrix*ciPosition); 15 | Normal = vec3(ciModelMatrix*ciNormal); 16 | gl_Position = ciModelViewProjection * ciPosition; 17 | } -------------------------------------------------------------------------------- /L04_Lighting_II/include/Resources.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "cinder/CinderResources.h" 3 | 4 | //#define RES_MY_RES CINDER_RESOURCE( ../resources/, image_name.png, 128, IMAGE ) 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /L04_Lighting_II/resources/CinderApp.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SethGibson/LearnCinderGL/3ab8fb94b6961e3d43e132e1d48c35f22c07cae0/L04_Lighting_II/resources/CinderApp.icns -------------------------------------------------------------------------------- /L04_Lighting_II/resources/cinder_app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SethGibson/LearnCinderGL/3ab8fb94b6961e3d43e132e1d48c35f22c07cae0/L04_Lighting_II/resources/cinder_app_icon.ico -------------------------------------------------------------------------------- /L04_Lighting_II/src/L04_Lighting_IIApp.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Lesson 04: In Which We Learn more lighting, how to use Cinder's built-in UI to control settings, 3 | and how to set application parameters 4 | 5 | Topics Covered: 6 | Specular highlights 7 | Cinder's InterfaceGl window 8 | GLSL uniforms 9 | Passing application parameters to the application runner macro 10 | */ 11 | 12 | #include "cinder/app/App.h" 13 | #include "cinder/app/RendererGl.h" 14 | #include "cinder/Camera.h" 15 | #include "cinder/CameraUi.h" 16 | #include "cinder/gl/gl.h" 17 | #include "cinder/gl/Batch.h" 18 | #include "cinder/gl/GlslProg.h" 19 | #include "cinder/params/Params.h" 20 | 21 | using namespace ci; 22 | using namespace ci::app; 23 | using namespace std; 24 | 25 | class L04_Lighting_II : public App 26 | { 27 | public: 28 | void setup() override; 29 | void mouseDown(MouseEvent event) override; 30 | void update() override; 31 | void draw() override; 32 | 33 | private: 34 | void setupCamera(); 35 | void setupBatches(); 36 | void setupGUI(); 37 | void drawSphere(); 38 | 39 | CameraPersp mCamera; 40 | CameraUi mCameraCtrl; 41 | 42 | gl::BatchRef mPlaneBatch; 43 | gl::GlslProgRef mPlaneShader; 44 | 45 | gl::BatchRef mSphereBatch; 46 | gl::GlslProgRef mSphereShader; 47 | string mUniformLightPos = "uLightPos"; 48 | string mUniformEyePos = "uCameraPos"; 49 | string mUniformSpecularPower = "uSpecularPower"; 50 | string mUniformSpecularStrength = "uSpecularStrength"; 51 | string mUniformAmbientStrength = "uAmbientStrength"; 52 | string mUniformColor = "uColor"; 53 | 54 | params::InterfaceGlRef mGUI; 55 | float mParamLightPosX, 56 | mParamLightPosY, 57 | mParamLightPosZ, 58 | mParamSpecularPower, 59 | mParamSpecularStrength, 60 | mParamAmbientStrength; 61 | 62 | Color mParamColor; 63 | }; 64 | 65 | void L04_Lighting_II::setup() 66 | { 67 | setupGUI(); 68 | setupCamera(); 69 | setupBatches(); 70 | } 71 | 72 | void L04_Lighting_II::setupCamera() 73 | { 74 | float verticalFOV = 45.0f; 75 | float aspectRatio = getWindowAspectRatio(); 76 | float nearClip = 0.1f; 77 | float farClip = 10.0f; 78 | vec3 cameraPosition = vec3(0, 0.1, -1); 79 | vec3 cameraTarget = vec3(0); 80 | vec3 cameraUpAxis = vec3(0, 1, 0); 81 | 82 | mCamera.setPerspective(verticalFOV, aspectRatio, nearClip, farClip); 83 | mCamera.lookAt(cameraPosition, cameraTarget, cameraUpAxis); 84 | mCameraCtrl = CameraUi(&mCamera, getWindow()); 85 | } 86 | 87 | void L04_Lighting_II::setupBatches() 88 | { 89 | vec3 planeNormal(0, 1, 0); 90 | vec2 planeSize(2.0f); 91 | string planeVertShader = "shaders/plane_vert.glsl"; 92 | string planeFragShader = "shaders/plane_frag.glsl"; 93 | mPlaneShader = gl::GlslProg::create(loadAsset(planeVertShader), loadAsset(planeFragShader)); 94 | mPlaneBatch = gl::Batch::create(geom::Plane().normal(planeNormal).size(planeSize), mPlaneShader); 95 | 96 | float sphereRadius = 0.1f; 97 | int sphereResolution = 32; 98 | string sphereVertShader = "shaders/sphere_vert.glsl"; 99 | string sphereFragShader = "shaders/sphere_frag.glsl"; 100 | mSphereShader = gl::GlslProg::create(loadAsset(sphereVertShader), loadAsset(sphereFragShader)); 101 | mSphereBatch = gl::Batch::create(geom::Sphere().radius(sphereRadius).subdivisions(sphereResolution), mSphereShader); 102 | } 103 | 104 | void L04_Lighting_II::setupGUI() 105 | { 106 | mParamLightPosX = 0.0f; 107 | mParamLightPosY = 1.0f; 108 | mParamLightPosZ = -1.0f; 109 | mParamSpecularPower = 16.0f; 110 | mParamSpecularStrength = 2.0f; 111 | mParamAmbientStrength = 0.25f; 112 | mParamColor = Color(0.5f, 0.1f, 0.25f); 113 | 114 | mGUI = params::InterfaceGl::create("Params", ivec2(300, 300)); 115 | mGUI->addParam("mParamLightPosX", &mParamLightPosX).optionsStr("label='light x'"); 116 | mGUI->addParam("mParamLightPosY", &mParamLightPosY).optionsStr("label='light y'"); 117 | mGUI->addParam("mParamLightPosZ", &mParamLightPosZ).optionsStr("label='light z'"); 118 | mGUI->addParam("mParamSpecularPower", &mParamSpecularPower).optionsStr("label='specular power'"); 119 | mGUI->addParam("mParamSpecularStrength", &mParamSpecularStrength).optionsStr("label='specular strength'"); 120 | mGUI->addParam("mParamAmbientStrength)", &mParamAmbientStrength).optionsStr("label='ambient strength'"); 121 | mGUI->addParam("mParamColor", &mParamColor).optionsStr("label='color'"); 122 | } 123 | 124 | void L04_Lighting_II::mouseDown(MouseEvent event) 125 | { 126 | } 127 | 128 | void L04_Lighting_II::update() 129 | { 130 | } 131 | 132 | void L04_Lighting_II::draw() 133 | { 134 | gl::clear(Color(0, 0, 0)); 135 | gl::setMatrices(mCamera); 136 | gl::enableDepthRead(); 137 | mPlaneBatch->draw(); 138 | drawSphere(); 139 | gl::setMatricesWindow(getWindowSize()); 140 | gl::disableDepthRead(); 141 | mGUI->draw(); 142 | } 143 | 144 | void L04_Lighting_II::drawSphere() 145 | { 146 | gl::pushModelMatrix(); 147 | gl::translate(vec3(0, 0.1, 0)); 148 | mSphereBatch->getGlslProg()->uniform(mUniformEyePos, mCamera.getEyePoint()); 149 | mSphereBatch->getGlslProg()->uniform(mUniformLightPos, vec3(mParamLightPosX, mParamLightPosY, mParamLightPosZ)); 150 | mSphereBatch->getGlslProg()->uniform(mUniformSpecularPower, mParamSpecularPower); 151 | mSphereBatch->getGlslProg()->uniform(mUniformSpecularStrength, mParamSpecularStrength); 152 | mSphereBatch->getGlslProg()->uniform(mUniformAmbientStrength, mParamAmbientStrength); 153 | mSphereBatch->getGlslProg()->uniform(mUniformColor, mParamColor); 154 | mSphereBatch->draw(); 155 | gl::popModelMatrix(); 156 | } 157 | 158 | void prepareSettings(App::Settings *pSettings) 159 | { 160 | pSettings->setWindowSize(1280, 720); 161 | pSettings->setFrameRate(60); 162 | } 163 | 164 | CINDER_APP(L04_Lighting_II, RendererGl, prepareSettings) 165 | 166 | -------------------------------------------------------------------------------- /L04_Lighting_II/vc2013/L04_Lighting_II.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "L04_Lighting_II", "L04_Lighting_II.vcxproj", "{A899D708-F029-45F2-905C-B62E4D8BC13D}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x64 = Debug|x64 9 | Release|x64 = Release|x64 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {A899D708-F029-45F2-905C-B62E4D8BC13D}.Debug|x64.ActiveCfg = Debug|x64 13 | {A899D708-F029-45F2-905C-B62E4D8BC13D}.Debug|x64.Build.0 = Debug|x64 14 | {A899D708-F029-45F2-905C-B62E4D8BC13D}.Release|x64.ActiveCfg = Release|x64 15 | {A899D708-F029-45F2-905C-B62E4D8BC13D}.Release|x64.Build.0 = Release|x64 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /L04_Lighting_II/vc2013/L04_Lighting_II.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 15 | 16 | 17 | {a38235a0-6afe-449c-b967-ca7d0f08733c} 18 | 19 | 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Header Files 34 | 35 | 36 | 37 | 38 | Resource Files 39 | 40 | 41 | 42 | 43 | Source Files\shaders 44 | 45 | 46 | Source Files\shaders 47 | 48 | 49 | Source Files\shaders 50 | 51 | 52 | Source Files\shaders 53 | 54 | 55 | -------------------------------------------------------------------------------- /L04_Lighting_II/vc2013/Resources.rc: -------------------------------------------------------------------------------- 1 | #include "../include/Resources.h" 2 | 3 | 1 ICON "..\\resources\\cinder_app_icon.ico" 4 | -------------------------------------------------------------------------------- /L04_Lighting_II/xcode/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | CinderApp.icns 11 | CFBundleIdentifier 12 | org.libcinder.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2013 __MyCompanyName__. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /L04_Lighting_II/xcode/L04_Lighting_II_Prefix.pch: -------------------------------------------------------------------------------- 1 | #if defined( __cplusplus ) 2 | #include "cinder/Cinder.h" 3 | 4 | #include "cinder/app/App.h" 5 | 6 | #include "cinder/gl/gl.h" 7 | 8 | #include "cinder/CinderMath.h" 9 | #include "cinder/Matrix.h" 10 | #include "cinder/Vector.h" 11 | #include "cinder/Quaternion.h" 12 | #endif 13 | -------------------------------------------------------------------------------- /L05_Lighting_III/assets/shaders/plane_frag.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | 3 | out vec4 FragColor; 4 | 5 | void main() 6 | { 7 | FragColor = vec4(0.5,0.5,0.5,1.0); 8 | } -------------------------------------------------------------------------------- /L05_Lighting_III/assets/shaders/plane_vert.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform mat4 ciModelViewProjection; 3 | 4 | in vec4 ciPosition; 5 | 6 | void main() 7 | { 8 | gl_Position = ciModelViewProjection * ciPosition; 9 | } -------------------------------------------------------------------------------- /L05_Lighting_III/assets/shaders/shape_reflect_frag.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform samplerCube uCubemapSampler; 3 | uniform vec3 uCameraPos; 4 | uniform vec3 uLightPos; 5 | uniform vec3 uColor; 6 | uniform float uSpecularStrength; 7 | uniform float uSpecularPower; 8 | uniform float uAmbientStrength; 9 | uniform float uEnvStrength; 10 | 11 | in vec3 Normal; 12 | in vec3 WorldPos; 13 | 14 | out vec4 FragColor; 15 | 16 | void main() 17 | { 18 | vec3 normal = normalize(Normal); 19 | vec3 lightDirection = normalize(uLightPos-WorldPos); 20 | vec3 viewDirection = normalize(uCameraPos-WorldPos); 21 | vec3 reflectDirection = normalize(WorldPos-uCameraPos); 22 | vec3 specularLookup = reflect(viewDirection, normal); 23 | vec3 reflLookup = reflect(reflectDirection, normal); 24 | 25 | vec4 refl = texture(uCubemapSampler, reflLookup)*uEnvStrength; 26 | vec3 diffuse = uColor*max(dot(normal,lightDirection), 0.0); 27 | vec3 ambient = uColor*uAmbientStrength; 28 | float specular = pow(max(dot(-lightDirection, specularLookup),0.0), uSpecularPower)*uSpecularStrength; 29 | 30 | FragColor = vec4(diffuse+specular+ambient+refl.rgb,1.0); 31 | } -------------------------------------------------------------------------------- /L05_Lighting_III/assets/shaders/shape_refract_frag.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform samplerCube uCubemapSampler; 3 | uniform vec3 uCameraPos; 4 | uniform vec3 uLightPos; 5 | uniform vec3 uColor; 6 | uniform float uSpecularStrength; 7 | uniform float uSpecularPower; 8 | uniform float uAmbientStrength; 9 | uniform float uEnvStrength; 10 | uniform float uRefract; 11 | 12 | in vec3 Normal; 13 | in vec3 WorldPos; 14 | 15 | out vec4 FragColor; 16 | 17 | void main() 18 | { 19 | vec3 normal = normalize(Normal); 20 | vec3 lightDirection = normalize(uLightPos-WorldPos); 21 | vec3 viewDirection = normalize(uCameraPos-WorldPos); 22 | vec3 specularLookup = reflect(viewDirection, normal); 23 | vec3 refrLookup = refract(normal, viewDirection, 1.0/uRefract); 24 | 25 | 26 | vec4 refr = texture(uCubemapSampler, refrLookup)*uEnvStrength; 27 | vec3 diffuse = uColor*max(dot(normal,lightDirection), 0.0); 28 | vec3 ambient = uColor*uAmbientStrength; 29 | float specular = pow(max(dot(-lightDirection, specularLookup),0.0), uSpecularPower)*uSpecularStrength; 30 | 31 | FragColor = vec4(diffuse+specular+ambient+refr.rgb,1.0); 32 | } -------------------------------------------------------------------------------- /L05_Lighting_III/assets/shaders/shape_vert.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform mat4 ciModelViewProjection; 3 | uniform mat4 ciNormalMatrix; 4 | uniform mat4 ciModelMatrix; 5 | 6 | in vec4 ciPosition; 7 | in vec4 ciNormal; 8 | 9 | out vec3 Normal; 10 | out vec3 WorldPos; 11 | 12 | void main() 13 | { 14 | WorldPos = vec3(ciModelMatrix*ciPosition); 15 | Normal = vec3(ciModelMatrix*ciNormal); 16 | gl_Position = ciModelViewProjection * ciPosition; 17 | } -------------------------------------------------------------------------------- /L05_Lighting_III/assets/shaders/skybox_frag.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform samplerCube uCubemapSampler; 3 | 4 | in vec3 LookupVector; 5 | 6 | out vec4 FragColor; 7 | 8 | void main() 9 | { 10 | FragColor = texture(uCubemapSampler, LookupVector); 11 | } -------------------------------------------------------------------------------- /L05_Lighting_III/assets/shaders/skybox_vert.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform mat4 ciViewMatrix; 3 | uniform mat4 ciProjectionMatrix; 4 | 5 | in vec4 ciPosition; 6 | out vec3 LookupVector; 7 | 8 | void main() 9 | { 10 | LookupVector = vec3(ciPosition); 11 | gl_Position = ciProjectionMatrix*mat4(mat3(ciViewMatrix))*ciPosition; 12 | gl_Position = gl_Position.xyww; 13 | } -------------------------------------------------------------------------------- /L05_Lighting_III/assets/textures/skybox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SethGibson/LearnCinderGL/3ab8fb94b6961e3d43e132e1d48c35f22c07cae0/L05_Lighting_III/assets/textures/skybox.png -------------------------------------------------------------------------------- /L05_Lighting_III/include/Resources.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "cinder/CinderResources.h" 3 | 4 | //#define RES_MY_RES CINDER_RESOURCE( ../resources/, image_name.png, 128, IMAGE ) 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /L05_Lighting_III/resources/CinderApp.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SethGibson/LearnCinderGL/3ab8fb94b6961e3d43e132e1d48c35f22c07cae0/L05_Lighting_III/resources/CinderApp.icns -------------------------------------------------------------------------------- /L05_Lighting_III/resources/cinder_app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SethGibson/LearnCinderGL/3ab8fb94b6961e3d43e132e1d48c35f22c07cae0/L05_Lighting_III/resources/cinder_app_icon.ico -------------------------------------------------------------------------------- /L05_Lighting_III/src/L05_Lighting_IIIApp.h: -------------------------------------------------------------------------------- 1 | /* 2 | Lesson 05: In Which We Learn about cubemaps, environment mapping, "advanced" params, and different way to use shaders 3 | Topics Covered: 4 | Loading and working with cubemaps/textures 5 | Reflection and refraction mapping 6 | Direct shader binding 7 | Enumerated parameters 8 | */ 9 | 10 | #ifndef _L05_H_ 11 | #define _L05_H_ 12 | #include "cinder/app/App.h" 13 | #include "cinder/app/RendererGl.h" 14 | #include "cinder/Camera.h" 15 | #include "cinder/CameraUi.h" 16 | #include "cinder/gl/gl.h" 17 | #include "cinder/gl/Batch.h" 18 | #include "cinder/gl/GlslProg.h" 19 | #include "cinder/params/Params.h" 20 | 21 | using namespace ci; 22 | using namespace ci::app; 23 | using namespace std; 24 | 25 | class L05_Lighting_III : public App 26 | { 27 | public: 28 | void setup() override; 29 | void mouseDown(MouseEvent event) override; 30 | void update() override; 31 | void draw() override; 32 | 33 | private: 34 | void setupCamera(); 35 | void setupScene(); 36 | void setupGUI(); 37 | void setupSkybox(); 38 | 39 | void drawScene(); 40 | void drawSkybox(); 41 | 42 | CameraPersp mCamera; 43 | CameraUi mCameraCtrl; 44 | 45 | gl::BatchRef mPlaneBatch; 46 | gl::GlslProgRef mPlaneShader; 47 | 48 | gl::BatchRef mSphereBatch; 49 | gl::GlslProgRef mSphereShader; 50 | vec3 mSpherePosition; 51 | 52 | gl::BatchRef mTorusBatch; 53 | gl::GlslProgRef mTorusShader; 54 | vec3 mTorusPosition; 55 | 56 | string mUniformLightPos = "uLightPos"; 57 | string mUniformEyePos = "uCameraPos"; 58 | string mUniformSpecularPower = "uSpecularPower"; 59 | string mUniformSpecularStrength = "uSpecularStrength"; 60 | string mUniformAmbientStrength = "uAmbientStrength"; 61 | string mUniformEnvStrength = "uEnvStrength"; 62 | string mUniformColor = "uColor"; 63 | string mUniformRefract = "uRefract"; 64 | 65 | gl::BatchRef mSkyboxBatch; 66 | gl::GlslProgRef mSkyboxShader; 67 | gl::TextureCubeMapRef mSkyboxCubemap; 68 | 69 | params::InterfaceGlRef mGUI; 70 | float mParamLightPosX, 71 | mParamLightPosY, 72 | mParamLightPosZ; 73 | 74 | float mParamSphereSpecularPower, 75 | mParamSphereSpecularStrength, 76 | mParamSphereAmbientStrength, 77 | mParamSphereEnvStrength; 78 | 79 | vector mParamTorusRefractIndices; 80 | vector mParamTorusRefractNames; 81 | int mParamTorusRefractId; 82 | 83 | float mParamTorusSpecularPower, 84 | mParamTorusSpecularStrength, 85 | mParamTorusAmbientStrength, 86 | mParamTorusEnvStrength; 87 | 88 | Color mParamSphereColor, 89 | mParamTorusColor; 90 | }; 91 | #endif -------------------------------------------------------------------------------- /L05_Lighting_III/vc2013/L05_Lighting_III.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "L05_Lighting_III", "L05_Lighting_III.vcxproj", "{4AC1E592-9CC3-42A0-873D-B1FBB3AC107B}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x64 = Debug|x64 9 | Release|x64 = Release|x64 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {4AC1E592-9CC3-42A0-873D-B1FBB3AC107B}.Debug|x64.ActiveCfg = Debug|x64 13 | {4AC1E592-9CC3-42A0-873D-B1FBB3AC107B}.Debug|x64.Build.0 = Debug|x64 14 | {4AC1E592-9CC3-42A0-873D-B1FBB3AC107B}.Release|x64.ActiveCfg = Release|x64 15 | {4AC1E592-9CC3-42A0-873D-B1FBB3AC107B}.Release|x64.Build.0 = Release|x64 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /L05_Lighting_III/vc2013/L05_Lighting_III.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 15 | 16 | 17 | {4d80f8f1-5566-4d6b-b32c-aa1d437f3365} 18 | 19 | 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Header Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | 40 | 41 | Resource Files 42 | 43 | 44 | 45 | 46 | Source Files\shaders 47 | 48 | 49 | Source Files\shaders 50 | 51 | 52 | Source Files\shaders 53 | 54 | 55 | Source Files\shaders 56 | 57 | 58 | Source Files\shaders 59 | 60 | 61 | -------------------------------------------------------------------------------- /L05_Lighting_III/vc2013/Resources.rc: -------------------------------------------------------------------------------- 1 | #include "../include/Resources.h" 2 | 3 | 1 ICON "..\\resources\\cinder_app_icon.ico" 4 | -------------------------------------------------------------------------------- /L05_Lighting_III/xcode/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | CinderApp.icns 11 | CFBundleIdentifier 12 | org.libcinder.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2013 __MyCompanyName__. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /L05_Lighting_III/xcode/L05_Lighting_III_Prefix.pch: -------------------------------------------------------------------------------- 1 | #if defined( __cplusplus ) 2 | #include "cinder/Cinder.h" 3 | 4 | #include "cinder/app/App.h" 5 | 6 | #include "cinder/gl/gl.h" 7 | 8 | #include "cinder/CinderMath.h" 9 | #include "cinder/Matrix.h" 10 | #include "cinder/Vector.h" 11 | #include "cinder/Quaternion.h" 12 | #endif 13 | -------------------------------------------------------------------------------- /L06_Instancing/assets/shaders/shape_reflect_frag.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform samplerCube uCubemapSampler; 3 | uniform vec3 uCameraPos; 4 | uniform vec3 uLightPos; 5 | uniform vec3 uColor; 6 | uniform float uSpecularStrength; 7 | uniform float uSpecularPower; 8 | uniform float uAmbientStrength; 9 | uniform float uEnvStrength; 10 | 11 | in vec3 Normal; 12 | in vec3 WorldPos; 13 | 14 | out vec4 FragColor; 15 | 16 | void main() 17 | { 18 | vec3 normal = normalize(Normal); 19 | vec3 lightDirection = normalize(uLightPos-WorldPos); 20 | vec3 viewDirection = normalize(uCameraPos-WorldPos); 21 | vec3 reflectDirection = normalize(WorldPos-uCameraPos); 22 | vec3 specularLookup = reflect(viewDirection, normal); 23 | vec3 reflLookup = reflect(reflectDirection, normal); 24 | 25 | vec4 refl = texture(uCubemapSampler, reflLookup)*uEnvStrength; 26 | vec3 diffuse = uColor*max(dot(normal,lightDirection), 0.0); 27 | vec3 ambient = uColor*uAmbientStrength; 28 | float specular = pow(max(dot(-lightDirection, specularLookup),0.0), uSpecularPower)*uSpecularStrength; 29 | 30 | FragColor = vec4(diffuse+specular+ambient+refl.rgb,1.0); 31 | } -------------------------------------------------------------------------------- /L06_Instancing/assets/shaders/shape_refract_frag.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform samplerCube uCubemapSampler; 3 | uniform vec3 uCameraPos; 4 | uniform vec3 uLightPos; 5 | uniform vec3 uColor; 6 | uniform float uSpecularStrength; 7 | uniform float uSpecularPower; 8 | uniform float uAmbientStrength; 9 | uniform float uEnvStrength; 10 | uniform float uRefract; 11 | 12 | in vec3 Normal; 13 | in vec3 WorldPos; 14 | 15 | out vec4 FragColor; 16 | 17 | void main() 18 | { 19 | vec3 normal = normalize(Normal); 20 | vec3 lightDirection = normalize(uLightPos-WorldPos); 21 | vec3 viewDirection = normalize(uCameraPos-WorldPos); 22 | vec3 specularLookup = reflect(viewDirection, normal); 23 | vec3 refrLookup = refract(normal, viewDirection, 1.0/uRefract); 24 | 25 | 26 | vec4 refr = texture(uCubemapSampler, refrLookup)*uEnvStrength; 27 | vec3 diffuse = uColor*max(dot(normal,lightDirection), 0.0); 28 | vec3 ambient = uColor*uAmbientStrength; 29 | float specular = pow(max(dot(-lightDirection, specularLookup),0.0), uSpecularPower)*uSpecularStrength; 30 | 31 | FragColor = vec4(diffuse+specular+ambient+refr.rgb,1.0); 32 | } -------------------------------------------------------------------------------- /L06_Instancing/assets/shaders/shape_vert.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform mat4 ciModelMatrix; 3 | uniform mat4 ciViewMatrix; 4 | uniform mat4 ciProjectionMatrix; 5 | uniform mat4 ciNormalMatrix; 6 | 7 | in vec4 ciPosition; 8 | in vec4 ciNormal; 9 | 10 | in vec3 iPosition; 11 | 12 | out vec3 Normal; 13 | out vec3 WorldPos; 14 | 15 | void main() 16 | { 17 | mat4 normalMatrix = transpose(inverse(ciModelMatrix)); 18 | WorldPos = vec3(ciModelMatrix*ciPosition); 19 | Normal = vec3(normalMatrix*ciNormal); 20 | gl_Position = ciProjectionMatrix*ciViewMatrix*ciModelMatrix * (ciPosition+vec4(iPosition,1.0)); 21 | } -------------------------------------------------------------------------------- /L06_Instancing/assets/shaders/skybox_frag.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform samplerCube uCubemapSampler; 3 | 4 | in vec3 LookupVector; 5 | 6 | out vec4 FragColor; 7 | 8 | void main() 9 | { 10 | FragColor = texture(uCubemapSampler, LookupVector); 11 | } -------------------------------------------------------------------------------- /L06_Instancing/assets/shaders/skybox_vert.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform mat4 ciViewMatrix; 3 | uniform mat4 ciProjectionMatrix; 4 | 5 | in vec4 ciPosition; 6 | out vec3 LookupVector; 7 | 8 | void main() 9 | { 10 | LookupVector = vec3(ciPosition); 11 | gl_Position = ciProjectionMatrix*mat4(mat3(ciViewMatrix))*ciPosition; 12 | gl_Position = gl_Position.xyww; 13 | } -------------------------------------------------------------------------------- /L06_Instancing/assets/textures/skybox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SethGibson/LearnCinderGL/3ab8fb94b6961e3d43e132e1d48c35f22c07cae0/L06_Instancing/assets/textures/skybox.png -------------------------------------------------------------------------------- /L06_Instancing/include/Resources.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "cinder/CinderResources.h" 3 | 4 | //#define RES_MY_RES CINDER_RESOURCE( ../resources/, image_name.png, 128, IMAGE ) 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /L06_Instancing/resources/CinderApp.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SethGibson/LearnCinderGL/3ab8fb94b6961e3d43e132e1d48c35f22c07cae0/L06_Instancing/resources/CinderApp.icns -------------------------------------------------------------------------------- /L06_Instancing/resources/cinder_app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SethGibson/LearnCinderGL/3ab8fb94b6961e3d43e132e1d48c35f22c07cae0/L06_Instancing/resources/cinder_app_icon.ico -------------------------------------------------------------------------------- /L06_Instancing/src/L06_InstancingApp.h: -------------------------------------------------------------------------------- 1 | /* 2 | Lesson 06: In Which We Learn about instancing, i.e. defining a model once and drawing it multiple times with different attributes 3 | Topics Covered: 4 | Instancing 5 | Cinder Vertex Buffer Objects 6 | Cinder Mesh Objects 7 | Cinder Attribute Mapping 8 | */ 9 | #ifndef _L06_H_ 10 | #define _L06_H_ 11 | #include "cinder/app/App.h" 12 | #include "cinder/app/RendererGl.h" 13 | #include "cinder/Camera.h" 14 | #include "cinder/CameraUi.h" 15 | #include "cinder/gl/gl.h" 16 | #include "cinder/gl/Batch.h" 17 | #include "cinder/gl/GlslProg.h" 18 | #include "cinder/params/Params.h" 19 | 20 | using namespace ci; 21 | using namespace ci::app; 22 | using namespace std; 23 | 24 | class L06_Instancing : public App 25 | { 26 | public: 27 | void setup() override; 28 | void mouseDown(MouseEvent event) override; 29 | void update() override; 30 | void draw() override; 31 | 32 | private: 33 | void setupCamera(); 34 | void setupSpheres(int numElements); 35 | void setupTorii(int numElements); 36 | void setupGUI(); 37 | void setupSkybox(); 38 | 39 | void drawScene(); 40 | void drawSkybox(); 41 | 42 | CameraPersp mCamera; 43 | CameraUi mCameraCtrl; 44 | 45 | gl::BatchRef mPlaneBatch; 46 | gl::GlslProgRef mPlaneShader; 47 | 48 | gl::BatchRef mSphereBatch; 49 | gl::GlslProgRef mSphereShader; 50 | gl::VboRef mSphereInstanceData; 51 | gl::VboMeshRef mSphereMeshData; 52 | int mNumSpheres; 53 | 54 | gl::BatchRef mTorusBatch; 55 | gl::GlslProgRef mTorusShader; 56 | gl::VboRef mTorusInstanceData; 57 | gl::VboMeshRef mTorusMeshData; 58 | int mNumTorii; 59 | 60 | const string mUniformLightPos = "uLightPos"; 61 | const string mUniformEyePos = "uCameraPos"; 62 | const string mUniformSpecularPower = "uSpecularPower"; 63 | const string mUniformSpecularStrength = "uSpecularStrength"; 64 | const string mUniformAmbientStrength = "uAmbientStrength"; 65 | const string mUniformEnvStrength = "uEnvStrength"; 66 | const string mUniformColor = "uColor"; 67 | const string mUniformRefract = "uRefract"; 68 | 69 | gl::BatchRef mSkyboxBatch; 70 | gl::GlslProgRef mSkyboxShader; 71 | gl::TextureCubeMapRef mSkyboxCubemap; 72 | 73 | params::InterfaceGlRef mGUI; 74 | float mParamLightPosX, 75 | mParamLightPosY, 76 | mParamLightPosZ; 77 | 78 | float mParamSphereSpecularPower, 79 | mParamSphereSpecularStrength, 80 | mParamSphereAmbientStrength, 81 | mParamSphereEnvStrength; 82 | 83 | vector mParamTorusRefractIndices; 84 | vector mParamTorusRefractNames; 85 | int mParamTorusRefractId; 86 | 87 | float mParamTorusSpecularPower, 88 | mParamTorusSpecularStrength, 89 | mParamTorusAmbientStrength, 90 | mParamTorusEnvStrength; 91 | 92 | Color mParamSphereColor, 93 | mParamTorusColor; 94 | }; 95 | #endif -------------------------------------------------------------------------------- /L06_Instancing/vc2013/L06_Instancing.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "L06_Instancing", "L06_Instancing.vcxproj", "{713D8346-EAF2-483F-A811-9F8E8812F2F2}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x64 = Debug|x64 9 | Release|x64 = Release|x64 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {713D8346-EAF2-483F-A811-9F8E8812F2F2}.Debug|x64.ActiveCfg = Debug|x64 13 | {713D8346-EAF2-483F-A811-9F8E8812F2F2}.Debug|x64.Build.0 = Debug|x64 14 | {713D8346-EAF2-483F-A811-9F8E8812F2F2}.Release|x64.ActiveCfg = Release|x64 15 | {713D8346-EAF2-483F-A811-9F8E8812F2F2}.Release|x64.Build.0 = Release|x64 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /L06_Instancing/vc2013/L06_Instancing.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 15 | 16 | 17 | {610b72a5-a337-4b90-875a-94f65aae42d3} 18 | 19 | 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Header Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | 40 | 41 | Resource Files 42 | 43 | 44 | 45 | 46 | Source Files\shaders 47 | 48 | 49 | Source Files\shaders 50 | 51 | 52 | Source Files\shaders 53 | 54 | 55 | Source Files\shaders 56 | 57 | 58 | Source Files\shaders 59 | 60 | 61 | -------------------------------------------------------------------------------- /L06_Instancing/vc2013/Resources.rc: -------------------------------------------------------------------------------- 1 | #include "../include/Resources.h" 2 | 3 | 1 ICON "..\\resources\\cinder_app_icon.ico" 4 | -------------------------------------------------------------------------------- /L06_Instancing/xcode/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | CinderApp.icns 11 | CFBundleIdentifier 12 | org.libcinder.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2013 __MyCompanyName__. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /L06_Instancing/xcode/L06_Instancing_Prefix.pch: -------------------------------------------------------------------------------- 1 | #if defined( __cplusplus ) 2 | #include "cinder/Cinder.h" 3 | 4 | #include "cinder/app/App.h" 5 | 6 | #include "cinder/gl/gl.h" 7 | 8 | #include "cinder/CinderMath.h" 9 | #include "cinder/Matrix.h" 10 | #include "cinder/Vector.h" 11 | #include "cinder/Quaternion.h" 12 | #endif 13 | -------------------------------------------------------------------------------- /L07_Motion_I/assets/shaders/shape_reflect_frag.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform samplerCube uCubemapSampler; 3 | uniform vec3 uCameraPos; 4 | uniform vec3 uLightPos; 5 | uniform vec3 uColor; 6 | uniform float uSpecularStrength; 7 | uniform float uSpecularPower; 8 | uniform float uAmbientStrength; 9 | uniform float uEnvStrength; 10 | 11 | in vec3 Normal; 12 | in vec3 WorldPos; 13 | 14 | out vec4 FragColor; 15 | 16 | void main() 17 | { 18 | vec3 normal = normalize(Normal); 19 | vec3 lightDirection = normalize(uLightPos-WorldPos); 20 | vec3 viewDirection = normalize(uCameraPos-WorldPos); 21 | vec3 reflectDirection = normalize(WorldPos-uCameraPos); 22 | vec3 specularLookup = reflect(viewDirection, normal); 23 | vec3 reflLookup = reflect(reflectDirection, normal); 24 | 25 | vec4 refl = texture(uCubemapSampler, reflLookup)*uEnvStrength; 26 | vec3 diffuse = uColor*max(dot(normal,lightDirection), 0.0); 27 | vec3 ambient = uColor*uAmbientStrength; 28 | float specular = pow(max(dot(-lightDirection, specularLookup),0.0), uSpecularPower)*uSpecularStrength; 29 | 30 | FragColor = vec4(diffuse+specular+ambient+refl.rgb,1.0); 31 | } -------------------------------------------------------------------------------- /L07_Motion_I/assets/shaders/shape_refract_frag.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform samplerCube uCubemapSampler; 3 | uniform vec3 uCameraPos; 4 | uniform vec3 uLightPos; 5 | uniform vec3 uColor; 6 | uniform float uSpecularStrength; 7 | uniform float uSpecularPower; 8 | uniform float uAmbientStrength; 9 | uniform float uEnvStrength; 10 | uniform float uRefract; 11 | 12 | in vec3 Normal; 13 | in vec3 WorldPos; 14 | 15 | out vec4 FragColor; 16 | 17 | void main() 18 | { 19 | vec3 normal = normalize(Normal); 20 | vec3 lightDirection = normalize(uLightPos-WorldPos); 21 | vec3 viewDirection = normalize(uCameraPos-WorldPos); 22 | vec3 specularLookup = reflect(viewDirection, normal); 23 | vec3 refrLookup = refract(normal, viewDirection, 1.0/uRefract); 24 | 25 | 26 | vec4 refr = texture(uCubemapSampler, refrLookup)*uEnvStrength; 27 | vec3 diffuse = uColor*max(dot(normal,lightDirection), 0.0); 28 | vec3 ambient = uColor*uAmbientStrength; 29 | float specular = pow(max(dot(-lightDirection, specularLookup),0.0), uSpecularPower)*uSpecularStrength; 30 | 31 | FragColor = vec4(diffuse+specular+ambient+refr.rgb,1.0); 32 | } -------------------------------------------------------------------------------- /L07_Motion_I/assets/shaders/shape_vert.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform mat4 ciModelMatrix; 3 | uniform mat4 ciViewMatrix; 4 | uniform mat4 ciProjectionMatrix; 5 | uniform mat4 ciNormalMatrix; 6 | 7 | in vec4 ciPosition; 8 | in vec4 ciNormal; 9 | 10 | in vec3 iPosition; 11 | 12 | out vec3 Normal; 13 | out vec3 WorldPos; 14 | 15 | void main() 16 | { 17 | mat4 normalMatrix = transpose(inverse(ciModelMatrix)); 18 | WorldPos = vec3(ciModelMatrix*ciPosition); 19 | Normal = vec3(normalMatrix*ciNormal); 20 | gl_Position = ciProjectionMatrix*ciViewMatrix*ciModelMatrix * (ciPosition+vec4(iPosition,1.0)); 21 | } -------------------------------------------------------------------------------- /L07_Motion_I/assets/shaders/skybox_frag.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform samplerCube uCubemapSampler; 3 | 4 | in vec3 LookupVector; 5 | 6 | out vec4 FragColor; 7 | 8 | void main() 9 | { 10 | FragColor = texture(uCubemapSampler, LookupVector); 11 | } -------------------------------------------------------------------------------- /L07_Motion_I/assets/shaders/skybox_vert.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform mat4 ciViewMatrix; 3 | uniform mat4 ciProjectionMatrix; 4 | 5 | in vec4 ciPosition; 6 | out vec3 LookupVector; 7 | 8 | void main() 9 | { 10 | LookupVector = vec3(ciPosition); 11 | gl_Position = ciProjectionMatrix*mat4(mat3(ciViewMatrix))*ciPosition; 12 | gl_Position = gl_Position.xyww; 13 | } -------------------------------------------------------------------------------- /L07_Motion_I/assets/textures/skybox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SethGibson/LearnCinderGL/3ab8fb94b6961e3d43e132e1d48c35f22c07cae0/L07_Motion_I/assets/textures/skybox.png -------------------------------------------------------------------------------- /L07_Motion_I/include/Resources.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "cinder/CinderResources.h" 3 | 4 | //#define RES_MY_RES CINDER_RESOURCE( ../resources/, image_name.png, 128, IMAGE ) 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /L07_Motion_I/resources/CinderApp.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SethGibson/LearnCinderGL/3ab8fb94b6961e3d43e132e1d48c35f22c07cae0/L07_Motion_I/resources/CinderApp.icns -------------------------------------------------------------------------------- /L07_Motion_I/resources/cinder_app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SethGibson/LearnCinderGL/3ab8fb94b6961e3d43e132e1d48c35f22c07cae0/L07_Motion_I/resources/cinder_app_icon.ico -------------------------------------------------------------------------------- /L07_Motion_I/src/L07_Motion_IApp.h: -------------------------------------------------------------------------------- 1 | /* 2 | Lesson 07: In Which We Learn how to add simple animation to our objects 3 | Topics Covered: 4 | glm::rotate 5 | */ 6 | 7 | #ifndef _L07_H_ 8 | #define _L07_H_ 9 | #include "cinder/app/App.h" 10 | #include "cinder/app/RendererGl.h" 11 | #include "cinder/Camera.h" 12 | #include "cinder/CameraUi.h" 13 | #include "cinder/gl/gl.h" 14 | #include "cinder/gl/Batch.h" 15 | #include "cinder/gl/GlslProg.h" 16 | #include "cinder/params/Params.h" 17 | 18 | using namespace ci; 19 | using namespace ci::app; 20 | using namespace std; 21 | 22 | class L07_Motion_I : public App 23 | { 24 | public: 25 | void setup() override; 26 | void mouseDown(MouseEvent event) override; 27 | void update() override; 28 | void draw() override; 29 | 30 | private: 31 | 32 | void setupCamera(); 33 | void setupSpheres(int numElements); 34 | void setupTorii(int numElements); 35 | void setupGUI(); 36 | void setupSkybox(); 37 | 38 | void drawScene(); 39 | void drawSkybox(); 40 | 41 | CameraPersp mCamera; 42 | CameraUi mCameraCtrl; 43 | 44 | gl::BatchRef mPlaneBatch; 45 | gl::GlslProgRef mPlaneShader; 46 | 47 | gl::BatchRef mSphereBatch; 48 | gl::GlslProgRef mSphereShader; 49 | gl::VboRef mSphereInstanceData; 50 | gl::VboMeshRef mSphereMeshData; 51 | int mNumSpheres; 52 | 53 | gl::BatchRef mTorusBatch; 54 | gl::GlslProgRef mTorusShader; 55 | gl::VboRef mTorusInstanceData; 56 | gl::VboMeshRef mTorusMeshData; 57 | int mNumTorii; 58 | 59 | const string mUniformLightPos = "uLightPos"; 60 | const string mUniformEyePos = "uCameraPos"; 61 | const string mUniformSpecularPower = "uSpecularPower"; 62 | const string mUniformSpecularStrength = "uSpecularStrength"; 63 | const string mUniformAmbientStrength = "uAmbientStrength"; 64 | const string mUniformEnvStrength = "uEnvStrength"; 65 | const string mUniformColor = "uColor"; 66 | const string mUniformRefract = "uRefract"; 67 | 68 | gl::BatchRef mSkyboxBatch; 69 | gl::GlslProgRef mSkyboxShader; 70 | gl::TextureCubeMapRef mSkyboxCubemap; 71 | 72 | params::InterfaceGlRef mGUI; 73 | float mParamLightPosX, 74 | mParamLightPosY, 75 | mParamLightPosZ; 76 | 77 | float mParamSphereSpecularPower, 78 | mParamSphereSpecularStrength, 79 | mParamSphereAmbientStrength, 80 | mParamSphereEnvStrength; 81 | 82 | vector mParamTorusRefractIndices; 83 | vector mParamTorusRefractNames; 84 | int mParamTorusRefractId; 85 | 86 | float mParamTorusSpecularPower, 87 | mParamTorusSpecularStrength, 88 | mParamTorusAmbientStrength, 89 | mParamTorusEnvStrength; 90 | 91 | Color mParamSphereColor, 92 | mParamTorusColor; 93 | }; 94 | #endif -------------------------------------------------------------------------------- /L07_Motion_I/vc2013/L07_Motion_I.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "L07_Motion_I", "L07_Motion_I.vcxproj", "{585F9348-63A1-4917-998D-378E9802EF86}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x64 = Debug|x64 9 | Release|x64 = Release|x64 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {585F9348-63A1-4917-998D-378E9802EF86}.Debug|x64.ActiveCfg = Debug|x64 13 | {585F9348-63A1-4917-998D-378E9802EF86}.Debug|x64.Build.0 = Debug|x64 14 | {585F9348-63A1-4917-998D-378E9802EF86}.Release|x64.ActiveCfg = Release|x64 15 | {585F9348-63A1-4917-998D-378E9802EF86}.Release|x64.Build.0 = Release|x64 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /L07_Motion_I/vc2013/L07_Motion_I.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | 29 | 30 | Header Files 31 | 32 | 33 | Source Files 34 | 35 | 36 | 37 | 38 | Resource Files 39 | 40 | 41 | -------------------------------------------------------------------------------- /L07_Motion_I/vc2013/Resources.rc: -------------------------------------------------------------------------------- 1 | #include "../include/Resources.h" 2 | 3 | 1 ICON "..\\resources\\cinder_app_icon.ico" 4 | -------------------------------------------------------------------------------- /L07_Motion_I/xcode/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | CinderApp.icns 11 | CFBundleIdentifier 12 | org.libcinder.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2013 __MyCompanyName__. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /L07_Motion_I/xcode/L07_Motion_I_Prefix.pch: -------------------------------------------------------------------------------- 1 | #if defined( __cplusplus ) 2 | #include "cinder/Cinder.h" 3 | 4 | #include "cinder/app/App.h" 5 | 6 | #include "cinder/gl/gl.h" 7 | 8 | #include "cinder/CinderMath.h" 9 | #include "cinder/Matrix.h" 10 | #include "cinder/Vector.h" 11 | #include "cinder/Quaternion.h" 12 | #endif 13 | -------------------------------------------------------------------------------- /L08_Motion_II/assets/shaders/shape_reflect_frag.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform samplerCube uCubemapSampler; 3 | uniform vec3 uCameraPos; 4 | uniform vec3 uLightPos; 5 | uniform vec3 uColor; 6 | uniform float uSpecularStrength; 7 | uniform float uSpecularPower; 8 | uniform float uAmbientStrength; 9 | uniform float uEnvStrength; 10 | 11 | in vec3 Normal; 12 | in vec3 WorldPos; 13 | 14 | out vec4 FragColor; 15 | 16 | void main() 17 | { 18 | vec3 normal = normalize(Normal); 19 | vec3 lightDirection = normalize(uLightPos-WorldPos); 20 | vec3 viewDirection = normalize(uCameraPos-WorldPos); 21 | vec3 reflectDirection = normalize(WorldPos-uCameraPos); 22 | vec3 specularLookup = reflect(viewDirection, normal); 23 | vec3 reflLookup = reflect(reflectDirection, normal); 24 | 25 | vec4 refl = texture(uCubemapSampler, reflLookup)*uEnvStrength; 26 | vec3 diffuse = uColor*max(dot(normal,lightDirection), 0.0); 27 | vec3 ambient = uColor*uAmbientStrength; 28 | float specular = pow(max(dot(-lightDirection, specularLookup),0.0), uSpecularPower)*uSpecularStrength; 29 | 30 | FragColor = vec4(diffuse+specular+ambient+refl.rgb,1.0); 31 | } -------------------------------------------------------------------------------- /L08_Motion_II/assets/shaders/shape_refract_frag.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform samplerCube uCubemapSampler; 3 | uniform vec3 uCameraPos; 4 | uniform vec3 uLightPos; 5 | uniform vec3 uColor; 6 | uniform float uSpecularStrength; 7 | uniform float uSpecularPower; 8 | uniform float uAmbientStrength; 9 | uniform float uEnvStrength; 10 | uniform float uRefract; 11 | 12 | in vec3 Normal; 13 | in vec3 WorldPos; 14 | 15 | out vec4 FragColor; 16 | 17 | void main() 18 | { 19 | vec3 normal = normalize(Normal); 20 | vec3 lightDirection = normalize(uLightPos-WorldPos); 21 | vec3 viewDirection = normalize(uCameraPos-WorldPos); 22 | vec3 specularLookup = reflect(viewDirection, normal); 23 | vec3 refrLookup = refract(normal, viewDirection, 1.0/uRefract); 24 | 25 | 26 | vec4 refr = texture(uCubemapSampler, refrLookup)*uEnvStrength; 27 | vec3 diffuse = uColor*max(dot(normal,lightDirection), 0.0); 28 | vec3 ambient = uColor*uAmbientStrength; 29 | float specular = pow(max(dot(-lightDirection, specularLookup),0.0), uSpecularPower)*uSpecularStrength; 30 | 31 | FragColor = vec4(diffuse+specular+ambient+refr.rgb,1.0); 32 | } -------------------------------------------------------------------------------- /L08_Motion_II/assets/shaders/shape_vert.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform mat4 ciModelMatrix; 3 | uniform mat4 ciViewMatrix; 4 | uniform mat4 ciProjectionMatrix; 5 | uniform mat4 ciNormalMatrix; 6 | 7 | in vec4 ciPosition; 8 | in vec4 ciNormal; 9 | 10 | in vec3 iPosition; 11 | 12 | out vec3 Normal; 13 | out vec3 WorldPos; 14 | 15 | void main() 16 | { 17 | mat4 normalMatrix = transpose(inverse(ciModelMatrix)); 18 | WorldPos = vec3(ciModelMatrix*ciPosition); 19 | Normal = vec3(normalMatrix*ciNormal); 20 | gl_Position = ciProjectionMatrix*ciViewMatrix*ciModelMatrix * (ciPosition+vec4(iPosition,1.0)); 21 | } -------------------------------------------------------------------------------- /L08_Motion_II/assets/shaders/skybox_frag.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform samplerCube uCubemapSampler; 3 | 4 | in vec3 LookupVector; 5 | 6 | out vec4 FragColor; 7 | 8 | void main() 9 | { 10 | FragColor = texture(uCubemapSampler, LookupVector); 11 | } -------------------------------------------------------------------------------- /L08_Motion_II/assets/shaders/skybox_vert.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform mat4 ciViewMatrix; 3 | uniform mat4 ciProjectionMatrix; 4 | 5 | in vec4 ciPosition; 6 | out vec3 LookupVector; 7 | 8 | void main() 9 | { 10 | LookupVector = vec3(ciPosition); 11 | gl_Position = ciProjectionMatrix*mat4(mat3(ciViewMatrix))*ciPosition; 12 | gl_Position = gl_Position.xyww; 13 | } -------------------------------------------------------------------------------- /L08_Motion_II/assets/textures/skybox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SethGibson/LearnCinderGL/3ab8fb94b6961e3d43e132e1d48c35f22c07cae0/L08_Motion_II/assets/textures/skybox.png -------------------------------------------------------------------------------- /L08_Motion_II/include/Resources.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "cinder/CinderResources.h" 3 | 4 | //#define RES_MY_RES CINDER_RESOURCE( ../resources/, image_name.png, 128, IMAGE ) 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /L08_Motion_II/resources/CinderApp.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SethGibson/LearnCinderGL/3ab8fb94b6961e3d43e132e1d48c35f22c07cae0/L08_Motion_II/resources/CinderApp.icns -------------------------------------------------------------------------------- /L08_Motion_II/resources/cinder_app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SethGibson/LearnCinderGL/3ab8fb94b6961e3d43e132e1d48c35f22c07cae0/L08_Motion_II/resources/cinder_app_icon.ico -------------------------------------------------------------------------------- /L08_Motion_II/src/L08_Motion_IIApp.h: -------------------------------------------------------------------------------- 1 | /* 2 | Lesson 08: In Which We Learn about animation using per-instance attributes 3 | Topics Covered: 4 | Animating Per-Instance Attributes 5 | Changing vertex data buffer contents 6 | */ 7 | 8 | #ifndef _L08_H_ 9 | #define _L08_H_ 10 | #include "cinder/app/App.h" 11 | #include "cinder/app/RendererGl.h" 12 | #include "cinder/Camera.h" 13 | #include "cinder/CameraUi.h" 14 | #include "cinder/gl/gl.h" 15 | #include "cinder/gl/Batch.h" 16 | #include "cinder/gl/GlslProg.h" 17 | #include "cinder/params/Params.h" 18 | 19 | using namespace ci; 20 | using namespace ci::app; 21 | using namespace std; 22 | 23 | class L08_Motion_II : public App 24 | { 25 | public: 26 | void setup() override; 27 | void mouseDown(MouseEvent event) override; 28 | void update() override; 29 | void draw() override; 30 | 31 | private: 32 | void setupCamera(); 33 | void setupSpheres(int numElements); 34 | void setupTorii(int numElements); 35 | void setupGUI(); 36 | void setupSkybox(); 37 | 38 | void updateSpheres(); 39 | void updateTorii(); 40 | 41 | void drawScene(); 42 | void drawSkybox(); 43 | 44 | CameraPersp mCamera; 45 | CameraUi mCameraCtrl; 46 | 47 | gl::BatchRef mPlaneBatch; 48 | gl::GlslProgRef mPlaneShader; 49 | 50 | gl::BatchRef mSphereBatch; 51 | gl::GlslProgRef mSphereShader; 52 | gl::VboRef mSphereInstanceData; 53 | gl::VboMeshRef mSphereMeshData; 54 | int mNumSpheres; 55 | vector mSpherePositions; 56 | 57 | gl::BatchRef mTorusBatch; 58 | gl::GlslProgRef mTorusShader; 59 | gl::VboRef mTorusInstanceData; 60 | gl::VboMeshRef mTorusMeshData; 61 | int mNumTorii; 62 | vector mTorusPositions; 63 | 64 | const string mUniformLightPos = "uLightPos"; 65 | const string mUniformEyePos = "uCameraPos"; 66 | const string mUniformSpecularPower = "uSpecularPower"; 67 | const string mUniformSpecularStrength = "uSpecularStrength"; 68 | const string mUniformAmbientStrength = "uAmbientStrength"; 69 | const string mUniformEnvStrength = "uEnvStrength"; 70 | const string mUniformColor = "uColor"; 71 | const string mUniformRefract = "uRefract"; 72 | 73 | gl::BatchRef mSkyboxBatch; 74 | gl::GlslProgRef mSkyboxShader; 75 | gl::TextureCubeMapRef mSkyboxCubemap; 76 | 77 | params::InterfaceGlRef mGUI; 78 | float mParamLightPosX, 79 | mParamLightPosY, 80 | mParamLightPosZ; 81 | 82 | float mParamSphereSpecularPower, 83 | mParamSphereSpecularStrength, 84 | mParamSphereAmbientStrength, 85 | mParamSphereEnvStrength; 86 | 87 | vector mParamTorusRefractIndices; 88 | vector mParamTorusRefractNames; 89 | int mParamTorusRefractId; 90 | 91 | float mParamTorusSpecularPower, 92 | mParamTorusSpecularStrength, 93 | mParamTorusAmbientStrength, 94 | mParamTorusEnvStrength; 95 | 96 | Color mParamSphereColor, 97 | mParamTorusColor; 98 | }; 99 | #endif -------------------------------------------------------------------------------- /L08_Motion_II/vc2013/L08_Motion_II.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "L08_Motion_II", "L08_Motion_II.vcxproj", "{F6D3A8CA-1F98-4777-A9F6-0AC6847857D8}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x64 = Debug|x64 9 | Release|x64 = Release|x64 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {F6D3A8CA-1F98-4777-A9F6-0AC6847857D8}.Debug|x64.ActiveCfg = Debug|x64 13 | {F6D3A8CA-1F98-4777-A9F6-0AC6847857D8}.Debug|x64.Build.0 = Debug|x64 14 | {F6D3A8CA-1F98-4777-A9F6-0AC6847857D8}.Release|x64.ActiveCfg = Release|x64 15 | {F6D3A8CA-1F98-4777-A9F6-0AC6847857D8}.Release|x64.Build.0 = Release|x64 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /L08_Motion_II/vc2013/L08_Motion_II.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 15 | 16 | 17 | {d076a214-aed3-4c3f-aefa-cc6e1f02ecba} 18 | 19 | 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Header Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | 40 | 41 | Resource Files 42 | 43 | 44 | 45 | 46 | Source Files\shaders 47 | 48 | 49 | Source Files\shaders 50 | 51 | 52 | Source Files\shaders 53 | 54 | 55 | Source Files\shaders 56 | 57 | 58 | Source Files\shaders 59 | 60 | 61 | -------------------------------------------------------------------------------- /L08_Motion_II/vc2013/Resources.rc: -------------------------------------------------------------------------------- 1 | #include "../include/Resources.h" 2 | 3 | 1 ICON "..\\resources\\cinder_app_icon.ico" 4 | -------------------------------------------------------------------------------- /L08_Motion_II/xcode/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | CinderApp.icns 11 | CFBundleIdentifier 12 | org.libcinder.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2013 __MyCompanyName__. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /L08_Motion_II/xcode/L08_Motion_II_Prefix.pch: -------------------------------------------------------------------------------- 1 | #if defined( __cplusplus ) 2 | #include "cinder/Cinder.h" 3 | 4 | #include "cinder/app/App.h" 5 | 6 | #include "cinder/gl/gl.h" 7 | 8 | #include "cinder/CinderMath.h" 9 | #include "cinder/Matrix.h" 10 | #include "cinder/Vector.h" 11 | #include "cinder/Quaternion.h" 12 | #endif 13 | -------------------------------------------------------------------------------- /L09_Motion_III/assets/shaders/shape_reflect_frag.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform samplerCube uCubemapSampler; 3 | uniform vec3 uCameraPos; 4 | uniform vec3 uLightPos; 5 | uniform vec3 uColor; 6 | 7 | in vec3 Normal; 8 | in vec3 WorldPos; 9 | in vec3 Emissive; 10 | 11 | out vec4 FragColor; 12 | 13 | void main() 14 | { 15 | vec3 normal = normalize(Normal); 16 | vec3 lightDirection = normalize(uLightPos-WorldPos); 17 | vec3 viewDirection = normalize(uCameraPos-WorldPos); 18 | vec3 reflectDirection = normalize(WorldPos-uCameraPos); 19 | vec3 specularLookup = reflect(viewDirection, normal); 20 | vec3 reflLookup = reflect(reflectDirection, normal); 21 | 22 | vec4 refl = texture(uCubemapSampler, reflLookup)*0.5; 23 | vec3 diffuse = uColor*max(dot(normal,lightDirection), 0.0); 24 | vec3 ambient = uColor*0.1; 25 | float specular = pow(max(dot(-lightDirection, specularLookup),0.0), 16.0); 26 | 27 | FragColor = vec4(diffuse+specular+ambient+refl.rgb+Emissive,1.0); 28 | } -------------------------------------------------------------------------------- /L09_Motion_III/assets/shaders/shape_refract_frag.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform samplerCube uCubemapSampler; 3 | uniform vec3 uCameraPos; 4 | uniform vec3 uLightPos; 5 | uniform vec3 uColor; 6 | uniform float uRefract; 7 | 8 | in vec3 Normal; 9 | in vec3 WorldPos; 10 | in vec3 Emissive; 11 | 12 | out vec4 FragColor; 13 | 14 | void main() 15 | { 16 | vec3 normal = normalize(Normal); 17 | vec3 lightDirection = normalize(uLightPos-WorldPos); 18 | vec3 viewDirection = normalize(uCameraPos-WorldPos); 19 | vec3 specularLookup = reflect(viewDirection, normal); 20 | vec3 refrLookup = refract(normal, viewDirection, 1.0/uRefract); 21 | 22 | 23 | vec4 refr = texture(uCubemapSampler, refrLookup)*0.5; 24 | vec3 diffuse = uColor*max(dot(normal,lightDirection), 0.0); 25 | vec3 ambient = uColor*0.1; 26 | float specular = pow(max(dot(-lightDirection, specularLookup),0.0), 16.0f); 27 | 28 | FragColor = vec4(diffuse+specular+ambient+refr.rgb+Emissive,1.0); 29 | } -------------------------------------------------------------------------------- /L09_Motion_III/assets/shaders/shape_vert.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform mat4 ciModelMatrix; 3 | uniform mat4 ciViewMatrix; 4 | uniform mat4 ciProjectionMatrix; 5 | uniform mat4 ciNormalMatrix; 6 | 7 | in vec4 ciPosition; 8 | in vec4 ciNormal; 9 | 10 | in vec3 iPosition; 11 | in vec3 iColor; 12 | in float iSize; 13 | 14 | out vec3 Normal; 15 | out vec3 WorldPos; 16 | out vec3 Emissive; 17 | 18 | void main() 19 | { 20 | Emissive = iColor; 21 | mat4 normalMatrix = transpose(inverse(ciModelMatrix)); 22 | vec4 scaled = vec4(ciPosition.xyz*iSize,1.0); 23 | WorldPos = vec3(ciModelMatrix*scaled); 24 | Normal = vec3(normalMatrix*ciNormal); 25 | gl_Position = ciProjectionMatrix*ciViewMatrix*ciModelMatrix * (scaled+vec4(iPosition,1.0)); 26 | } -------------------------------------------------------------------------------- /L09_Motion_III/assets/shaders/skybox_frag.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform samplerCube uCubemapSampler; 3 | 4 | in vec3 LookupVector; 5 | 6 | out vec4 FragColor; 7 | 8 | void main() 9 | { 10 | FragColor = texture(uCubemapSampler, LookupVector); 11 | } -------------------------------------------------------------------------------- /L09_Motion_III/assets/shaders/skybox_vert.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform mat4 ciViewMatrix; 3 | uniform mat4 ciProjectionMatrix; 4 | 5 | in vec4 ciPosition; 6 | out vec3 LookupVector; 7 | 8 | void main() 9 | { 10 | LookupVector = vec3(ciPosition); 11 | gl_Position = ciProjectionMatrix*mat4(mat3(ciViewMatrix))*ciPosition; 12 | gl_Position = gl_Position.xyww; 13 | } -------------------------------------------------------------------------------- /L09_Motion_III/assets/textures/skybox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SethGibson/LearnCinderGL/3ab8fb94b6961e3d43e132e1d48c35f22c07cae0/L09_Motion_III/assets/textures/skybox.png -------------------------------------------------------------------------------- /L09_Motion_III/include/Resources.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "cinder/CinderResources.h" 3 | 4 | //#define RES_MY_RES CINDER_RESOURCE( ../resources/, image_name.png, 128, IMAGE ) 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /L09_Motion_III/resources/CinderApp.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SethGibson/LearnCinderGL/3ab8fb94b6961e3d43e132e1d48c35f22c07cae0/L09_Motion_III/resources/CinderApp.icns -------------------------------------------------------------------------------- /L09_Motion_III/resources/cinder_app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SethGibson/LearnCinderGL/3ab8fb94b6961e3d43e132e1d48c35f22c07cae0/L09_Motion_III/resources/cinder_app_icon.ico -------------------------------------------------------------------------------- /L09_Motion_III/src/L09_Motion_IIIApp.h: -------------------------------------------------------------------------------- 1 | /* 2 | Lesson 09: In Which We Learn about more things we can do with per-instance attributes, and how to simplify per-instance 3 | attribute management using interleaved data 4 | 5 | Topics Covered: 6 | Interleaving attribute data using structs 7 | */ 8 | 9 | #ifndef _L09_H_ 10 | #define _L09_H_ 11 | #include "cinder/app/App.h" 12 | #include "cinder/app/RendererGl.h" 13 | #include "cinder/Camera.h" 14 | #include "cinder/CameraUi.h" 15 | #include "cinder/gl/gl.h" 16 | #include "cinder/gl/Batch.h" 17 | #include "cinder/gl/GlslProg.h" 18 | #include "cinder/params/Params.h" 19 | #include "Particle.h" 20 | 21 | using namespace ci; 22 | using namespace ci::app; 23 | using namespace std; 24 | 25 | class L09_Motion_III : public App 26 | { 27 | public: 28 | 29 | void setup() override; 30 | void mouseDown(MouseEvent event) override; 31 | void update() override; 32 | void draw() override; 33 | 34 | private: 35 | void setupCamera(); 36 | void setupSpheres(int numElements); 37 | void setupTorii(int numElements); 38 | void setupGUI(); 39 | void setupSkybox(); 40 | 41 | void updateSpheres(); 42 | void updateTorii(); 43 | 44 | void drawScene(); 45 | void drawSkybox(); 46 | 47 | CameraPersp mCamera; 48 | CameraUi mCameraCtrl; 49 | 50 | gl::BatchRef mPlaneBatch; 51 | gl::GlslProgRef mPlaneShader; 52 | 53 | gl::BatchRef mSphereBatch; 54 | gl::GlslProgRef mSphereShader; 55 | gl::VboRef mSphereInstanceData; 56 | gl::VboMeshRef mSphereMeshData; 57 | int mNumSpheres; 58 | vector mSpheres; 59 | 60 | gl::BatchRef mTorusBatch; 61 | gl::GlslProgRef mTorusShader; 62 | gl::VboRef mTorusInstanceData; 63 | gl::VboMeshRef mTorusMeshData; 64 | int mNumTorii; 65 | vector mTorii; 66 | 67 | string mUniformLightPos = "uLightPos"; 68 | string mUniformEyePos = "uCameraPos"; 69 | string mUniformSpecularPower = "uSpecularPower"; 70 | string mUniformSpecularStrength = "uSpecularStrength"; 71 | string mUniformAmbientStrength = "uAmbientStrength"; 72 | string mUniformEnvStrength = "uEnvStrength"; 73 | string mUniformColor = "uColor"; 74 | string mUniformRefract = "uRefract"; 75 | 76 | gl::BatchRef mSkyboxBatch; 77 | gl::GlslProgRef mSkyboxShader; 78 | gl::TextureCubeMapRef mSkyboxCubemap; 79 | 80 | params::InterfaceGlRef mGUI; 81 | float mParamLightPosX, 82 | mParamLightPosY, 83 | mParamLightPosZ; 84 | 85 | float mParamSphereSpecularPower, 86 | mParamSphereSpecularStrength, 87 | mParamSphereAmbientStrength, 88 | mParamSphereEnvStrength; 89 | 90 | vector mParamTorusRefractIndices; 91 | vector mParamTorusRefractNames; 92 | int mParamTorusRefractId; 93 | 94 | float mParamTorusSpecularPower, 95 | mParamTorusSpecularStrength, 96 | mParamTorusAmbientStrength, 97 | mParamTorusEnvStrength; 98 | 99 | Color mParamSphereColor, 100 | mParamTorusColor; 101 | }; 102 | #endif -------------------------------------------------------------------------------- /L09_Motion_III/src/Particle.h: -------------------------------------------------------------------------------- 1 | #ifndef _PARTICLE_H_ 2 | #define _PARTICLE_H_ 3 | #include "cinder/Vector.h" 4 | #include "cinder/Color.h" 5 | 6 | using namespace ci; 7 | struct Particle 8 | { 9 | vec3 Position; 10 | int Age, 11 | Life, 12 | Index; 13 | 14 | float Size; 15 | 16 | Color Emissive; 17 | 18 | bool IsShining; 19 | 20 | Particle(vec3 pPos, int pId) : Position(pPos), Index(pId), 21 | Life(60), Age(60), 22 | Size(1.0f), 23 | Emissive(Color::black()), 24 | IsShining(false) 25 | {} 26 | 27 | void Update(float frames, float step, bool zaxis) 28 | { 29 | float x = math::cos(Index*step); 30 | float y = math::sin(Index*step); 31 | 32 | float t = (float)frames*0.1f; 33 | float offset = math::sin((Index*step*8.f) + t)*0.1f; 34 | float size = math::sin((Index*step*2.f) + t)*0.1f; 35 | 36 | if (zaxis) 37 | Position = vec3(x + x*offset, y + y*offset, 0.0); 38 | else 39 | Position = vec3(x + x*offset, 0.0, y + y*offset); 40 | Size = math::max(size*10.0f, 0.5f); 41 | 42 | if ((offset >= 0.099f) && (IsShining == false)) 43 | IsShining = true; 44 | 45 | if (IsShining) 46 | { 47 | Age--; 48 | if (Age > 0) 49 | { 50 | float norm = Age / (float)Life; 51 | Emissive = Color::white()*norm; 52 | } 53 | else if (Age <= 0) 54 | { 55 | Age = Life; 56 | IsShining = false; 57 | Emissive = Color::black(); 58 | } 59 | } 60 | } 61 | }; 62 | #endif -------------------------------------------------------------------------------- /L09_Motion_III/vc2013/L09_Motion_III.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "L09_Motion_III", "L09_Motion_III.vcxproj", "{51C084C8-CE48-44F1-B936-4EAF7EE3B682}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x64 = Debug|x64 9 | Release|x64 = Release|x64 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {51C084C8-CE48-44F1-B936-4EAF7EE3B682}.Debug|x64.ActiveCfg = Debug|x64 13 | {51C084C8-CE48-44F1-B936-4EAF7EE3B682}.Debug|x64.Build.0 = Debug|x64 14 | {51C084C8-CE48-44F1-B936-4EAF7EE3B682}.Release|x64.ActiveCfg = Release|x64 15 | {51C084C8-CE48-44F1-B936-4EAF7EE3B682}.Release|x64.Build.0 = Release|x64 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /L09_Motion_III/vc2013/L09_Motion_III.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 15 | 16 | 17 | {6f13cca5-e8ff-41fb-87dc-9d7e926e2c3e} 18 | 19 | 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Header Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | 43 | 44 | Resource Files 45 | 46 | 47 | 48 | 49 | Source Files\shaders 50 | 51 | 52 | Source Files\shaders 53 | 54 | 55 | Source Files\shaders 56 | 57 | 58 | Source Files\shaders 59 | 60 | 61 | Source Files\shaders 62 | 63 | 64 | -------------------------------------------------------------------------------- /L09_Motion_III/vc2013/Resources.rc: -------------------------------------------------------------------------------- 1 | #include "../include/Resources.h" 2 | 3 | 1 ICON "..\\resources\\cinder_app_icon.ico" 4 | -------------------------------------------------------------------------------- /L09_Motion_III/xcode/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | CinderApp.icns 11 | CFBundleIdentifier 12 | org.libcinder.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2013 __MyCompanyName__. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /L09_Motion_III/xcode/L09_Motion_III_Prefix.pch: -------------------------------------------------------------------------------- 1 | #if defined( __cplusplus ) 2 | #include "cinder/Cinder.h" 3 | 4 | #include "cinder/app/App.h" 5 | 6 | #include "cinder/gl/gl.h" 7 | 8 | #include "cinder/CinderMath.h" 9 | #include "cinder/Matrix.h" 10 | #include "cinder/Vector.h" 11 | #include "cinder/Quaternion.h" 12 | #endif 13 | -------------------------------------------------------------------------------- /L10_FBO/assets/shaders/blur_frag.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform sampler2D uTextureSampler; 3 | uniform float uBlurStrength; 4 | in vec2 UV; 5 | in vec2 BlurSamples[14]; 6 | 7 | out vec4 FragColor; 8 | 9 | void main() 10 | { 11 | vec4 sample = vec4(0); 12 | 13 | sample += texture(uTextureSampler, BlurSamples[ 0])*0.0044299121055113265; 14 | sample += texture(uTextureSampler, BlurSamples[ 1])*0.00895781211794; 15 | sample += texture(uTextureSampler, BlurSamples[ 2])*0.0215963866053; 16 | sample += texture(uTextureSampler, BlurSamples[ 3])*0.0443683338718; 17 | sample += texture(uTextureSampler, BlurSamples[ 4])*0.0776744219933; 18 | sample += texture(uTextureSampler, BlurSamples[ 5])*0.115876621105; 19 | sample += texture(uTextureSampler, BlurSamples[ 6])*0.147308056121; 20 | sample += texture(uTextureSampler, UV )*0.159576912161; 21 | sample += texture(uTextureSampler, BlurSamples[ 7])*0.147308056121; 22 | sample += texture(uTextureSampler, BlurSamples[ 8])*0.115876621105; 23 | sample += texture(uTextureSampler, BlurSamples[ 9])*0.0776744219933; 24 | sample += texture(uTextureSampler, BlurSamples[10])*0.0443683338718; 25 | sample += texture(uTextureSampler, BlurSamples[11])*0.0215963866053; 26 | sample += texture(uTextureSampler, BlurSamples[12])*0.00895781211794; 27 | sample += texture(uTextureSampler, BlurSamples[13])*0.0044299121055113265; 28 | 29 | FragColor = vec4(sample.rgb*uBlurStrength,sample.a); 30 | } -------------------------------------------------------------------------------- /L10_FBO/assets/shaders/blur_vert.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform mat4 ciModelViewProjection; 3 | uniform vec2 uBlurAxis; 4 | uniform float uBlurSize; 5 | in vec4 ciPosition; 6 | in vec2 ciTexCoord0; 7 | 8 | out vec2 UV; 9 | out vec2 BlurSamples[14]; 10 | 11 | void main() 12 | { 13 | gl_Position = ciModelViewProjection * ciPosition; 14 | UV = ciTexCoord0; 15 | 16 | BlurSamples[0] = ciTexCoord0 + vec2(-0.014*uBlurAxis.x*uBlurSize, -0.014*uBlurAxis.y*uBlurSize); 17 | BlurSamples[1] = ciTexCoord0 + vec2(-0.012*uBlurAxis.x*uBlurSize, -0.012*uBlurAxis.y*uBlurSize); 18 | BlurSamples[2] = ciTexCoord0 + vec2(-0.010*uBlurAxis.x*uBlurSize, -0.010*uBlurAxis.y*uBlurSize); 19 | BlurSamples[3] = ciTexCoord0 + vec2(-0.008*uBlurAxis.x*uBlurSize, -0.008*uBlurAxis.y*uBlurSize); 20 | BlurSamples[4] = ciTexCoord0 + vec2(-0.006*uBlurAxis.x*uBlurSize, -0.006*uBlurAxis.y*uBlurSize); 21 | BlurSamples[5] = ciTexCoord0 + vec2(-0.004*uBlurAxis.x*uBlurSize, -0.004*uBlurAxis.y*uBlurSize); 22 | BlurSamples[6] = ciTexCoord0 + vec2(-0.002*uBlurAxis.x*uBlurSize, -0.002*uBlurAxis.y*uBlurSize); 23 | BlurSamples[7] = ciTexCoord0 + vec2(0.002*uBlurAxis.x*uBlurSize, 0.002*uBlurAxis.y*uBlurSize); 24 | BlurSamples[8] = ciTexCoord0 + vec2(0.004*uBlurAxis.x*uBlurSize, 0.004*uBlurAxis.y*uBlurSize); 25 | BlurSamples[9] = ciTexCoord0 + vec2(0.006*uBlurAxis.x*uBlurSize, 0.006*uBlurAxis.y*uBlurSize); 26 | BlurSamples[10] = ciTexCoord0 + vec2(0.008*uBlurAxis.x*uBlurSize, 0.008*uBlurAxis.y*uBlurSize); 27 | BlurSamples[11] = ciTexCoord0 + vec2(0.010*uBlurAxis.x*uBlurSize, 0.010*uBlurAxis.y*uBlurSize); 28 | BlurSamples[12] = ciTexCoord0 + vec2(0.012*uBlurAxis.x*uBlurSize, 0.012*uBlurAxis.y*uBlurSize); 29 | BlurSamples[13] = ciTexCoord0 + vec2(0.014*uBlurAxis.x*uBlurSize, 0.014*uBlurAxis.y*uBlurSize); 30 | } -------------------------------------------------------------------------------- /L10_FBO/assets/shaders/highpass_frag.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform sampler2D uTextureSampler; 3 | uniform float uWhiteMax; 4 | uniform float uWhiteMid; 5 | uniform float uWhiteThreshold; 6 | 7 | in vec2 UV; 8 | out vec4 FragColor; 9 | 10 | void main() 11 | { 12 | vec4 sample = texture(uTextureSampler, UV); 13 | 14 | float a = sample.a; 15 | sample.rgb *= (uWhiteMid / uWhiteMax ); 16 | sample.rgb *= 1.0 + (sample.rgb / (uWhiteThreshold * uWhiteThreshold) ); 17 | sample.rgb -= 0.5; 18 | sample.rgb /=(1.0 + sample.rgb); 19 | FragColor = vec4(sample.rgb, a); 20 | } 21 | -------------------------------------------------------------------------------- /L10_FBO/assets/shaders/passthru_vert.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform mat4 ciModelViewProjection; 3 | in vec4 ciPosition; 4 | in vec2 ciTexCoord0; 5 | 6 | out vec2 UV; 7 | 8 | void main() 9 | { 10 | UV = ciTexCoord0; 11 | gl_Position = ciModelViewProjection * ciPosition; 12 | } -------------------------------------------------------------------------------- /L10_FBO/assets/shaders/shape_reflect_frag.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform samplerCube uCubemapSampler; 3 | uniform vec3 uCameraPos; 4 | uniform vec3 uLightPos; 5 | uniform vec3 uColor; 6 | 7 | in vec3 Normal; 8 | in vec3 WorldPos; 9 | in vec3 Emissive; 10 | 11 | out vec4 FragColor; 12 | 13 | void main() 14 | { 15 | vec3 normal = normalize(Normal); 16 | vec3 lightDirection = normalize(uLightPos-WorldPos); 17 | vec3 viewDirection = normalize(uCameraPos-WorldPos); 18 | vec3 reflectDirection = normalize(WorldPos-uCameraPos); 19 | vec3 specularLookup = reflect(viewDirection, normal); 20 | vec3 reflLookup = reflect(reflectDirection, normal); 21 | 22 | vec4 refl = texture(uCubemapSampler, reflLookup)*0.5; 23 | vec3 diffuse = uColor*max(dot(normal,lightDirection), 0.0); 24 | vec3 ambient = uColor*0.1; 25 | float specular = pow(max(dot(-lightDirection, specularLookup),0.0), 16.0); 26 | 27 | FragColor = vec4(diffuse+specular+ambient+refl.rgb+Emissive,1.0); 28 | } -------------------------------------------------------------------------------- /L10_FBO/assets/shaders/shape_refract_frag.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform samplerCube uCubemapSampler; 3 | uniform vec3 uCameraPos; 4 | uniform vec3 uLightPos; 5 | uniform vec3 uColor; 6 | uniform float uRefract; 7 | 8 | in vec3 Normal; 9 | in vec3 WorldPos; 10 | in vec3 Emissive; 11 | 12 | out vec4 FragColor; 13 | 14 | void main() 15 | { 16 | vec3 normal = normalize(Normal); 17 | vec3 lightDirection = normalize(uLightPos-WorldPos); 18 | vec3 viewDirection = normalize(uCameraPos-WorldPos); 19 | vec3 specularLookup = reflect(viewDirection, normal); 20 | vec3 refrLookup = refract(normal, viewDirection, 1.0/uRefract); 21 | 22 | 23 | vec4 refr = texture(uCubemapSampler, refrLookup)*0.5; 24 | vec3 diffuse = uColor*max(dot(normal,lightDirection), 0.0); 25 | vec3 ambient = uColor*0.1; 26 | float specular = pow(max(dot(-lightDirection, specularLookup),0.0), 16.0f); 27 | 28 | FragColor = vec4(diffuse+specular+ambient+refr.rgb+Emissive,1.0); 29 | } -------------------------------------------------------------------------------- /L10_FBO/assets/shaders/shape_vert.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform mat4 ciModelMatrix; 3 | uniform mat4 ciViewMatrix; 4 | uniform mat4 ciProjectionMatrix; 5 | uniform mat4 ciNormalMatrix; 6 | 7 | in vec4 ciPosition; 8 | in vec4 ciNormal; 9 | 10 | in vec3 iPosition; 11 | in vec3 iColor; 12 | in float iSize; 13 | 14 | out vec3 Normal; 15 | out vec3 WorldPos; 16 | out vec3 Emissive; 17 | 18 | void main() 19 | { 20 | Emissive = iColor; 21 | mat4 normalMatrix = transpose(inverse(ciModelMatrix)); 22 | vec4 scaled = vec4(ciPosition.xyz*iSize,1.0); 23 | WorldPos = vec3(ciModelMatrix*scaled); 24 | Normal = vec3(normalMatrix*ciNormal); 25 | gl_Position = ciProjectionMatrix*ciViewMatrix*ciModelMatrix * (scaled+vec4(iPosition,1.0)); 26 | } -------------------------------------------------------------------------------- /L10_FBO/assets/shaders/skybox_frag.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform samplerCube uCubemapSampler; 3 | 4 | in vec3 LookupVector; 5 | 6 | out vec4 FragColor; 7 | 8 | void main() 9 | { 10 | FragColor = texture(uCubemapSampler, LookupVector); 11 | } -------------------------------------------------------------------------------- /L10_FBO/assets/shaders/skybox_vert.glsl: -------------------------------------------------------------------------------- 1 | #version 150 2 | uniform mat4 ciViewMatrix; 3 | uniform mat4 ciProjectionMatrix; 4 | 5 | in vec4 ciPosition; 6 | out vec3 LookupVector; 7 | 8 | void main() 9 | { 10 | LookupVector = vec3(ciPosition); 11 | gl_Position = ciProjectionMatrix*mat4(mat3(ciViewMatrix))*ciPosition; 12 | gl_Position = gl_Position.xyww; 13 | } -------------------------------------------------------------------------------- /L10_FBO/assets/textures/skybox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SethGibson/LearnCinderGL/3ab8fb94b6961e3d43e132e1d48c35f22c07cae0/L10_FBO/assets/textures/skybox.png -------------------------------------------------------------------------------- /L10_FBO/include/Resources.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "cinder/CinderResources.h" 3 | 4 | //#define RES_MY_RES CINDER_RESOURCE( ../resources/, image_name.png, 128, IMAGE ) 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /L10_FBO/resources/CinderApp.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SethGibson/LearnCinderGL/3ab8fb94b6961e3d43e132e1d48c35f22c07cae0/L10_FBO/resources/CinderApp.icns -------------------------------------------------------------------------------- /L10_FBO/resources/cinder_app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SethGibson/LearnCinderGL/3ab8fb94b6961e3d43e132e1d48c35f22c07cae0/L10_FBO/resources/cinder_app_icon.ico -------------------------------------------------------------------------------- /L10_FBO/src/L10_FBOApp.h: -------------------------------------------------------------------------------- 1 | #ifndef _L10_FBO_H_ 2 | #define _L10_FBO_H_ 3 | #include "cinder/app/App.h" 4 | #include "cinder/app/RendererGl.h" 5 | #include "cinder/Camera.h" 6 | #include "cinder/CameraUi.h" 7 | #include "cinder/gl/gl.h" 8 | #include "cinder/gl/Batch.h" 9 | #include "cinder/gl/GlslProg.h" 10 | #include "cinder/params/Params.h" 11 | #include "Particle.h" 12 | 13 | using namespace ci; 14 | using namespace ci::app; 15 | using namespace std; 16 | 17 | class L10_FBO : public App 18 | { 19 | public: 20 | void setup() override; 21 | void mouseDown(MouseEvent event) override; 22 | void update() override; 23 | void draw() override; 24 | 25 | private: 26 | void setupCamera(); 27 | void setupSpheres(int numElements); 28 | void setupTorii(int numElements); 29 | void setupGUI(); 30 | void setupSkybox(); 31 | void setupFbo(); 32 | 33 | void updateFbo(); 34 | void updateSpheres(); 35 | void updateTorii(); 36 | 37 | void drawScene(); 38 | void drawSkybox(); 39 | 40 | CameraPersp mCamera; 41 | CameraUi mCameraCtrl; 42 | 43 | gl::BatchRef mPlaneBatch; 44 | gl::GlslProgRef mPlaneShader; 45 | 46 | gl::BatchRef mSphereBatch; 47 | gl::GlslProgRef mSphereShader; 48 | gl::VboRef mSphereInstanceData; 49 | gl::VboMeshRef mSphereMeshData; 50 | int mNumSpheres; 51 | vector mSpheres; 52 | 53 | gl::BatchRef mTorusBatch; 54 | gl::GlslProgRef mTorusShader; 55 | gl::VboRef mTorusInstanceData; 56 | gl::VboMeshRef mTorusMeshData; 57 | int mNumTorii; 58 | vector mTorii; 59 | 60 | string mUniformLightPos = "uLightPos"; 61 | string mUniformEyePos = "uCameraPos"; 62 | string mUniformSpecularPower = "uSpecularPower"; 63 | string mUniformSpecularStrength = "uSpecularStrength"; 64 | string mUniformAmbientStrength = "uAmbientStrength"; 65 | string mUniformEnvStrength = "uEnvStrength"; 66 | string mUniformColor = "uColor"; 67 | string mUniformRefract = "uRefract"; 68 | 69 | gl::BatchRef mSkyboxBatch; 70 | gl::GlslProgRef mSkyboxShader; 71 | gl::TextureCubeMapRef mSkyboxCubemap; 72 | 73 | gl::FboRef mRawFbo, 74 | mHighPassFbo, 75 | mBlurHFbo, 76 | mBlurVFbo; 77 | 78 | gl::GlslProgRef mHighPassShader, 79 | mBlurShader; 80 | 81 | 82 | //GUI 83 | params::InterfaceGlRef mGUI; 84 | float mParamLightPosX, 85 | mParamLightPosY, 86 | mParamLightPosZ; 87 | 88 | float mParamSphereSpecularPower, 89 | mParamSphereSpecularStrength, 90 | mParamSphereAmbientStrength, 91 | mParamSphereEnvStrength; 92 | 93 | vector mParamTorusRefractIndices; 94 | vector mParamTorusRefractNames; 95 | int mParamTorusRefractId; 96 | 97 | float mParamTorusSpecularPower, 98 | mParamTorusSpecularStrength, 99 | mParamTorusAmbientStrength, 100 | mParamTorusEnvStrength; 101 | 102 | Color mParamSphereColor, 103 | mParamTorusColor; 104 | 105 | float mParamWhiteMax, 106 | mParamWhiteMid, 107 | mParamWhiteThresh; 108 | 109 | float mParamBlurSizeU, 110 | mParamBlurSizeV, 111 | mParamBlurStrU, 112 | mParamBlurStrV; 113 | }; 114 | #endif -------------------------------------------------------------------------------- /L10_FBO/src/Particle.h: -------------------------------------------------------------------------------- 1 | #ifndef _PARTICLE_H_ 2 | #define _PARTICLE_H_ 3 | #include "cinder/Vector.h" 4 | #include "cinder/Color.h" 5 | 6 | using namespace ci; 7 | 8 | struct Particle 9 | { 10 | vec3 Position; 11 | int Age, 12 | Life, 13 | Index; 14 | 15 | float Size; 16 | 17 | Color Emissive; 18 | 19 | bool IsShining; 20 | 21 | Particle(vec3 pPos, int pId) : Position(pPos), Index(pId), 22 | Life(60), Age(60), 23 | Size(1.0f), 24 | Emissive(Color::black()), 25 | IsShining(false) 26 | {} 27 | 28 | void Update(float frames, float step, bool zaxis) 29 | { 30 | float x = math::cos(Index*step); 31 | float y = math::sin(Index*step); 32 | 33 | float t = (float)frames*0.1f; 34 | float offset = math::sin((Index*step*8.f) + t)*0.1f; 35 | float size = math::sin((Index*step*2.f) + t)*0.1f; 36 | 37 | if (zaxis) 38 | Position = vec3(x + x*offset, y + y*offset, 0.0); 39 | else 40 | Position = vec3(x + x*offset, 0.0, y + y*offset); 41 | Size = math::max(size*10.0f, 0.5f); 42 | 43 | if ((offset >= 0.099f) && (IsShining == false)) 44 | IsShining = true; 45 | 46 | if (IsShining) 47 | { 48 | Age--; 49 | if (Age > 0) 50 | { 51 | float norm = Age / (float)Life; 52 | Emissive = Color::white()*norm; 53 | } 54 | else if (Age <= 0) 55 | { 56 | Age = Life; 57 | IsShining = false; 58 | Emissive = Color::black(); 59 | } 60 | } 61 | } 62 | }; 63 | #endif -------------------------------------------------------------------------------- /L10_FBO/vc2013/L10_FBO.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "L10_FBO", "L10_FBO.vcxproj", "{0D84A42C-5A23-4347-A489-C9A96C7EC24A}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x64 = Debug|x64 9 | Release|x64 = Release|x64 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {0D84A42C-5A23-4347-A489-C9A96C7EC24A}.Debug|x64.ActiveCfg = Debug|x64 13 | {0D84A42C-5A23-4347-A489-C9A96C7EC24A}.Debug|x64.Build.0 = Debug|x64 14 | {0D84A42C-5A23-4347-A489-C9A96C7EC24A}.Release|x64.ActiveCfg = Release|x64 15 | {0D84A42C-5A23-4347-A489-C9A96C7EC24A}.Release|x64.Build.0 = Release|x64 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /L10_FBO/vc2013/L10_FBO.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 15 | 16 | 17 | {b3a3f970-c484-4b6f-a30f-d559c0e7091b} 18 | 19 | 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Header Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | 43 | 44 | Resource Files 45 | 46 | 47 | 48 | 49 | Source Files\shaders 50 | 51 | 52 | Source Files\shaders 53 | 54 | 55 | Source Files\shaders 56 | 57 | 58 | Source Files\shaders 59 | 60 | 61 | Source Files\shaders 62 | 63 | 64 | Source Files\shaders 65 | 66 | 67 | Source Files\shaders 68 | 69 | 70 | Source Files\shaders 71 | 72 | 73 | Source Files\shaders 74 | 75 | 76 | -------------------------------------------------------------------------------- /L10_FBO/vc2013/Resources.rc: -------------------------------------------------------------------------------- 1 | #include "../include/Resources.h" 2 | 3 | 1 ICON "..\\resources\\cinder_app_icon.ico" 4 | -------------------------------------------------------------------------------- /L10_FBO/xcode/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | CinderApp.icns 11 | CFBundleIdentifier 12 | org.libcinder.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2013 __MyCompanyName__. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /L10_FBO/xcode/L10_FBO_Prefix.pch: -------------------------------------------------------------------------------- 1 | #if defined( __cplusplus ) 2 | #include "cinder/Cinder.h" 3 | 4 | #include "cinder/app/App.h" 5 | 6 | #include "cinder/gl/gl.h" 7 | 8 | #include "cinder/CinderMath.h" 9 | #include "cinder/Matrix.h" 10 | #include "cinder/Vector.h" 11 | #include "cinder/Quaternion.h" 12 | #endif 13 | -------------------------------------------------------------------------------- /L11_Attributes/include/Resources.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "cinder/CinderResources.h" 3 | 4 | //#define RES_MY_RES CINDER_RESOURCE( ../resources/, image_name.png, 128, IMAGE ) 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /L11_Attributes/resources/cinder_app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SethGibson/LearnCinderGL/3ab8fb94b6961e3d43e132e1d48c35f22c07cae0/L11_Attributes/resources/cinder_app_icon.ico -------------------------------------------------------------------------------- /L11_Attributes/src/L11_AttributesApp.cpp: -------------------------------------------------------------------------------- 1 | #include "cinder/app/App.h" 2 | #include "cinder/app/RendererGl.h" 3 | #include "cinder/gl/gl.h" 4 | 5 | using namespace ci; 6 | using namespace ci::app; 7 | using namespace std; 8 | 9 | class L11_AttributesApp : public App { 10 | public: 11 | void setup() override; 12 | void mouseDown( MouseEvent event ) override; 13 | void update() override; 14 | void draw() override; 15 | }; 16 | 17 | void L11_AttributesApp::setup() 18 | { 19 | } 20 | 21 | void L11_AttributesApp::mouseDown( MouseEvent event ) 22 | { 23 | } 24 | 25 | void L11_AttributesApp::update() 26 | { 27 | } 28 | 29 | void L11_AttributesApp::draw() 30 | { 31 | gl::clear( Color( 0, 0, 0 ) ); 32 | } 33 | 34 | CINDER_APP( L11_AttributesApp, RendererGl ) 35 | -------------------------------------------------------------------------------- /L11_Attributes/vc2013/L11_Attributes.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "L11_Attributes", "L11_Attributes.vcxproj", "{234F6F3E-562D-4B4A-9C8A-3ED57286CF0F}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x64 = Debug|x64 9 | Release|x64 = Release|x64 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {234F6F3E-562D-4B4A-9C8A-3ED57286CF0F}.Debug|x64.ActiveCfg = Debug|x64 13 | {234F6F3E-562D-4B4A-9C8A-3ED57286CF0F}.Debug|x64.Build.0 = Debug|x64 14 | {234F6F3E-562D-4B4A-9C8A-3ED57286CF0F}.Release|x64.ActiveCfg = Release|x64 15 | {234F6F3E-562D-4B4A-9C8A-3ED57286CF0F}.Release|x64.Build.0 = Release|x64 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /L11_Attributes/vc2013/L11_Attributes.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | x64 6 | 7 | 8 | Release 9 | x64 10 | 11 | 12 | 13 | {234F6F3E-562D-4B4A-9C8A-3ED57286CF0F} 14 | L11_Attributes 15 | Win32Proj 16 | 17 | 18 | 19 | Application 20 | false 21 | v120 22 | Unicode 23 | true 24 | 25 | 26 | Application 27 | true 28 | v120 29 | Unicode 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | <_ProjectFileVersion>10.0.30319.1 42 | true 43 | false 44 | 45 | 46 | 47 | Disabled 48 | ..\include;"..\..\..\..\..\libs\Cinder\include" 49 | WIN32;_DEBUG;_WINDOWS;NOMINMAX;_WIN32_WINNT=0x0502;%(PreprocessorDefinitions) 50 | EnableFastChecks 51 | MultiThreadedDebug 52 | 53 | Level3 54 | ProgramDatabase 55 | true 56 | 57 | 58 | "..\..\..\..\..\libs\Cinder\include";..\include 59 | 60 | 61 | cinder-$(PlatformToolset)_d.lib;OpenGL32.lib;%(AdditionalDependencies) 62 | "..\..\..\..\..\libs\Cinder\lib\msw\$(PlatformTarget)" 63 | true 64 | Windows 65 | false 66 | 67 | LIBCMT;LIBCPMT 68 | 69 | 70 | 71 | 72 | ..\include;"..\..\..\..\..\libs\Cinder\include" 73 | WIN32;NDEBUG;_WINDOWS;NOMINMAX;_WIN32_WINNT=0x0502;%(PreprocessorDefinitions) 74 | MultiThreaded 75 | 76 | Level3 77 | ProgramDatabase 78 | true 79 | 80 | 81 | true 82 | 83 | 84 | "..\..\..\..\..\libs\Cinder\include";..\include 85 | 86 | 87 | cinder-$(PlatformToolset).lib;OpenGL32.lib;%(AdditionalDependencies) 88 | "..\..\..\..\..\libs\Cinder\lib\msw\$(PlatformTarget)" 89 | false 90 | true 91 | Windows 92 | true 93 | 94 | false 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /L11_Attributes/vc2013/L11_Attributes.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 5 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 6 | 7 | 8 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 9 | h;hpp;hxx;hm;inl;inc;xsd 10 | 11 | 12 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 13 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 14 | 15 | 16 | 17 | 18 | Source Files 19 | 20 | 21 | Source Files 22 | 23 | 24 | Header Files 25 | 26 | 27 | 28 | 29 | Header Files 30 | 31 | 32 | 33 | 34 | Resource Files 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /L11_Attributes/vc2013/Resources.rc: -------------------------------------------------------------------------------- 1 | #include "../include/Resources.h" 2 | 3 | 1 ICON "..\\resources\\cinder_app_icon.ico" 4 | -------------------------------------------------------------------------------- /LearnCinderGL.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.31101.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "L01_Camera", "L01_Camera\vc2013\L01_Camera.vcxproj", "{8E43D05F-88F2-4C3C-AF1C-18785D872B30}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "L02_BasicScene", "L02_BasicScene\vc2013\L02_BasicScene.vcxproj", "{D55A3A6A-39EC-469A-8706-39BFDBFE01CE}" 9 | EndProject 10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "L03_Lighting_I", "L03_Lighting_I\vc2013\L03_Lighting_I.vcxproj", "{C19B3663-D8E5-4874-B303-602BCA492DCB}" 11 | EndProject 12 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "L04_Lighting_II", "L04_Lighting_II\vc2013\L04_Lighting_II.vcxproj", "{A899D708-F029-45F2-905C-B62E4D8BC13D}" 13 | EndProject 14 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "L05_Lighting_III", "L05_Lighting_III\vc2013\L05_Lighting_III.vcxproj", "{4AC1E592-9CC3-42A0-873D-B1FBB3AC107B}" 15 | EndProject 16 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "L06_Instancing", "L06_Instancing\vc2013\L06_Instancing.vcxproj", "{713D8346-EAF2-483F-A811-9F8E8812F2F2}" 17 | EndProject 18 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "L07_Motion_I", "L07_Motion_I\vc2013\L07_Motion_I.vcxproj", "{585F9348-63A1-4917-998D-378E9802EF86}" 19 | EndProject 20 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "L08_Motion_II", "L08_Motion_II\vc2013\L08_Motion_II.vcxproj", "{F6D3A8CA-1F98-4777-A9F6-0AC6847857D8}" 21 | EndProject 22 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "L09_Motion_III", "L09_Motion_III\vc2013\L09_Motion_III.vcxproj", "{51C084C8-CE48-44F1-B936-4EAF7EE3B682}" 23 | EndProject 24 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "L10_FBO", "L10_FBO\vc2013\L10_FBO.vcxproj", "{0D84A42C-5A23-4347-A489-C9A96C7EC24A}" 25 | EndProject 26 | Global 27 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 28 | Debug|x64 = Debug|x64 29 | Release|x64 = Release|x64 30 | EndGlobalSection 31 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 32 | {8E43D05F-88F2-4C3C-AF1C-18785D872B30}.Debug|x64.ActiveCfg = Debug|x64 33 | {8E43D05F-88F2-4C3C-AF1C-18785D872B30}.Debug|x64.Build.0 = Debug|x64 34 | {8E43D05F-88F2-4C3C-AF1C-18785D872B30}.Release|x64.ActiveCfg = Release|x64 35 | {8E43D05F-88F2-4C3C-AF1C-18785D872B30}.Release|x64.Build.0 = Release|x64 36 | {D55A3A6A-39EC-469A-8706-39BFDBFE01CE}.Debug|x64.ActiveCfg = Debug|x64 37 | {D55A3A6A-39EC-469A-8706-39BFDBFE01CE}.Debug|x64.Build.0 = Debug|x64 38 | {D55A3A6A-39EC-469A-8706-39BFDBFE01CE}.Release|x64.ActiveCfg = Release|x64 39 | {D55A3A6A-39EC-469A-8706-39BFDBFE01CE}.Release|x64.Build.0 = Release|x64 40 | {C19B3663-D8E5-4874-B303-602BCA492DCB}.Debug|x64.ActiveCfg = Debug|x64 41 | {C19B3663-D8E5-4874-B303-602BCA492DCB}.Debug|x64.Build.0 = Debug|x64 42 | {C19B3663-D8E5-4874-B303-602BCA492DCB}.Release|x64.ActiveCfg = Release|x64 43 | {C19B3663-D8E5-4874-B303-602BCA492DCB}.Release|x64.Build.0 = Release|x64 44 | {A899D708-F029-45F2-905C-B62E4D8BC13D}.Debug|x64.ActiveCfg = Debug|x64 45 | {A899D708-F029-45F2-905C-B62E4D8BC13D}.Debug|x64.Build.0 = Debug|x64 46 | {A899D708-F029-45F2-905C-B62E4D8BC13D}.Release|x64.ActiveCfg = Release|x64 47 | {A899D708-F029-45F2-905C-B62E4D8BC13D}.Release|x64.Build.0 = Release|x64 48 | {4AC1E592-9CC3-42A0-873D-B1FBB3AC107B}.Debug|x64.ActiveCfg = Debug|x64 49 | {4AC1E592-9CC3-42A0-873D-B1FBB3AC107B}.Debug|x64.Build.0 = Debug|x64 50 | {4AC1E592-9CC3-42A0-873D-B1FBB3AC107B}.Release|x64.ActiveCfg = Release|x64 51 | {4AC1E592-9CC3-42A0-873D-B1FBB3AC107B}.Release|x64.Build.0 = Release|x64 52 | {713D8346-EAF2-483F-A811-9F8E8812F2F2}.Debug|x64.ActiveCfg = Debug|x64 53 | {713D8346-EAF2-483F-A811-9F8E8812F2F2}.Debug|x64.Build.0 = Debug|x64 54 | {713D8346-EAF2-483F-A811-9F8E8812F2F2}.Release|x64.ActiveCfg = Release|x64 55 | {713D8346-EAF2-483F-A811-9F8E8812F2F2}.Release|x64.Build.0 = Release|x64 56 | {585F9348-63A1-4917-998D-378E9802EF86}.Debug|x64.ActiveCfg = Debug|x64 57 | {585F9348-63A1-4917-998D-378E9802EF86}.Debug|x64.Build.0 = Debug|x64 58 | {585F9348-63A1-4917-998D-378E9802EF86}.Release|x64.ActiveCfg = Release|x64 59 | {585F9348-63A1-4917-998D-378E9802EF86}.Release|x64.Build.0 = Release|x64 60 | {F6D3A8CA-1F98-4777-A9F6-0AC6847857D8}.Debug|x64.ActiveCfg = Debug|x64 61 | {F6D3A8CA-1F98-4777-A9F6-0AC6847857D8}.Debug|x64.Build.0 = Debug|x64 62 | {F6D3A8CA-1F98-4777-A9F6-0AC6847857D8}.Release|x64.ActiveCfg = Release|x64 63 | {F6D3A8CA-1F98-4777-A9F6-0AC6847857D8}.Release|x64.Build.0 = Release|x64 64 | {51C084C8-CE48-44F1-B936-4EAF7EE3B682}.Debug|x64.ActiveCfg = Debug|x64 65 | {51C084C8-CE48-44F1-B936-4EAF7EE3B682}.Debug|x64.Build.0 = Debug|x64 66 | {51C084C8-CE48-44F1-B936-4EAF7EE3B682}.Release|x64.ActiveCfg = Release|x64 67 | {51C084C8-CE48-44F1-B936-4EAF7EE3B682}.Release|x64.Build.0 = Release|x64 68 | {0D84A42C-5A23-4347-A489-C9A96C7EC24A}.Debug|x64.ActiveCfg = Debug|x64 69 | {0D84A42C-5A23-4347-A489-C9A96C7EC24A}.Debug|x64.Build.0 = Debug|x64 70 | {0D84A42C-5A23-4347-A489-C9A96C7EC24A}.Release|x64.ActiveCfg = Release|x64 71 | {0D84A42C-5A23-4347-A489-C9A96C7EC24A}.Release|x64.Build.0 = Release|x64 72 | EndGlobalSection 73 | GlobalSection(SolutionProperties) = preSolution 74 | HideSolutionNode = FALSE 75 | EndGlobalSection 76 | EndGlobal 77 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LearnCinderGL 2 | A series of tutorials designed to get folks up and running with Cinder (glNext/0.9.0) 3 | 4 | ## UNDER CONSTRUCTION 5 | ![Header Image](https://lh3.googleusercontent.com/-j50yAJ2gew0/VXH_nF5fkNI/AAAAAAAAB48/NPwQ8ivbY-o/s800/cindertuts.png) 6 | 7 | ###Setup for XCode Users: 8 | Place these in your cinder folder inside another directory - such as: `Cinder_Root_Directory/samples` 9 | 10 | So the path to the XCode file for L01_Camera would be: `Cinder_Root_Directory/samples/LearnCinderGL/L01_Camera/xcode/L01_Camera.xcodeproj` 11 | 12 | If you want to put the apps in another location, you just need to change this in your project Build settings - all the way at the bottom of the "Build Settings" tab on the project settings, there is a variable called `CINDER_PATH` it is currently set to `../../../.. ` indicating that the path to Cinder's libraries are 4 directories away - if you want to nest these deeper or more shallow, just change this... -------------------------------------------------------------------------------- /Solutions/L01_Ex1/include/Resources.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "cinder/CinderResources.h" 3 | 4 | //#define RES_MY_RES CINDER_RESOURCE( ../resources/, image_name.png, 128, IMAGE ) 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Solutions/L01_Ex1/resources/cinder_app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SethGibson/LearnCinderGL/3ab8fb94b6961e3d43e132e1d48c35f22c07cae0/Solutions/L01_Ex1/resources/cinder_app_icon.ico -------------------------------------------------------------------------------- /Solutions/L01_Ex1/src/L01_Ex1App.cpp: -------------------------------------------------------------------------------- 1 | #include "cinder/app/App.h" 2 | #include "cinder/app/RendererGl.h" 3 | #include "cinder/gl/gl.h" 4 | 5 | using namespace ci; 6 | using namespace ci::app; 7 | using namespace std; 8 | 9 | class L01_Ex1App : public App { 10 | public: 11 | void setup() override; 12 | void mouseDown( MouseEvent event ) override; 13 | void update() override; 14 | void draw() override; 15 | }; 16 | 17 | void L01_Ex1App::setup() 18 | { 19 | } 20 | 21 | void L01_Ex1App::mouseDown( MouseEvent event ) 22 | { 23 | } 24 | 25 | void L01_Ex1App::update() 26 | { 27 | } 28 | 29 | void L01_Ex1App::draw() 30 | { 31 | gl::clear( Color( 0, 0, 0 ) ); 32 | } 33 | 34 | CINDER_APP( L01_Ex1App, RendererGl ) 35 | -------------------------------------------------------------------------------- /Solutions/L01_Ex1/vc2013/L01_Ex1.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "L01_Ex1", "L01_Ex1.vcxproj", "{CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x64 = Debug|x64 9 | Release|x64 = Release|x64 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}.Debug|x64.ActiveCfg = Debug|x64 13 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}.Debug|x64.Build.0 = Debug|x64 14 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}.Release|x64.ActiveCfg = Release|x64 15 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}.Release|x64.Build.0 = Release|x64 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /Solutions/L01_Ex1/vc2013/L01_Ex1.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | x64 6 | 7 | 8 | Release 9 | x64 10 | 11 | 12 | 13 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F} 14 | L01_Ex1 15 | Win32Proj 16 | 17 | 18 | 19 | Application 20 | false 21 | v120 22 | Unicode 23 | true 24 | 25 | 26 | Application 27 | true 28 | v120 29 | Unicode 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | <_ProjectFileVersion>10.0.30319.1 42 | true 43 | false 44 | 45 | 46 | 47 | Disabled 48 | ..\include;"..\..\..\..\..\..\libs\Cinder\include" 49 | WIN32;_DEBUG;_WINDOWS;NOMINMAX;_WIN32_WINNT=0x0502;%(PreprocessorDefinitions) 50 | EnableFastChecks 51 | MultiThreadedDebug 52 | 53 | Level3 54 | ProgramDatabase 55 | true 56 | 57 | 58 | "..\..\..\..\..\..\libs\Cinder\include";..\include 59 | 60 | 61 | cinder-$(PlatformToolset)_d.lib;OpenGL32.lib;%(AdditionalDependencies) 62 | "..\..\..\..\..\..\libs\Cinder\lib\msw\$(PlatformTarget)" 63 | true 64 | Windows 65 | false 66 | 67 | LIBCMT;LIBCPMT 68 | 69 | 70 | 71 | 72 | ..\include;"..\..\..\..\..\..\libs\Cinder\include" 73 | WIN32;NDEBUG;_WINDOWS;NOMINMAX;_WIN32_WINNT=0x0502;%(PreprocessorDefinitions) 74 | MultiThreaded 75 | 76 | Level3 77 | ProgramDatabase 78 | true 79 | 80 | 81 | true 82 | 83 | 84 | "..\..\..\..\..\..\libs\Cinder\include";..\include 85 | 86 | 87 | cinder-$(PlatformToolset).lib;OpenGL32.lib;%(AdditionalDependencies) 88 | "..\..\..\..\..\..\libs\Cinder\lib\msw\$(PlatformTarget)" 89 | false 90 | true 91 | Windows 92 | true 93 | 94 | false 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /Solutions/L01_Ex1/vc2013/L01_Ex1.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 5 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 6 | 7 | 8 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 9 | h;hpp;hxx;hm;inl;inc;xsd 10 | 11 | 12 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 13 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 14 | 15 | 16 | 17 | 18 | Source Files 19 | 20 | 21 | Source Files 22 | 23 | 24 | Header Files 25 | 26 | 27 | 28 | 29 | Header Files 30 | 31 | 32 | 33 | 34 | Resource Files 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /Solutions/L01_Ex1/vc2013/Resources.rc: -------------------------------------------------------------------------------- 1 | #include "../include/Resources.h" 2 | 3 | 1 ICON "..\\resources\\cinder_app_icon.ico" 4 | -------------------------------------------------------------------------------- /Solutions/L01_Ex2/include/Resources.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "cinder/CinderResources.h" 3 | 4 | //#define RES_MY_RES CINDER_RESOURCE( ../resources/, image_name.png, 128, IMAGE ) 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Solutions/L01_Ex2/resources/cinder_app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SethGibson/LearnCinderGL/3ab8fb94b6961e3d43e132e1d48c35f22c07cae0/Solutions/L01_Ex2/resources/cinder_app_icon.ico -------------------------------------------------------------------------------- /Solutions/L01_Ex2/src/L01_Ex2.cpp: -------------------------------------------------------------------------------- 1 | #include "cinder/app/App.h" 2 | #include "cinder/app/RendererGl.h" 3 | #include "cinder/gl/gl.h" 4 | 5 | using namespace ci; 6 | using namespace ci::app; 7 | using namespace std; 8 | 9 | class L01_Ex1App : public App { 10 | public: 11 | void setup() override; 12 | void mouseDown( MouseEvent event ) override; 13 | void update() override; 14 | void draw() override; 15 | }; 16 | 17 | void L01_Ex1App::setup() 18 | { 19 | } 20 | 21 | void L01_Ex1App::mouseDown( MouseEvent event ) 22 | { 23 | } 24 | 25 | void L01_Ex1App::update() 26 | { 27 | } 28 | 29 | void L01_Ex1App::draw() 30 | { 31 | gl::clear( Color( 0, 0, 0 ) ); 32 | } 33 | 34 | CINDER_APP( L01_Ex1App, RendererGl ) 35 | -------------------------------------------------------------------------------- /Solutions/L01_Ex2/vc2013/L01_Ex2.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "L01_Ex1", "L01_Ex1.vcxproj", "{CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x64 = Debug|x64 9 | Release|x64 = Release|x64 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}.Debug|x64.ActiveCfg = Debug|x64 13 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}.Debug|x64.Build.0 = Debug|x64 14 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}.Release|x64.ActiveCfg = Release|x64 15 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}.Release|x64.Build.0 = Release|x64 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /Solutions/L01_Ex2/vc2013/L01_Ex2.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | x64 6 | 7 | 8 | Release 9 | x64 10 | 11 | 12 | 13 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F} 14 | L01_Ex1 15 | Win32Proj 16 | 17 | 18 | 19 | Application 20 | false 21 | v120 22 | Unicode 23 | true 24 | 25 | 26 | Application 27 | true 28 | v120 29 | Unicode 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | <_ProjectFileVersion>10.0.30319.1 42 | true 43 | false 44 | 45 | 46 | 47 | Disabled 48 | ..\include;"..\..\..\..\..\..\libs\Cinder\include" 49 | WIN32;_DEBUG;_WINDOWS;NOMINMAX;_WIN32_WINNT=0x0502;%(PreprocessorDefinitions) 50 | EnableFastChecks 51 | MultiThreadedDebug 52 | 53 | Level3 54 | ProgramDatabase 55 | true 56 | 57 | 58 | "..\..\..\..\..\..\libs\Cinder\include";..\include 59 | 60 | 61 | cinder-$(PlatformToolset)_d.lib;OpenGL32.lib;%(AdditionalDependencies) 62 | "..\..\..\..\..\..\libs\Cinder\lib\msw\$(PlatformTarget)" 63 | true 64 | Windows 65 | false 66 | 67 | LIBCMT;LIBCPMT 68 | 69 | 70 | 71 | 72 | ..\include;"..\..\..\..\..\..\libs\Cinder\include" 73 | WIN32;NDEBUG;_WINDOWS;NOMINMAX;_WIN32_WINNT=0x0502;%(PreprocessorDefinitions) 74 | MultiThreaded 75 | 76 | Level3 77 | ProgramDatabase 78 | true 79 | 80 | 81 | true 82 | 83 | 84 | "..\..\..\..\..\..\libs\Cinder\include";..\include 85 | 86 | 87 | cinder-$(PlatformToolset).lib;OpenGL32.lib;%(AdditionalDependencies) 88 | "..\..\..\..\..\..\libs\Cinder\lib\msw\$(PlatformTarget)" 89 | false 90 | true 91 | Windows 92 | true 93 | 94 | false 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /Solutions/L01_Ex2/vc2013/L01_Ex2.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 5 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 6 | 7 | 8 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 9 | h;hpp;hxx;hm;inl;inc;xsd 10 | 11 | 12 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 13 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 14 | 15 | 16 | 17 | 18 | Source Files 19 | 20 | 21 | Source Files 22 | 23 | 24 | Header Files 25 | 26 | 27 | 28 | 29 | Header Files 30 | 31 | 32 | 33 | 34 | Resource Files 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /Solutions/L01_Ex2/vc2013/Resources.rc: -------------------------------------------------------------------------------- 1 | #include "../include/Resources.h" 2 | 3 | 1 ICON "..\\resources\\cinder_app_icon.ico" 4 | -------------------------------------------------------------------------------- /Solutions/L01_Ex3/include/Resources.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "cinder/CinderResources.h" 3 | 4 | //#define RES_MY_RES CINDER_RESOURCE( ../resources/, image_name.png, 128, IMAGE ) 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Solutions/L01_Ex3/resources/cinder_app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SethGibson/LearnCinderGL/3ab8fb94b6961e3d43e132e1d48c35f22c07cae0/Solutions/L01_Ex3/resources/cinder_app_icon.ico -------------------------------------------------------------------------------- /Solutions/L01_Ex3/src/L01_Ex3.cpp: -------------------------------------------------------------------------------- 1 | #include "cinder/app/App.h" 2 | #include "cinder/app/RendererGl.h" 3 | #include "cinder/gl/gl.h" 4 | 5 | using namespace ci; 6 | using namespace ci::app; 7 | using namespace std; 8 | 9 | class L01_Ex1App : public App { 10 | public: 11 | void setup() override; 12 | void mouseDown( MouseEvent event ) override; 13 | void update() override; 14 | void draw() override; 15 | }; 16 | 17 | void L01_Ex1App::setup() 18 | { 19 | } 20 | 21 | void L01_Ex1App::mouseDown( MouseEvent event ) 22 | { 23 | } 24 | 25 | void L01_Ex1App::update() 26 | { 27 | } 28 | 29 | void L01_Ex1App::draw() 30 | { 31 | gl::clear( Color( 0, 0, 0 ) ); 32 | } 33 | 34 | CINDER_APP( L01_Ex1App, RendererGl ) 35 | -------------------------------------------------------------------------------- /Solutions/L01_Ex3/vc2013/L01_Ex3.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "L01_Ex1", "L01_Ex1.vcxproj", "{CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x64 = Debug|x64 9 | Release|x64 = Release|x64 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}.Debug|x64.ActiveCfg = Debug|x64 13 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}.Debug|x64.Build.0 = Debug|x64 14 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}.Release|x64.ActiveCfg = Release|x64 15 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}.Release|x64.Build.0 = Release|x64 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /Solutions/L01_Ex3/vc2013/L01_Ex3.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | x64 6 | 7 | 8 | Release 9 | x64 10 | 11 | 12 | 13 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F} 14 | L01_Ex1 15 | Win32Proj 16 | 17 | 18 | 19 | Application 20 | false 21 | v120 22 | Unicode 23 | true 24 | 25 | 26 | Application 27 | true 28 | v120 29 | Unicode 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | <_ProjectFileVersion>10.0.30319.1 42 | true 43 | false 44 | 45 | 46 | 47 | Disabled 48 | ..\include;"..\..\..\..\..\..\libs\Cinder\include" 49 | WIN32;_DEBUG;_WINDOWS;NOMINMAX;_WIN32_WINNT=0x0502;%(PreprocessorDefinitions) 50 | EnableFastChecks 51 | MultiThreadedDebug 52 | 53 | Level3 54 | ProgramDatabase 55 | true 56 | 57 | 58 | "..\..\..\..\..\..\libs\Cinder\include";..\include 59 | 60 | 61 | cinder-$(PlatformToolset)_d.lib;OpenGL32.lib;%(AdditionalDependencies) 62 | "..\..\..\..\..\..\libs\Cinder\lib\msw\$(PlatformTarget)" 63 | true 64 | Windows 65 | false 66 | 67 | LIBCMT;LIBCPMT 68 | 69 | 70 | 71 | 72 | ..\include;"..\..\..\..\..\..\libs\Cinder\include" 73 | WIN32;NDEBUG;_WINDOWS;NOMINMAX;_WIN32_WINNT=0x0502;%(PreprocessorDefinitions) 74 | MultiThreaded 75 | 76 | Level3 77 | ProgramDatabase 78 | true 79 | 80 | 81 | true 82 | 83 | 84 | "..\..\..\..\..\..\libs\Cinder\include";..\include 85 | 86 | 87 | cinder-$(PlatformToolset).lib;OpenGL32.lib;%(AdditionalDependencies) 88 | "..\..\..\..\..\..\libs\Cinder\lib\msw\$(PlatformTarget)" 89 | false 90 | true 91 | Windows 92 | true 93 | 94 | false 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /Solutions/L01_Ex3/vc2013/L01_Ex3.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 5 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 6 | 7 | 8 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 9 | h;hpp;hxx;hm;inl;inc;xsd 10 | 11 | 12 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 13 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 14 | 15 | 16 | 17 | 18 | Source Files 19 | 20 | 21 | Source Files 22 | 23 | 24 | Header Files 25 | 26 | 27 | 28 | 29 | Header Files 30 | 31 | 32 | 33 | 34 | Resource Files 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /Solutions/L01_Ex3/vc2013/Resources.rc: -------------------------------------------------------------------------------- 1 | #include "../include/Resources.h" 2 | 3 | 1 ICON "..\\resources\\cinder_app_icon.ico" 4 | -------------------------------------------------------------------------------- /Solutions/L02_Ex1/include/Resources.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "cinder/CinderResources.h" 3 | 4 | //#define RES_MY_RES CINDER_RESOURCE( ../resources/, image_name.png, 128, IMAGE ) 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Solutions/L02_Ex1/resources/cinder_app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SethGibson/LearnCinderGL/3ab8fb94b6961e3d43e132e1d48c35f22c07cae0/Solutions/L02_Ex1/resources/cinder_app_icon.ico -------------------------------------------------------------------------------- /Solutions/L02_Ex1/src/L02_Ex1App.cpp: -------------------------------------------------------------------------------- 1 | #include "cinder/app/App.h" 2 | #include "cinder/app/RendererGl.h" 3 | #include "cinder/gl/gl.h" 4 | 5 | using namespace ci; 6 | using namespace ci::app; 7 | using namespace std; 8 | 9 | class L01_Ex1App : public App { 10 | public: 11 | void setup() override; 12 | void mouseDown( MouseEvent event ) override; 13 | void update() override; 14 | void draw() override; 15 | }; 16 | 17 | void L01_Ex1App::setup() 18 | { 19 | } 20 | 21 | void L01_Ex1App::mouseDown( MouseEvent event ) 22 | { 23 | } 24 | 25 | void L01_Ex1App::update() 26 | { 27 | } 28 | 29 | void L01_Ex1App::draw() 30 | { 31 | gl::clear( Color( 0, 0, 0 ) ); 32 | } 33 | 34 | CINDER_APP( L01_Ex1App, RendererGl ) 35 | -------------------------------------------------------------------------------- /Solutions/L02_Ex1/vc2013/L02_Ex1.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "L01_Ex1", "L01_Ex1.vcxproj", "{CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x64 = Debug|x64 9 | Release|x64 = Release|x64 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}.Debug|x64.ActiveCfg = Debug|x64 13 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}.Debug|x64.Build.0 = Debug|x64 14 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}.Release|x64.ActiveCfg = Release|x64 15 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}.Release|x64.Build.0 = Release|x64 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /Solutions/L02_Ex1/vc2013/L02_Ex1.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | x64 6 | 7 | 8 | Release 9 | x64 10 | 11 | 12 | 13 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F} 14 | L01_Ex1 15 | Win32Proj 16 | 17 | 18 | 19 | Application 20 | false 21 | v120 22 | Unicode 23 | true 24 | 25 | 26 | Application 27 | true 28 | v120 29 | Unicode 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | <_ProjectFileVersion>10.0.30319.1 42 | true 43 | false 44 | 45 | 46 | 47 | Disabled 48 | ..\include;"..\..\..\..\..\..\libs\Cinder\include" 49 | WIN32;_DEBUG;_WINDOWS;NOMINMAX;_WIN32_WINNT=0x0502;%(PreprocessorDefinitions) 50 | EnableFastChecks 51 | MultiThreadedDebug 52 | 53 | Level3 54 | ProgramDatabase 55 | true 56 | 57 | 58 | "..\..\..\..\..\..\libs\Cinder\include";..\include 59 | 60 | 61 | cinder-$(PlatformToolset)_d.lib;OpenGL32.lib;%(AdditionalDependencies) 62 | "..\..\..\..\..\..\libs\Cinder\lib\msw\$(PlatformTarget)" 63 | true 64 | Windows 65 | false 66 | 67 | LIBCMT;LIBCPMT 68 | 69 | 70 | 71 | 72 | ..\include;"..\..\..\..\..\..\libs\Cinder\include" 73 | WIN32;NDEBUG;_WINDOWS;NOMINMAX;_WIN32_WINNT=0x0502;%(PreprocessorDefinitions) 74 | MultiThreaded 75 | 76 | Level3 77 | ProgramDatabase 78 | true 79 | 80 | 81 | true 82 | 83 | 84 | "..\..\..\..\..\..\libs\Cinder\include";..\include 85 | 86 | 87 | cinder-$(PlatformToolset).lib;OpenGL32.lib;%(AdditionalDependencies) 88 | "..\..\..\..\..\..\libs\Cinder\lib\msw\$(PlatformTarget)" 89 | false 90 | true 91 | Windows 92 | true 93 | 94 | false 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /Solutions/L02_Ex1/vc2013/L02_Ex1.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 5 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 6 | 7 | 8 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 9 | h;hpp;hxx;hm;inl;inc;xsd 10 | 11 | 12 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 13 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 14 | 15 | 16 | 17 | 18 | Source Files 19 | 20 | 21 | Source Files 22 | 23 | 24 | Header Files 25 | 26 | 27 | 28 | 29 | Header Files 30 | 31 | 32 | 33 | 34 | Resource Files 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /Solutions/L02_Ex1/vc2013/Resources.rc: -------------------------------------------------------------------------------- 1 | #include "../include/Resources.h" 2 | 3 | 1 ICON "..\\resources\\cinder_app_icon.ico" 4 | -------------------------------------------------------------------------------- /Solutions/L02_Ex2/include/Resources.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "cinder/CinderResources.h" 3 | 4 | //#define RES_MY_RES CINDER_RESOURCE( ../resources/, image_name.png, 128, IMAGE ) 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Solutions/L02_Ex2/resources/cinder_app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SethGibson/LearnCinderGL/3ab8fb94b6961e3d43e132e1d48c35f22c07cae0/Solutions/L02_Ex2/resources/cinder_app_icon.ico -------------------------------------------------------------------------------- /Solutions/L02_Ex2/src/L01_Ex1App.cpp: -------------------------------------------------------------------------------- 1 | #include "cinder/app/App.h" 2 | #include "cinder/app/RendererGl.h" 3 | #include "cinder/gl/gl.h" 4 | 5 | using namespace ci; 6 | using namespace ci::app; 7 | using namespace std; 8 | 9 | class L01_Ex1App : public App { 10 | public: 11 | void setup() override; 12 | void mouseDown( MouseEvent event ) override; 13 | void update() override; 14 | void draw() override; 15 | }; 16 | 17 | void L01_Ex1App::setup() 18 | { 19 | } 20 | 21 | void L01_Ex1App::mouseDown( MouseEvent event ) 22 | { 23 | } 24 | 25 | void L01_Ex1App::update() 26 | { 27 | } 28 | 29 | void L01_Ex1App::draw() 30 | { 31 | gl::clear( Color( 0, 0, 0 ) ); 32 | } 33 | 34 | CINDER_APP( L01_Ex1App, RendererGl ) 35 | -------------------------------------------------------------------------------- /Solutions/L02_Ex2/vc2013/L02_Ex2.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "L01_Ex1", "L01_Ex1.vcxproj", "{CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x64 = Debug|x64 9 | Release|x64 = Release|x64 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}.Debug|x64.ActiveCfg = Debug|x64 13 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}.Debug|x64.Build.0 = Debug|x64 14 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}.Release|x64.ActiveCfg = Release|x64 15 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}.Release|x64.Build.0 = Release|x64 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /Solutions/L02_Ex2/vc2013/L02_Ex2.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 5 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 6 | 7 | 8 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 9 | h;hpp;hxx;hm;inl;inc;xsd 10 | 11 | 12 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 13 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 14 | 15 | 16 | 17 | 18 | Source Files 19 | 20 | 21 | Source Files 22 | 23 | 24 | Header Files 25 | 26 | 27 | 28 | 29 | Header Files 30 | 31 | 32 | 33 | 34 | Resource Files 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /Solutions/L02_Ex2/vc2013/Resources.rc: -------------------------------------------------------------------------------- 1 | #include "../include/Resources.h" 2 | 3 | 1 ICON "..\\resources\\cinder_app_icon.ico" 4 | -------------------------------------------------------------------------------- /Solutions/L02_Ex3/include/Resources.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "cinder/CinderResources.h" 3 | 4 | //#define RES_MY_RES CINDER_RESOURCE( ../resources/, image_name.png, 128, IMAGE ) 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Solutions/L02_Ex3/resources/cinder_app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SethGibson/LearnCinderGL/3ab8fb94b6961e3d43e132e1d48c35f22c07cae0/Solutions/L02_Ex3/resources/cinder_app_icon.ico -------------------------------------------------------------------------------- /Solutions/L02_Ex3/src/L01_Ex1App.cpp: -------------------------------------------------------------------------------- 1 | #include "cinder/app/App.h" 2 | #include "cinder/app/RendererGl.h" 3 | #include "cinder/gl/gl.h" 4 | 5 | using namespace ci; 6 | using namespace ci::app; 7 | using namespace std; 8 | 9 | class L01_Ex1App : public App { 10 | public: 11 | void setup() override; 12 | void mouseDown( MouseEvent event ) override; 13 | void update() override; 14 | void draw() override; 15 | }; 16 | 17 | void L01_Ex1App::setup() 18 | { 19 | } 20 | 21 | void L01_Ex1App::mouseDown( MouseEvent event ) 22 | { 23 | } 24 | 25 | void L01_Ex1App::update() 26 | { 27 | } 28 | 29 | void L01_Ex1App::draw() 30 | { 31 | gl::clear( Color( 0, 0, 0 ) ); 32 | } 33 | 34 | CINDER_APP( L01_Ex1App, RendererGl ) 35 | -------------------------------------------------------------------------------- /Solutions/L02_Ex3/vc2013/L01_Ex1.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "L01_Ex1", "L01_Ex1.vcxproj", "{CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x64 = Debug|x64 9 | Release|x64 = Release|x64 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}.Debug|x64.ActiveCfg = Debug|x64 13 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}.Debug|x64.Build.0 = Debug|x64 14 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}.Release|x64.ActiveCfg = Release|x64 15 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}.Release|x64.Build.0 = Release|x64 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /Solutions/L02_Ex3/vc2013/L01_Ex1.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 5 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 6 | 7 | 8 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 9 | h;hpp;hxx;hm;inl;inc;xsd 10 | 11 | 12 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 13 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 14 | 15 | 16 | 17 | 18 | Source Files 19 | 20 | 21 | Source Files 22 | 23 | 24 | Header Files 25 | 26 | 27 | 28 | 29 | Header Files 30 | 31 | 32 | 33 | 34 | Resource Files 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /Solutions/L02_Ex3/vc2013/Resources.rc: -------------------------------------------------------------------------------- 1 | #include "../include/Resources.h" 2 | 3 | 1 ICON "..\\resources\\cinder_app_icon.ico" 4 | -------------------------------------------------------------------------------- /Solutions/L03_Ex1/include/Resources.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "cinder/CinderResources.h" 3 | 4 | //#define RES_MY_RES CINDER_RESOURCE( ../resources/, image_name.png, 128, IMAGE ) 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Solutions/L03_Ex1/resources/cinder_app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SethGibson/LearnCinderGL/3ab8fb94b6961e3d43e132e1d48c35f22c07cae0/Solutions/L03_Ex1/resources/cinder_app_icon.ico -------------------------------------------------------------------------------- /Solutions/L03_Ex1/src/L03_Ex1.cpp: -------------------------------------------------------------------------------- 1 | #include "cinder/app/App.h" 2 | #include "cinder/app/RendererGl.h" 3 | #include "cinder/gl/gl.h" 4 | 5 | using namespace ci; 6 | using namespace ci::app; 7 | using namespace std; 8 | 9 | class L01_Ex1App : public App { 10 | public: 11 | void setup() override; 12 | void mouseDown( MouseEvent event ) override; 13 | void update() override; 14 | void draw() override; 15 | }; 16 | 17 | void L01_Ex1App::setup() 18 | { 19 | } 20 | 21 | void L01_Ex1App::mouseDown( MouseEvent event ) 22 | { 23 | } 24 | 25 | void L01_Ex1App::update() 26 | { 27 | } 28 | 29 | void L01_Ex1App::draw() 30 | { 31 | gl::clear( Color( 0, 0, 0 ) ); 32 | } 33 | 34 | CINDER_APP( L01_Ex1App, RendererGl ) 35 | -------------------------------------------------------------------------------- /Solutions/L03_Ex1/vc2013/L03_Ex1.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "L01_Ex1", "L01_Ex1.vcxproj", "{CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x64 = Debug|x64 9 | Release|x64 = Release|x64 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}.Debug|x64.ActiveCfg = Debug|x64 13 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}.Debug|x64.Build.0 = Debug|x64 14 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}.Release|x64.ActiveCfg = Release|x64 15 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}.Release|x64.Build.0 = Release|x64 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /Solutions/L03_Ex1/vc2013/L03_Ex1.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 5 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 6 | 7 | 8 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 9 | h;hpp;hxx;hm;inl;inc;xsd 10 | 11 | 12 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 13 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 14 | 15 | 16 | 17 | 18 | Source Files 19 | 20 | 21 | Source Files 22 | 23 | 24 | Header Files 25 | 26 | 27 | 28 | 29 | Header Files 30 | 31 | 32 | 33 | 34 | Resource Files 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /Solutions/L03_Ex1/vc2013/Resources.rc: -------------------------------------------------------------------------------- 1 | #include "../include/Resources.h" 2 | 3 | 1 ICON "..\\resources\\cinder_app_icon.ico" 4 | -------------------------------------------------------------------------------- /Solutions/L03_Ex2/include/Resources.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "cinder/CinderResources.h" 3 | 4 | //#define RES_MY_RES CINDER_RESOURCE( ../resources/, image_name.png, 128, IMAGE ) 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Solutions/L03_Ex2/resources/cinder_app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SethGibson/LearnCinderGL/3ab8fb94b6961e3d43e132e1d48c35f22c07cae0/Solutions/L03_Ex2/resources/cinder_app_icon.ico -------------------------------------------------------------------------------- /Solutions/L03_Ex2/src/L03_Ex2.cpp: -------------------------------------------------------------------------------- 1 | #include "cinder/app/App.h" 2 | #include "cinder/app/RendererGl.h" 3 | #include "cinder/gl/gl.h" 4 | 5 | using namespace ci; 6 | using namespace ci::app; 7 | using namespace std; 8 | 9 | class L01_Ex1App : public App { 10 | public: 11 | void setup() override; 12 | void mouseDown( MouseEvent event ) override; 13 | void update() override; 14 | void draw() override; 15 | }; 16 | 17 | void L01_Ex1App::setup() 18 | { 19 | } 20 | 21 | void L01_Ex1App::mouseDown( MouseEvent event ) 22 | { 23 | } 24 | 25 | void L01_Ex1App::update() 26 | { 27 | } 28 | 29 | void L01_Ex1App::draw() 30 | { 31 | gl::clear( Color( 0, 0, 0 ) ); 32 | } 33 | 34 | CINDER_APP( L01_Ex1App, RendererGl ) 35 | -------------------------------------------------------------------------------- /Solutions/L03_Ex2/vc2013/L03_Ex2.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "L01_Ex1", "L01_Ex1.vcxproj", "{CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x64 = Debug|x64 9 | Release|x64 = Release|x64 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}.Debug|x64.ActiveCfg = Debug|x64 13 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}.Debug|x64.Build.0 = Debug|x64 14 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}.Release|x64.ActiveCfg = Release|x64 15 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}.Release|x64.Build.0 = Release|x64 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /Solutions/L03_Ex2/vc2013/L03_Ex2.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 5 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 6 | 7 | 8 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 9 | h;hpp;hxx;hm;inl;inc;xsd 10 | 11 | 12 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 13 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 14 | 15 | 16 | 17 | 18 | Source Files 19 | 20 | 21 | Source Files 22 | 23 | 24 | Header Files 25 | 26 | 27 | 28 | 29 | Header Files 30 | 31 | 32 | 33 | 34 | Resource Files 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /Solutions/L03_Ex2/vc2013/Resources.rc: -------------------------------------------------------------------------------- 1 | #include "../include/Resources.h" 2 | 3 | 1 ICON "..\\resources\\cinder_app_icon.ico" 4 | -------------------------------------------------------------------------------- /Solutions/L03_Ex3/include/Resources.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "cinder/CinderResources.h" 3 | 4 | //#define RES_MY_RES CINDER_RESOURCE( ../resources/, image_name.png, 128, IMAGE ) 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Solutions/L03_Ex3/resources/cinder_app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SethGibson/LearnCinderGL/3ab8fb94b6961e3d43e132e1d48c35f22c07cae0/Solutions/L03_Ex3/resources/cinder_app_icon.ico -------------------------------------------------------------------------------- /Solutions/L03_Ex3/src/L03_Ex3.cpp: -------------------------------------------------------------------------------- 1 | #include "cinder/app/App.h" 2 | #include "cinder/app/RendererGl.h" 3 | #include "cinder/gl/gl.h" 4 | 5 | using namespace ci; 6 | using namespace ci::app; 7 | using namespace std; 8 | 9 | class L01_Ex1App : public App { 10 | public: 11 | void setup() override; 12 | void mouseDown( MouseEvent event ) override; 13 | void update() override; 14 | void draw() override; 15 | }; 16 | 17 | void L01_Ex1App::setup() 18 | { 19 | } 20 | 21 | void L01_Ex1App::mouseDown( MouseEvent event ) 22 | { 23 | } 24 | 25 | void L01_Ex1App::update() 26 | { 27 | } 28 | 29 | void L01_Ex1App::draw() 30 | { 31 | gl::clear( Color( 0, 0, 0 ) ); 32 | } 33 | 34 | CINDER_APP( L01_Ex1App, RendererGl ) 35 | -------------------------------------------------------------------------------- /Solutions/L03_Ex3/vc2013/L03_Ex3.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "L01_Ex1", "L01_Ex1.vcxproj", "{CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x64 = Debug|x64 9 | Release|x64 = Release|x64 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}.Debug|x64.ActiveCfg = Debug|x64 13 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}.Debug|x64.Build.0 = Debug|x64 14 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}.Release|x64.ActiveCfg = Release|x64 15 | {CB362AD8-7F98-47BB-8AD2-D8003C7F0F5F}.Release|x64.Build.0 = Release|x64 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /Solutions/L03_Ex3/vc2013/L03_Ex3.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 5 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 6 | 7 | 8 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 9 | h;hpp;hxx;hm;inl;inc;xsd 10 | 11 | 12 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 13 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 14 | 15 | 16 | 17 | 18 | Source Files 19 | 20 | 21 | Source Files 22 | 23 | 24 | Header Files 25 | 26 | 27 | 28 | 29 | Header Files 30 | 31 | 32 | 33 | 34 | Resource Files 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /Solutions/L03_Ex3/vc2013/Resources.rc: -------------------------------------------------------------------------------- 1 | #include "../include/Resources.h" 2 | 3 | 1 ICON "..\\resources\\cinder_app_icon.ico" 4 | --------------------------------------------------------------------------------