├── .gitmodules ├── README.md ├── cinderblock.xml ├── include ├── SvgRenderer.hpp ├── ci_nanovg.hpp └── ci_nanovg_gl.hpp ├── samples ├── HelloSvg │ ├── assets │ │ ├── Roboto-Regular.ttf │ │ └── rainbow_dash.svg │ ├── include │ │ └── Resources.h │ ├── resources │ │ ├── CinderApp.icns │ │ ├── CinderApp_ios.png │ │ └── cinder_app_icon.ico │ ├── src │ │ └── HelloSvgApp.cpp │ ├── vc2013 │ │ ├── .gitignore │ │ ├── HelloSvg.sln │ │ ├── HelloSvg.vcxproj │ │ ├── HelloSvg.vcxproj.filters │ │ └── Resources.rc │ ├── xcode │ │ ├── .gitignore │ │ ├── HelloSvg.xcodeproj │ │ │ └── project.pbxproj │ │ ├── HelloSvg_Prefix.pch │ │ └── Info.plist │ └── xcode_ios │ │ ├── .gitignore │ │ ├── HelloSvg.xcodeproj │ │ └── project.pbxproj │ │ ├── HelloSvg_Prefix.pch │ │ ├── Images.xcassets │ │ └── LaunchImage.launchimage │ │ │ ├── Contents.json │ │ │ ├── Default-568h@2x.png │ │ │ ├── Default-667@2x.png │ │ │ └── Default-736h@3x~iphone.png │ │ └── Info.plist ├── HelloWorld │ ├── assets │ │ └── Roboto-Regular.ttf │ ├── include │ │ └── Resources.h │ ├── resources │ │ ├── CinderApp.icns │ │ ├── CinderApp_ios.png │ │ └── cinder_app_icon.ico │ ├── src │ │ └── HelloWorldApp.cpp │ ├── vc2013 │ │ ├── .gitignore │ │ ├── HelloWorld.sln │ │ ├── HelloWorld.vcxproj │ │ ├── HelloWorld.vcxproj.filters │ │ └── Resources.rc │ ├── xcode │ │ ├── .gitignore │ │ ├── HelloWorld.xcodeproj │ │ │ └── project.pbxproj │ │ ├── HelloWorld_Prefix.pch │ │ └── Info.plist │ └── xcode_ios │ │ ├── .gitignore │ │ ├── HelloWorld.xcodeproj │ │ └── project.pbxproj │ │ ├── HelloWorld_Prefix.pch │ │ ├── Images.xcassets │ │ └── LaunchImage.launchimage │ │ │ ├── Contents.json │ │ │ ├── Default-568h@2x.png │ │ │ ├── Default-667@2x.png │ │ │ └── Default-736h@3x~iphone.png │ │ └── Info.plist ├── MultiWindow │ ├── assets │ │ └── Roboto-Regular.ttf │ ├── include │ │ └── Resources.h │ ├── resources │ │ ├── CinderApp.icns │ │ └── cinder_app_icon.ico │ ├── src │ │ └── MultiWindowApp.cpp │ ├── vc2013 │ │ ├── .gitignore │ │ ├── MultiWindow.sln │ │ ├── MultiWindow.vcxproj │ │ ├── MultiWindow.vcxproj.filters │ │ └── Resources.rc │ └── xcode │ │ ├── .gitignore │ │ ├── Info.plist │ │ ├── MultiWindow.xcodeproj │ │ └── project.pbxproj │ │ └── MultiWindow_Prefix.pch └── RenderToTexture │ ├── assets │ └── Roboto-Regular.ttf │ ├── include │ └── Resources.h │ ├── resources │ ├── CinderApp.icns │ ├── CinderApp_ios.png │ └── cinder_app_icon.ico │ ├── src │ └── RenderToTextureApp.cpp │ ├── vc2013 │ ├── .gitignore │ ├── RenderToTexture.sln │ ├── RenderToTexture.vcxproj │ ├── RenderToTexture.vcxproj.filters │ └── Resources.rc │ ├── xcode │ ├── .gitignore │ ├── Info.plist │ ├── RenderToTexture.xcodeproj │ │ └── project.pbxproj │ └── RenderToTexture_Prefix.pch │ └── xcode_ios │ ├── .gitignore │ ├── Images.xcassets │ └── LaunchImage.launchimage │ │ ├── Contents.json │ │ ├── Default-568h@2x.png │ │ ├── Default-667@2x.png │ │ └── Default-736h@3x~iphone.png │ ├── Info.plist │ ├── RenderToTexture.xcodeproj │ └── project.pbxproj │ └── RenderToTexture_Prefix.pch └── src ├── SvgRenderer.cpp ├── ci_nanovg.cpp └── ci_nanovg_gl.cpp /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "deps/nanovg"] 2 | path = deps/nanovg 3 | url = https://github.com/memononen/nanovg.git 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Cinder-NanoVG 2 | 3 | This is a C++11 wrapper for Mikko Mononen’s awesome GL-backed vector graphics renderer [**NanoVG**](https://github.com/memononen/nanovg). Additionally, it provides overloads for some of Cinder’s datatypes, and functions for rendering Path2d, Shape2d, PolyLine, SVG, etc. Currently this library must be used with the soon to be released [Cinder](https://github.com/cinder/Cinder) 0.9.0 or greater. 4 | 5 | This project is not complete by any means. Features are being added as they are needed. Contributions are definitely welcome! 6 | -------------------------------------------------------------------------------- /cinderblock.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 13 | 14 | 15 | 16 | deps/nanovg/src/*.h 17 | deps/nanovg/src/*.c 18 | include/*.hpp 19 | src/*.cpp 20 | 21 | include/ 22 | deps/nanovg/src/ 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /include/SvgRenderer.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "cinder/svg/Svg.h" 4 | #include 5 | 6 | namespace cinder { namespace nvg { 7 | 8 | class Context; 9 | 10 | class SvgRenderer : public svg::Renderer { 11 | Context &mCtx; // TODO(ryan): This should probably be a managed pointer.. 12 | 13 | std::vector mMatrixStack; 14 | 15 | std::vector mFillStack, mStrokeStack; 16 | std::vector mFillOpacityStack, mStrokeOpacityStack; 17 | std::vector mStrokeWidthStack; 18 | std::vector mLineJoinStack, mLineCapStack; 19 | 20 | std::vector mTextPenStack; 21 | std::vector mTextRotationStack; 22 | 23 | public: 24 | SvgRenderer(Context &ctx); 25 | 26 | bool prepareFill(); 27 | bool prepareStroke(); 28 | void fillAndStroke(); 29 | 30 | void pushGroup(const svg::Group &group, float opacity) override {}; 31 | void popGroup() override {}; 32 | 33 | void drawPath(const svg::Path &path) override; 34 | void drawPolyline(const svg::Polyline &polyline) override; 35 | void drawPolygon(const svg::Polygon &polygon) override; 36 | void drawLine(const svg::Line &line) override; 37 | void drawRect(const svg::Rect &rect) override; 38 | void drawCircle(const svg::Circle &circle) override; 39 | void drawEllipse(const svg::Ellipse &ellipse) override; 40 | void drawImage(const svg::Image &image) override {} 41 | void drawTextSpan(const svg::TextSpan &span) override; 42 | 43 | void pushMatrix(const mat3 &m) override; 44 | void popMatrix() override; 45 | void pushStyle(const svg::Style &style) override {}; 46 | void popStyle() override {}; 47 | void pushFill(const class svg::Paint &paint) override; 48 | void popFill() override; 49 | void pushStroke(const class svg::Paint &paint) override; 50 | void popStroke() override; 51 | void pushFillOpacity(float opacity ) override; 52 | void popFillOpacity() override; 53 | void pushStrokeOpacity(float opacity) override; 54 | void popStrokeOpacity() override; 55 | void pushStrokeWidth(float width) override; 56 | void popStrokeWidth() override; 57 | void pushFillRule(svg::FillRule rule) override; 58 | void popFillRule() override; 59 | void pushLineCap(svg::LineCap lineCap) override; 60 | void popLineCap() override; 61 | void pushLineJoin(svg::LineJoin lineJoin) override; 62 | void popLineJoin() override; 63 | 64 | void pushTextPen(const vec2 &penPos) override; 65 | void popTextPen() override; 66 | void pushTextRotation(float rotation) override; 67 | void popTextRotation() override; 68 | }; 69 | 70 | }} // cinder::nvg 71 | -------------------------------------------------------------------------------- /include/ci_nanovg.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "cinder/Color.h" 4 | #include "cinder/Filesystem.h" 5 | #include "cinder/Matrix.h" 6 | #include "cinder/PolyLine.h" 7 | #include "cinder/Rect.h" 8 | #include "cinder/Shape2d.h" 9 | #include "cinder/Vector.h" 10 | 11 | #include "nanovg.h" 12 | 13 | #include 14 | #include 15 | 16 | namespace cinder { 17 | 18 | namespace svg { 19 | class Paint; 20 | class Doc; 21 | } // svg 22 | 23 | namespace nvg { 24 | 25 | class Image { 26 | protected: 27 | NVGcontext *mCtx = nullptr; 28 | 29 | Image(const Image &) = delete; 30 | Image &operator=(const Image &) = delete; 31 | 32 | public: 33 | int id; 34 | 35 | Image() = default; 36 | Image(Image &&image); 37 | Image(NVGcontext *ctx, int id); 38 | ~Image(); 39 | 40 | Image &operator=(Image &&image); 41 | }; 42 | 43 | class Context { 44 | protected: 45 | using Deleter = void (*)(NVGcontext *); 46 | 47 | std::unique_ptr mPtr; 48 | 49 | void path2dSegment(Path2d::SegmentType, const vec2 *p1, const vec2 *p2, const vec2 *p3); 50 | 51 | public: 52 | Context(NVGcontext *ptr, Deleter deleter); 53 | Context(Context&& ctx) : mPtr{ std::move(ctx.mPtr) } {} 54 | 55 | // NOTE(ryan): Allow this class to be extended. Backends may want to bundle some associated data. 56 | // Subclasses will need to provide their own move constructor. 57 | virtual ~Context() = default; 58 | 59 | inline NVGcontext *get() { return mPtr.get(); } 60 | 61 | // Conversion // 62 | 63 | NVGpaint convert(const svg::Paint &paint); 64 | 65 | // Frame // 66 | 67 | void beginFrame(int windowWidth, int windowHeight, float devicePixelRatio); 68 | void beginFrame(const ivec2 &windowSize, float devicePixelRatio); 69 | void cancelFrame(); 70 | void endFrame(); 71 | 72 | // Global Compositing // 73 | 74 | void globalCompositeOperation(int op); 75 | void globalCompositeBlendFunc(int sfactor, int dfactor); 76 | void globalCompositeBlendFuncSeparate(int srcRGB, int dstRGB, int srcAlpha, int dstAlpha); 77 | 78 | // State Handling // 79 | 80 | void save(); 81 | void restore(); 82 | void reset(); 83 | 84 | // Render Styles // 85 | 86 | void strokeColor(const NVGcolor &color); 87 | void strokeColor(const ColorAf &color); 88 | void strokePaint(const NVGpaint &paint); 89 | void fillColor(const NVGcolor &color); 90 | void fillColor(const ColorAf &color); 91 | void fillPaint(const NVGpaint &paint); 92 | 93 | void strokePaint(const svg::Paint &paint); 94 | void fillPaint(const svg::Paint &paint); 95 | 96 | void miterLimit(float limit); 97 | void strokeWidth(float size); 98 | void lineCap(int cap); 99 | void lineJoin(int join); 100 | 101 | // Transform // 102 | 103 | void resetTransform(); 104 | void transform(const mat3 &mtx); 105 | void setTransform(const mat3 &mtx); 106 | void translate(float x, float y); 107 | void translate(const vec2 &translation); 108 | void rotate(float angle); 109 | void skewX(float angle); 110 | void skewY(float angle); 111 | void scale(float x, float y); 112 | void scale(const vec2 &s); 113 | 114 | mat3 currentTransform(); 115 | 116 | // Paints // 117 | 118 | NVGpaint linearGradient(const vec2 &start, const vec2 &end, const ColorAf &startColor, 119 | const ColorAf &endColor); 120 | NVGpaint boxGradient(const Rectf &bounds, float r, float f, const ColorAf &startColor, 121 | const ColorAf &endColor); 122 | NVGpaint radialGradient(const vec2 ¢er, float innerRad, float outerRad, 123 | const ColorAf &innerColor, const ColorAf &outerColor); 124 | 125 | NVGpaint imagePattern(float cx, float cy, float w, float h, float angle, const Image &image, 126 | float alpha); 127 | 128 | // Scissoring // 129 | 130 | void scissor(float x, float y, float w, float h); 131 | void resetScissor(); 132 | 133 | // Paths // 134 | 135 | void beginPath(); 136 | void moveTo(float x, float y); 137 | void moveTo(const vec2 &p); 138 | void lineTo(float x, float y); 139 | void lineTo(const vec2 &p); 140 | void quadTo(float cx, float cy, float x, float y); 141 | void quadTo(const vec2 &p1, const vec2 &p2); 142 | void bezierTo(float c1x, float c1y, float c2x, float c2y, float x, float y); 143 | void bezierTo(const vec2 &p1, const vec2 &p2, const vec2 &p3); 144 | void arcTo(float x1, float y1, float x2, float y2, float radius); 145 | void arcTo(const vec2 &p1, const vec2 &p2, float radius); 146 | void closePath(); 147 | void pathWinding(int dir); 148 | void arc(float cx, float cy, float r, float a0, float a1, int dir); 149 | void arc(const vec2 ¢er, float r, float a0, float a1, int dir); 150 | void rect(float x, float y, float w, float h); 151 | void rect(const Rectf &r); 152 | void roundedRect(float x, float y, float w, float h, float r); 153 | void roundedRect(const Rectf &rect, float r); 154 | void ellipse(float cx, float cy, float rx, float ry); 155 | void ellipse(const vec2 ¢er, float rx, float ry); 156 | void circle(float cx, float cy, float r); 157 | void circle(const vec2 ¢er, float radius); 158 | 159 | void fill(); 160 | void stroke(); 161 | 162 | // Cinder Types // 163 | 164 | void polyLine(const PolyLine2f &polyline); 165 | void path2d(const Path2d &path); 166 | void shape2d(const Shape2d &shape); 167 | 168 | // Cinder SVG // 169 | 170 | void draw(const svg::Doc &svg); 171 | 172 | // Text // 173 | 174 | int createFont(const std::string &name, const fs::path &filepath); 175 | int createFont(const std::string &name, const std::string &filename); 176 | int findFont(const std::string &name); 177 | 178 | void fontSize(float size); 179 | void fontBlur(float blur); 180 | void fontFaceId(int font); 181 | void fontFace(const std::string &font); 182 | 183 | void textLetterSpacing(float spacing); 184 | void textLineHeight(float lineHeight); 185 | void textAlign(int align); 186 | 187 | float text(float x, float y, const std::string &str); 188 | float text(const vec2 &p, const std::string &str); 189 | 190 | void textBox(float x, float y, float breakRowWidth, const std::string &str); 191 | void textBox(const vec2 &p, float breakRowWidth, const std::string &str); 192 | void textBox(const Rectf &rect, const std::string &str); 193 | 194 | Rectf textBounds(float x, float y, const std::string &str); 195 | Rectf textBounds(const vec2 &p, const std::string &str); 196 | 197 | Rectf textBoxBounds(float x, float y, float breakRowWidth, const std::string &str); 198 | Rectf textBoxBounds(const vec2 &p, float breakRowWidth, const std::string &str); 199 | Rectf textBoxBounds(const Rectf &rect, const std::string &str); 200 | }; 201 | 202 | }} // cinder::nvg 203 | -------------------------------------------------------------------------------- /include/ci_nanovg_gl.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "cinder/gl/platform.h" 4 | #include "ci_nanovg.hpp" 5 | 6 | namespace cinder { namespace nvg { 7 | 8 | class ContextGL : public Context { 9 | public: 10 | ContextGL(NVGcontext *ptr, Deleter deleter) : Context(ptr, deleter) {} 11 | 12 | Image createImageFromHandle(GLuint textureId, int w, int h, int imageFlags); 13 | }; 14 | 15 | ContextGL createContextGL(bool antiAlias = true, bool stencilStrokes = false); 16 | 17 | }} // cinder::nvg 18 | -------------------------------------------------------------------------------- /samples/HelloSvg/assets/Roboto-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notlion/Cinder-NanoVG/691fb921c8517bfe8c7d92da482c906ff24accc6/samples/HelloSvg/assets/Roboto-Regular.ttf -------------------------------------------------------------------------------- /samples/HelloSvg/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 | 9 | -------------------------------------------------------------------------------- /samples/HelloSvg/resources/CinderApp.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notlion/Cinder-NanoVG/691fb921c8517bfe8c7d92da482c906ff24accc6/samples/HelloSvg/resources/CinderApp.icns -------------------------------------------------------------------------------- /samples/HelloSvg/resources/CinderApp_ios.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notlion/Cinder-NanoVG/691fb921c8517bfe8c7d92da482c906ff24accc6/samples/HelloSvg/resources/CinderApp_ios.png -------------------------------------------------------------------------------- /samples/HelloSvg/resources/cinder_app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notlion/Cinder-NanoVG/691fb921c8517bfe8c7d92da482c906ff24accc6/samples/HelloSvg/resources/cinder_app_icon.ico -------------------------------------------------------------------------------- /samples/HelloSvg/src/HelloSvgApp.cpp: -------------------------------------------------------------------------------- 1 | #include "cinder/app/App.h" 2 | #include "cinder/app/RendererGl.h" 3 | 4 | #include "cinder/svg/Svg.h" 5 | #include "cinder/gl/gl.h" 6 | #include "cinder/Color.h" 7 | 8 | #include "ci_nanovg_gl.hpp" 9 | 10 | using namespace ci; 11 | using namespace ci::app; 12 | using namespace std; 13 | 14 | class HelloSvgApp : public App { 15 | shared_ptr mNanoVG; 16 | svg::DocRef mDoc; 17 | 18 | public: 19 | void setup(); 20 | void update(); 21 | void draw(); 22 | }; 23 | 24 | void HelloSvgApp::setup() { 25 | // Create a NanoVG context without anti-aliasing. 26 | mNanoVG = make_shared(nvg::createContextGL(false)); 27 | mNanoVG->createFont("Roboto", getAssetPath("Roboto-Regular.ttf")); 28 | mDoc = svg::Doc::create(loadAsset("rainbow_dash.svg")); 29 | } 30 | 31 | void HelloSvgApp::update() { 32 | } 33 | 34 | void HelloSvgApp::draw() { 35 | gl::clear(Color{0, 0, 0}); 36 | gl::clear(GL_STENCIL_BUFFER_BIT); 37 | 38 | mNanoVG->beginFrame(getWindowSize(), getWindowContentScale()); 39 | mNanoVG->translate(getWindowCenter()); 40 | mNanoVG->scale(vec2(0.75f * float(getWindowHeight()) / float(mDoc->getHeight()))); 41 | mNanoVG->translate(-mDoc->getBounds().getCenter()); 42 | mNanoVG->fontFace("Roboto"); 43 | mNanoVG->draw(*mDoc); 44 | mNanoVG->endFrame(); 45 | } 46 | 47 | // Since we are disabling anti-aliasing in NanoVG, we enable MSAA here. 48 | CINDER_APP(HelloSvgApp, RendererGl(RendererGl::Options().stencil().msaa(4)), 49 | [](App::Settings *settings) { settings->setHighDensityDisplayEnabled(); }) 50 | -------------------------------------------------------------------------------- /samples/HelloSvg/vc2013/.gitignore: -------------------------------------------------------------------------------- 1 | Debug/ 2 | Release/ 3 | *.suo 4 | *.sdf 5 | -------------------------------------------------------------------------------- /samples/HelloSvg/vc2013/HelloSvg.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloSvg", "HelloSvg.vcxproj", "{5B309D62-47AC-4589-ACEB-83FB5E853DF7}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {5B309D62-47AC-4589-ACEB-83FB5E853DF7}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {5B309D62-47AC-4589-ACEB-83FB5E853DF7}.Debug|Win32.Build.0 = Debug|Win32 14 | {5B309D62-47AC-4589-ACEB-83FB5E853DF7}.Release|Win32.ActiveCfg = Release|Win32 15 | {5B309D62-47AC-4589-ACEB-83FB5E853DF7}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /samples/HelloSvg/vc2013/HelloSvg.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | Win32 6 | 7 | 8 | Release 9 | Win32 10 | 11 | 12 | 13 | {5B309D62-47AC-4589-ACEB-83FB5E853DF7} 14 | HelloSvg 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 | $(SolutionDir)$(Configuration)\ 43 | $(Configuration)\ 44 | true 45 | $(SolutionDir)$(Configuration)\ 46 | $(Configuration)\ 47 | false 48 | 49 | 50 | 51 | Disabled 52 | ..\include;"..\..\..\..\..\\include";"..\..\..\..\..\\boost";..\..\..\include;..\..\..\deps\nanovg\src 53 | WIN32;_DEBUG;_WINDOWS;NOMINMAX;_WIN32_WINNT=0x0502;%(PreprocessorDefinitions) 54 | true 55 | EnableFastChecks 56 | MultiThreadedDebug 57 | 58 | Level3 59 | EditAndContinue 60 | true 61 | 62 | 63 | "..\..\..\..\..\\include";..\include 64 | 65 | 66 | cinder-$(PlatformToolset)_d.lib;%(AdditionalDependencies) 67 | "..\..\..\..\..\\lib\msw\$(PlatformTarget)" 68 | true 69 | Windows 70 | false 71 | 72 | MachineX86 73 | LIBCMT;LIBCPMT 74 | 75 | 76 | 77 | 78 | ..\include;"..\..\..\..\..\\include";"..\..\..\..\..\\boost";..\..\..\include;..\..\..\deps\nanovg\src 79 | WIN32;NDEBUG;_WINDOWS;NOMINMAX;_WIN32_WINNT=0x0502;%(PreprocessorDefinitions) 80 | MultiThreaded 81 | 82 | Level3 83 | ProgramDatabase 84 | true 85 | 86 | 87 | true 88 | 89 | 90 | "..\..\..\..\..\\include";..\include 91 | 92 | 93 | cinder-$(PlatformToolset).lib;%(AdditionalDependencies) 94 | "..\..\..\..\..\\lib\msw\$(PlatformTarget)" 95 | false 96 | true 97 | Windows 98 | true 99 | 100 | false 101 | 102 | MachineX86 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /samples/HelloSvg/vc2013/HelloSvg.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 | {E0AA74F3-B7FB-4A91-A001-085A25E48A54} 17 | 18 | 19 | {2D127BC1-A131-4BAB-A570-C9031F6E86BE} 20 | 21 | 22 | {580CED94-BCFD-4F7B-8B47-0A0DC4410D1D} 23 | 24 | 25 | {43968A76-53E6-4F39-B30B-68C7A2CA46B7} 26 | 27 | 28 | {79938C06-C6D8-4943-9ECB-3D72215A870A} 29 | 30 | 31 | {87E8133B-B96C-41E0-AAF1-BF646F537B25} 32 | 33 | 34 | {A733DAB0-F8B4-4DC3-A539-3CC111C391A6} 35 | 36 | 37 | 38 | 39 | Source Files 40 | 41 | 42 | Source Files 43 | 44 | 45 | Header Files 46 | 47 | 48 | Blocks\NanoVG\deps\nanovg\src 49 | 50 | 51 | Blocks\NanoVG\deps\nanovg\src 52 | 53 | 54 | Blocks\NanoVG\deps\nanovg\src 55 | 56 | 57 | Blocks\NanoVG\deps\nanovg\src 58 | 59 | 60 | Blocks\NanoVG\deps\nanovg\src 61 | 62 | 63 | Blocks\NanoVG\deps\nanovg\src 64 | 65 | 66 | Blocks\NanoVG\deps\nanovg\src 67 | 68 | 69 | Blocks\NanoVG\include 70 | 71 | 72 | Blocks\NanoVG\include 73 | 74 | 75 | Blocks\NanoVG\include 76 | 77 | 78 | Blocks\NanoVG\src 79 | 80 | 81 | Blocks\NanoVG\src 82 | 83 | 84 | Blocks\NanoVG\src 85 | 86 | 87 | 88 | 89 | Header Files 90 | 91 | 92 | 93 | 94 | Resource Files 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /samples/HelloSvg/vc2013/Resources.rc: -------------------------------------------------------------------------------- 1 | #include "../include/Resources.h" 2 | 3 | 1 ICON "..\\resources\\cinder_app_icon.ico" 4 | -------------------------------------------------------------------------------- /samples/HelloSvg/xcode/.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | *.pbxuser 3 | !default.pbxuser 4 | *.mode1v3 5 | !default.mode1v3 6 | *.mode2v3 7 | !default.mode2v3 8 | *.perspectivev3 9 | !default.perspectivev3 10 | xcuserdata 11 | *.xccheckout 12 | *.moved-aside 13 | DerivedData 14 | *.xcuserstate 15 | *.xcworkspace 16 | -------------------------------------------------------------------------------- /samples/HelloSvg/xcode/HelloSvg.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 006D720419952D00008149E2 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 006D720219952D00008149E2 /* AVFoundation.framework */; }; 11 | 006D720519952D00008149E2 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 006D720319952D00008149E2 /* CoreMedia.framework */; }; 12 | 0091D8F90E81B9330029341E /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0091D8F80E81B9330029341E /* OpenGL.framework */; }; 13 | 00B784B30FF439BC000DE1D7 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00B784AF0FF439BC000DE1D7 /* Accelerate.framework */; }; 14 | 00B784B40FF439BC000DE1D7 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00B784B00FF439BC000DE1D7 /* AudioToolbox.framework */; }; 15 | 00B784B50FF439BC000DE1D7 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00B784B10FF439BC000DE1D7 /* AudioUnit.framework */; }; 16 | 00B784B60FF439BC000DE1D7 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00B784B20FF439BC000DE1D7 /* CoreAudio.framework */; }; 17 | 1F33D436FCD34252A31428FF /* SvgRenderer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 331837629E624870A70D5618 /* SvgRenderer.cpp */; }; 18 | 2AEA42D6779745D7B455B282 /* HelloSvgApp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E893BA0CD6E349BEB24B2F19 /* HelloSvgApp.cpp */; }; 19 | 4137796B28C84C1EA54A193A /* ci_nanovg_gl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9E8D4C5917B34732877D3F13 /* ci_nanovg_gl.cpp */; }; 20 | 5323E6B20EAFCA74003A9687 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5323E6B10EAFCA74003A9687 /* CoreVideo.framework */; }; 21 | 5323E6B60EAFCA7E003A9687 /* QTKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5323E6B50EAFCA7E003A9687 /* QTKit.framework */; }; 22 | 7CB329C3BBF04E688CACB724 /* ci_nanovg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E57BC86E7B784D03A834767E /* ci_nanovg.cpp */; }; 23 | 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; 24 | 9FE45718D0F04FC9A8BCD5EC /* CinderApp.icns in Resources */ = {isa = PBXBuildFile; fileRef = 2E8B506239564ACC91FD271A /* CinderApp.icns */; }; 25 | D86349FE1B3923B600B5C3D9 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D86349FD1B3923B600B5C3D9 /* IOKit.framework */; }; 26 | F01D65599DE1442E8C5D626A /* nanovg.c in Sources */ = {isa = PBXBuildFile; fileRef = 1F1A3CDD2F70442E80033851 /* nanovg.c */; }; 27 | /* End PBXBuildFile section */ 28 | 29 | /* Begin PBXFileReference section */ 30 | 006D720219952D00008149E2 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; 31 | 006D720319952D00008149E2 /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; }; 32 | 0091D8F80E81B9330029341E /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = ""; }; 33 | 00B784AF0FF439BC000DE1D7 /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; }; 34 | 00B784B00FF439BC000DE1D7 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; 35 | 00B784B10FF439BC000DE1D7 /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = System/Library/Frameworks/AudioUnit.framework; sourceTree = SDKROOT; }; 36 | 00B784B20FF439BC000DE1D7 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; }; 37 | 0BB955051CF6429A8640234E /* SvgRenderer.hpp */ = {isa = PBXFileReference; lastKnownFileType = "\"\""; name = SvgRenderer.hpp; path = ../../../include/SvgRenderer.hpp; sourceTree = ""; }; 38 | 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 39 | 1F1A3CDD2F70442E80033851 /* nanovg.c */ = {isa = PBXFileReference; lastKnownFileType = "\"\""; name = nanovg.c; path = ../../../deps/nanovg/src/nanovg.c; sourceTree = ""; }; 40 | 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 41 | 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 42 | 2E8B506239564ACC91FD271A /* CinderApp.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = CinderApp.icns; path = ../resources/CinderApp.icns; sourceTree = ""; }; 43 | 331837629E624870A70D5618 /* SvgRenderer.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.cpp; name = SvgRenderer.cpp; path = ../../../src/SvgRenderer.cpp; sourceTree = ""; }; 44 | 3525D3A48F844C82A582DDF5 /* nanovg_gl_utils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = nanovg_gl_utils.h; path = ../../../deps/nanovg/src/nanovg_gl_utils.h; sourceTree = ""; }; 45 | 5323E6B10EAFCA74003A9687 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = /System/Library/Frameworks/CoreVideo.framework; sourceTree = ""; }; 46 | 5323E6B50EAFCA7E003A9687 /* QTKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QTKit.framework; path = /System/Library/Frameworks/QTKit.framework; sourceTree = ""; }; 47 | 53E8F7E48ABB4E5B81FF0C37 /* ci_nanovg.hpp */ = {isa = PBXFileReference; lastKnownFileType = "\"\""; name = ci_nanovg.hpp; path = ../../../include/ci_nanovg.hpp; sourceTree = ""; }; 48 | 73BA78BDD7D74BC286FBA45D /* nanovg_gl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = nanovg_gl.h; path = ../../../deps/nanovg/src/nanovg_gl.h; sourceTree = ""; }; 49 | 8D1107320486CEB800E47090 /* HelloSvg.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HelloSvg.app; sourceTree = BUILT_PRODUCTS_DIR; }; 50 | 92811619F5C04F7EAB04FE86 /* HelloSvg_Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = "\"\""; path = HelloSvg_Prefix.pch; sourceTree = ""; }; 51 | 95126EC617D84BE5BFA40DE7 /* nanovg.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = nanovg.h; path = ../../../deps/nanovg/src/nanovg.h; sourceTree = ""; }; 52 | 9E8D4C5917B34732877D3F13 /* ci_nanovg_gl.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.cpp; name = ci_nanovg_gl.cpp; path = ../../../src/ci_nanovg_gl.cpp; sourceTree = ""; }; 53 | A7B22C3962C6430693BB98EA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 54 | C2252C80497D43F595E9BEB4 /* stb_truetype.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = stb_truetype.h; path = ../../../deps/nanovg/src/stb_truetype.h; sourceTree = ""; }; 55 | C87718644C1A42EDB11EDEBC /* Resources.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Resources.h; path = ../include/Resources.h; sourceTree = ""; }; 56 | C911656698F9498780CF4AC6 /* ci_nanovg_gl.hpp */ = {isa = PBXFileReference; lastKnownFileType = "\"\""; name = ci_nanovg_gl.hpp; path = ../../../include/ci_nanovg_gl.hpp; sourceTree = ""; }; 57 | CC8030FA212D495E94314F56 /* fontstash.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = fontstash.h; path = ../../../deps/nanovg/src/fontstash.h; sourceTree = ""; }; 58 | D86349FD1B3923B600B5C3D9 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; }; 59 | E57BC86E7B784D03A834767E /* ci_nanovg.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.cpp; name = ci_nanovg.cpp; path = ../../../src/ci_nanovg.cpp; sourceTree = ""; }; 60 | E82CA687F9AF4C989FF4F349 /* stb_image.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = stb_image.h; path = ../../../deps/nanovg/src/stb_image.h; sourceTree = ""; }; 61 | E893BA0CD6E349BEB24B2F19 /* HelloSvgApp.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.cpp; name = HelloSvgApp.cpp; path = ../src/HelloSvgApp.cpp; sourceTree = ""; }; 62 | /* End PBXFileReference section */ 63 | 64 | /* Begin PBXFrameworksBuildPhase section */ 65 | 8D11072E0486CEB800E47090 /* Frameworks */ = { 66 | isa = PBXFrameworksBuildPhase; 67 | buildActionMask = 2147483647; 68 | files = ( 69 | D86349FE1B3923B600B5C3D9 /* IOKit.framework in Frameworks */, 70 | 006D720419952D00008149E2 /* AVFoundation.framework in Frameworks */, 71 | 006D720519952D00008149E2 /* CoreMedia.framework in Frameworks */, 72 | 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, 73 | 0091D8F90E81B9330029341E /* OpenGL.framework in Frameworks */, 74 | 5323E6B20EAFCA74003A9687 /* CoreVideo.framework in Frameworks */, 75 | 5323E6B60EAFCA7E003A9687 /* QTKit.framework in Frameworks */, 76 | 00B784B30FF439BC000DE1D7 /* Accelerate.framework in Frameworks */, 77 | 00B784B40FF439BC000DE1D7 /* AudioToolbox.framework in Frameworks */, 78 | 00B784B50FF439BC000DE1D7 /* AudioUnit.framework in Frameworks */, 79 | 00B784B60FF439BC000DE1D7 /* CoreAudio.framework in Frameworks */, 80 | ); 81 | runOnlyForDeploymentPostprocessing = 0; 82 | }; 83 | /* End PBXFrameworksBuildPhase section */ 84 | 85 | /* Begin PBXGroup section */ 86 | 00C66E583EB141ADBADD4A44 /* src */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | E57BC86E7B784D03A834767E /* ci_nanovg.cpp */, 90 | 9E8D4C5917B34732877D3F13 /* ci_nanovg_gl.cpp */, 91 | 331837629E624870A70D5618 /* SvgRenderer.cpp */, 92 | ); 93 | name = src; 94 | sourceTree = ""; 95 | }; 96 | 01B97315FEAEA392516A2CEA /* Blocks */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | 45EBAAA5F269451482F5A3DF /* NanoVG */, 100 | ); 101 | name = Blocks; 102 | sourceTree = ""; 103 | }; 104 | 080E96DDFE201D6D7F000001 /* Source */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | E893BA0CD6E349BEB24B2F19 /* HelloSvgApp.cpp */, 108 | ); 109 | name = Source; 110 | sourceTree = ""; 111 | }; 112 | 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | D86349FD1B3923B600B5C3D9 /* IOKit.framework */, 116 | 006D720219952D00008149E2 /* AVFoundation.framework */, 117 | 006D720319952D00008149E2 /* CoreMedia.framework */, 118 | 00B784AF0FF439BC000DE1D7 /* Accelerate.framework */, 119 | 00B784B00FF439BC000DE1D7 /* AudioToolbox.framework */, 120 | 00B784B10FF439BC000DE1D7 /* AudioUnit.framework */, 121 | 00B784B20FF439BC000DE1D7 /* CoreAudio.framework */, 122 | 5323E6B50EAFCA7E003A9687 /* QTKit.framework */, 123 | 5323E6B10EAFCA74003A9687 /* CoreVideo.framework */, 124 | 0091D8F80E81B9330029341E /* OpenGL.framework */, 125 | 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, 126 | ); 127 | name = "Linked Frameworks"; 128 | sourceTree = ""; 129 | }; 130 | 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = { 131 | isa = PBXGroup; 132 | children = ( 133 | 29B97324FDCFA39411CA2CEA /* AppKit.framework */, 134 | 29B97325FDCFA39411CA2CEA /* Foundation.framework */, 135 | ); 136 | name = "Other Frameworks"; 137 | sourceTree = ""; 138 | }; 139 | 19C28FACFE9D520D11CA2CBB /* Products */ = { 140 | isa = PBXGroup; 141 | children = ( 142 | 8D1107320486CEB800E47090 /* HelloSvg.app */, 143 | ); 144 | name = Products; 145 | sourceTree = ""; 146 | }; 147 | 29B97314FDCFA39411CA2CEA /* HelloSvg */ = { 148 | isa = PBXGroup; 149 | children = ( 150 | 01B97315FEAEA392516A2CEA /* Blocks */, 151 | 29B97315FDCFA39411CA2CEA /* Headers */, 152 | 080E96DDFE201D6D7F000001 /* Source */, 153 | 29B97317FDCFA39411CA2CEA /* Resources */, 154 | 29B97323FDCFA39411CA2CEA /* Frameworks */, 155 | 19C28FACFE9D520D11CA2CBB /* Products */, 156 | ); 157 | name = HelloSvg; 158 | sourceTree = ""; 159 | }; 160 | 29B97315FDCFA39411CA2CEA /* Headers */ = { 161 | isa = PBXGroup; 162 | children = ( 163 | C87718644C1A42EDB11EDEBC /* Resources.h */, 164 | 92811619F5C04F7EAB04FE86 /* HelloSvg_Prefix.pch */, 165 | ); 166 | name = Headers; 167 | sourceTree = ""; 168 | }; 169 | 29B97317FDCFA39411CA2CEA /* Resources */ = { 170 | isa = PBXGroup; 171 | children = ( 172 | 2E8B506239564ACC91FD271A /* CinderApp.icns */, 173 | A7B22C3962C6430693BB98EA /* Info.plist */, 174 | ); 175 | name = Resources; 176 | sourceTree = ""; 177 | }; 178 | 29B97323FDCFA39411CA2CEA /* Frameworks */ = { 179 | isa = PBXGroup; 180 | children = ( 181 | 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */, 182 | 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */, 183 | ); 184 | name = Frameworks; 185 | sourceTree = ""; 186 | }; 187 | 2A8B9A9FA09A4B8F8440851C /* include */ = { 188 | isa = PBXGroup; 189 | children = ( 190 | 53E8F7E48ABB4E5B81FF0C37 /* ci_nanovg.hpp */, 191 | C911656698F9498780CF4AC6 /* ci_nanovg_gl.hpp */, 192 | 0BB955051CF6429A8640234E /* SvgRenderer.hpp */, 193 | ); 194 | name = include; 195 | sourceTree = ""; 196 | }; 197 | 45EBAAA5F269451482F5A3DF /* NanoVG */ = { 198 | isa = PBXGroup; 199 | children = ( 200 | 47C57DA44FAB4BB09F7F3A41 /* deps */, 201 | 2A8B9A9FA09A4B8F8440851C /* include */, 202 | 00C66E583EB141ADBADD4A44 /* src */, 203 | ); 204 | name = NanoVG; 205 | sourceTree = ""; 206 | }; 207 | 47C57DA44FAB4BB09F7F3A41 /* deps */ = { 208 | isa = PBXGroup; 209 | children = ( 210 | E5EDE08E2AB64BAD8BE79344 /* nanovg */, 211 | ); 212 | name = deps; 213 | sourceTree = ""; 214 | }; 215 | C833720E66AD451A86606319 /* src */ = { 216 | isa = PBXGroup; 217 | children = ( 218 | CC8030FA212D495E94314F56 /* fontstash.h */, 219 | 95126EC617D84BE5BFA40DE7 /* nanovg.h */, 220 | 73BA78BDD7D74BC286FBA45D /* nanovg_gl.h */, 221 | 3525D3A48F844C82A582DDF5 /* nanovg_gl_utils.h */, 222 | E82CA687F9AF4C989FF4F349 /* stb_image.h */, 223 | C2252C80497D43F595E9BEB4 /* stb_truetype.h */, 224 | 1F1A3CDD2F70442E80033851 /* nanovg.c */, 225 | ); 226 | name = src; 227 | sourceTree = ""; 228 | }; 229 | E5EDE08E2AB64BAD8BE79344 /* nanovg */ = { 230 | isa = PBXGroup; 231 | children = ( 232 | C833720E66AD451A86606319 /* src */, 233 | ); 234 | name = nanovg; 235 | sourceTree = ""; 236 | }; 237 | /* End PBXGroup section */ 238 | 239 | /* Begin PBXNativeTarget section */ 240 | 8D1107260486CEB800E47090 /* HelloSvg */ = { 241 | isa = PBXNativeTarget; 242 | buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "HelloSvg" */; 243 | buildPhases = ( 244 | 8D1107290486CEB800E47090 /* Resources */, 245 | 8D11072C0486CEB800E47090 /* Sources */, 246 | 8D11072E0486CEB800E47090 /* Frameworks */, 247 | ); 248 | buildRules = ( 249 | ); 250 | dependencies = ( 251 | ); 252 | name = HelloSvg; 253 | productInstallPath = "$(HOME)/Applications"; 254 | productName = HelloSvg; 255 | productReference = 8D1107320486CEB800E47090 /* HelloSvg.app */; 256 | productType = "com.apple.product-type.application"; 257 | }; 258 | /* End PBXNativeTarget section */ 259 | 260 | /* Begin PBXProject section */ 261 | 29B97313FDCFA39411CA2CEA /* Project object */ = { 262 | isa = PBXProject; 263 | attributes = { 264 | }; 265 | buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "HelloSvg" */; 266 | compatibilityVersion = "Xcode 3.2"; 267 | developmentRegion = English; 268 | hasScannedForEncodings = 1; 269 | knownRegions = ( 270 | English, 271 | Japanese, 272 | French, 273 | German, 274 | ); 275 | mainGroup = 29B97314FDCFA39411CA2CEA /* HelloSvg */; 276 | projectDirPath = ""; 277 | projectRoot = ""; 278 | targets = ( 279 | 8D1107260486CEB800E47090 /* HelloSvg */, 280 | ); 281 | }; 282 | /* End PBXProject section */ 283 | 284 | /* Begin PBXResourcesBuildPhase section */ 285 | 8D1107290486CEB800E47090 /* Resources */ = { 286 | isa = PBXResourcesBuildPhase; 287 | buildActionMask = 2147483647; 288 | files = ( 289 | 9FE45718D0F04FC9A8BCD5EC /* CinderApp.icns in Resources */, 290 | ); 291 | runOnlyForDeploymentPostprocessing = 0; 292 | }; 293 | /* End PBXResourcesBuildPhase section */ 294 | 295 | /* Begin PBXSourcesBuildPhase section */ 296 | 8D11072C0486CEB800E47090 /* Sources */ = { 297 | isa = PBXSourcesBuildPhase; 298 | buildActionMask = 2147483647; 299 | files = ( 300 | 2AEA42D6779745D7B455B282 /* HelloSvgApp.cpp in Sources */, 301 | F01D65599DE1442E8C5D626A /* nanovg.c in Sources */, 302 | 7CB329C3BBF04E688CACB724 /* ci_nanovg.cpp in Sources */, 303 | 4137796B28C84C1EA54A193A /* ci_nanovg_gl.cpp in Sources */, 304 | 1F33D436FCD34252A31428FF /* SvgRenderer.cpp in Sources */, 305 | ); 306 | runOnlyForDeploymentPostprocessing = 0; 307 | }; 308 | /* End PBXSourcesBuildPhase section */ 309 | 310 | /* Begin XCBuildConfiguration section */ 311 | C01FCF4B08A954540054247B /* Debug */ = { 312 | isa = XCBuildConfiguration; 313 | buildSettings = { 314 | COMBINE_HIDPI_IMAGES = YES; 315 | COPY_PHASE_STRIP = NO; 316 | DEAD_CODE_STRIPPING = YES; 317 | GCC_DYNAMIC_NO_PIC = NO; 318 | GCC_INLINES_ARE_PRIVATE_EXTERN = YES; 319 | GCC_OPTIMIZATION_LEVEL = 0; 320 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 321 | GCC_PREFIX_HEADER = HelloSvg_Prefix.pch; 322 | GCC_PREPROCESSOR_DEFINITIONS = ( 323 | "DEBUG=1", 324 | "$(inherited)", 325 | ); 326 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 327 | INFOPLIST_FILE = Info.plist; 328 | INSTALL_PATH = "$(HOME)/Applications"; 329 | OTHER_LDFLAGS = "\"$(CINDER_PATH)/lib/macosx/Debug/libcinder.a\""; 330 | PRODUCT_NAME = HelloSvg; 331 | SYMROOT = ./build; 332 | WRAPPER_EXTENSION = app; 333 | }; 334 | name = Debug; 335 | }; 336 | C01FCF4C08A954540054247B /* Release */ = { 337 | isa = XCBuildConfiguration; 338 | buildSettings = { 339 | COMBINE_HIDPI_IMAGES = YES; 340 | DEAD_CODE_STRIPPING = YES; 341 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 342 | GCC_FAST_MATH = YES; 343 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO; 344 | GCC_INLINES_ARE_PRIVATE_EXTERN = YES; 345 | GCC_OPTIMIZATION_LEVEL = 3; 346 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 347 | GCC_PREFIX_HEADER = HelloSvg_Prefix.pch; 348 | GCC_PREPROCESSOR_DEFINITIONS = ( 349 | "NDEBUG=1", 350 | "$(inherited)", 351 | ); 352 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 353 | INFOPLIST_FILE = Info.plist; 354 | INSTALL_PATH = "$(HOME)/Applications"; 355 | OTHER_LDFLAGS = "\"$(CINDER_PATH)/lib/macosx/Release/libcinder.a\""; 356 | PRODUCT_NAME = HelloSvg; 357 | STRIP_INSTALLED_PRODUCT = YES; 358 | SYMROOT = ./build; 359 | WRAPPER_EXTENSION = app; 360 | }; 361 | name = Release; 362 | }; 363 | C01FCF4F08A954540054247B /* Debug */ = { 364 | isa = XCBuildConfiguration; 365 | buildSettings = { 366 | ALWAYS_SEARCH_USER_PATHS = NO; 367 | ARCHS = x86_64; 368 | CINDER_PATH = ../../../../..; 369 | CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; 370 | CLANG_CXX_LIBRARY = "libc++"; 371 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 372 | GCC_WARN_UNUSED_VARIABLE = YES; 373 | HEADER_SEARCH_PATHS = "\"$(CINDER_PATH)/include\""; 374 | MACOSX_DEPLOYMENT_TARGET = 10.8; 375 | SDKROOT = macosx; 376 | USER_HEADER_SEARCH_PATHS = ../include; 377 | }; 378 | name = Debug; 379 | }; 380 | C01FCF5008A954540054247B /* Release */ = { 381 | isa = XCBuildConfiguration; 382 | buildSettings = { 383 | ALWAYS_SEARCH_USER_PATHS = NO; 384 | ARCHS = x86_64; 385 | CINDER_PATH = ../../../../..; 386 | CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; 387 | CLANG_CXX_LIBRARY = "libc++"; 388 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 389 | GCC_WARN_UNUSED_VARIABLE = YES; 390 | HEADER_SEARCH_PATHS = "\"$(CINDER_PATH)/include\""; 391 | MACOSX_DEPLOYMENT_TARGET = 10.8; 392 | SDKROOT = macosx; 393 | USER_HEADER_SEARCH_PATHS = ../include; 394 | }; 395 | name = Release; 396 | }; 397 | /* End XCBuildConfiguration section */ 398 | 399 | /* Begin XCConfigurationList section */ 400 | C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "HelloSvg" */ = { 401 | isa = XCConfigurationList; 402 | buildConfigurations = ( 403 | C01FCF4B08A954540054247B /* Debug */, 404 | C01FCF4C08A954540054247B /* Release */, 405 | ); 406 | defaultConfigurationIsVisible = 0; 407 | defaultConfigurationName = Release; 408 | }; 409 | C01FCF4E08A954540054247B /* Build configuration list for PBXProject "HelloSvg" */ = { 410 | isa = XCConfigurationList; 411 | buildConfigurations = ( 412 | C01FCF4F08A954540054247B /* Debug */, 413 | C01FCF5008A954540054247B /* Release */, 414 | ); 415 | defaultConfigurationIsVisible = 0; 416 | defaultConfigurationName = Release; 417 | }; 418 | /* End XCConfigurationList section */ 419 | }; 420 | rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; 421 | } 422 | -------------------------------------------------------------------------------- /samples/HelloSvg/xcode/HelloSvg_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 | -------------------------------------------------------------------------------- /samples/HelloSvg/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 | -------------------------------------------------------------------------------- /samples/HelloSvg/xcode_ios/.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | *.pbxuser 3 | !default.pbxuser 4 | *.mode1v3 5 | !default.mode1v3 6 | *.mode2v3 7 | !default.mode2v3 8 | *.perspectivev3 9 | !default.perspectivev3 10 | xcuserdata 11 | *.xccheckout 12 | *.moved-aside 13 | DerivedData 14 | *.xcuserstate 15 | *.xcworkspace 16 | -------------------------------------------------------------------------------- /samples/HelloSvg/xcode_ios/HelloSvg_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 -------------------------------------------------------------------------------- /samples/HelloSvg/xcode_ios/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "8.0", 8 | "subtype" : "736h", 9 | "filename" : "Default-736h@3x~iphone.png", 10 | "scale" : "3x" 11 | }, 12 | { 13 | "orientation" : "landscape", 14 | "idiom" : "iphone", 15 | "extent" : "full-screen", 16 | "minimum-system-version" : "8.0", 17 | "subtype" : "736h", 18 | "scale" : "3x" 19 | }, 20 | { 21 | "extent" : "full-screen", 22 | "idiom" : "iphone", 23 | "subtype" : "667h", 24 | "filename" : "Default-667@2x.png", 25 | "minimum-system-version" : "8.0", 26 | "orientation" : "portrait", 27 | "scale" : "2x" 28 | }, 29 | { 30 | "orientation" : "portrait", 31 | "idiom" : "iphone", 32 | "extent" : "full-screen", 33 | "minimum-system-version" : "7.0", 34 | "scale" : "2x" 35 | }, 36 | { 37 | "extent" : "full-screen", 38 | "idiom" : "iphone", 39 | "subtype" : "retina4", 40 | "filename" : "Default-568h@2x.png", 41 | "minimum-system-version" : "7.0", 42 | "orientation" : "portrait", 43 | "scale" : "2x" 44 | }, 45 | { 46 | "orientation" : "portrait", 47 | "idiom" : "ipad", 48 | "extent" : "full-screen", 49 | "minimum-system-version" : "7.0", 50 | "scale" : "1x" 51 | }, 52 | { 53 | "orientation" : "landscape", 54 | "idiom" : "ipad", 55 | "extent" : "full-screen", 56 | "minimum-system-version" : "7.0", 57 | "scale" : "1x" 58 | }, 59 | { 60 | "orientation" : "portrait", 61 | "idiom" : "ipad", 62 | "extent" : "full-screen", 63 | "minimum-system-version" : "7.0", 64 | "scale" : "2x" 65 | }, 66 | { 67 | "orientation" : "landscape", 68 | "idiom" : "ipad", 69 | "extent" : "full-screen", 70 | "minimum-system-version" : "7.0", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "orientation" : "portrait", 75 | "idiom" : "iphone", 76 | "extent" : "full-screen", 77 | "scale" : "1x" 78 | }, 79 | { 80 | "orientation" : "portrait", 81 | "idiom" : "iphone", 82 | "extent" : "full-screen", 83 | "scale" : "2x" 84 | }, 85 | { 86 | "orientation" : "portrait", 87 | "idiom" : "iphone", 88 | "extent" : "full-screen", 89 | "filename" : "Default-568h@2x.png", 90 | "subtype" : "retina4", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "orientation" : "portrait", 95 | "idiom" : "ipad", 96 | "extent" : "to-status-bar", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "orientation" : "portrait", 101 | "idiom" : "ipad", 102 | "extent" : "to-status-bar", 103 | "scale" : "2x" 104 | } 105 | ], 106 | "info" : { 107 | "version" : 1, 108 | "author" : "xcode" 109 | } 110 | } -------------------------------------------------------------------------------- /samples/HelloSvg/xcode_ios/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notlion/Cinder-NanoVG/691fb921c8517bfe8c7d92da482c906ff24accc6/samples/HelloSvg/xcode_ios/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png -------------------------------------------------------------------------------- /samples/HelloSvg/xcode_ios/Images.xcassets/LaunchImage.launchimage/Default-667@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notlion/Cinder-NanoVG/691fb921c8517bfe8c7d92da482c906ff24accc6/samples/HelloSvg/xcode_ios/Images.xcassets/LaunchImage.launchimage/Default-667@2x.png -------------------------------------------------------------------------------- /samples/HelloSvg/xcode_ios/Images.xcassets/LaunchImage.launchimage/Default-736h@3x~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notlion/Cinder-NanoVG/691fb921c8517bfe8c7d92da482c906ff24accc6/samples/HelloSvg/xcode_ios/Images.xcassets/LaunchImage.launchimage/Default-736h@3x~iphone.png -------------------------------------------------------------------------------- /samples/HelloSvg/xcode_ios/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIcons 14 | 15 | CFBundlePrimaryIcon 16 | 17 | CFBundleIconFiles 18 | 19 | 20 | CinderApp_ios.png 21 | 22 | UIPrerenderedIcon 23 | 24 | 25 | 26 | CFBundleIdentifier 27 | org.libcinder.${PRODUCT_NAME:rfc1034identifier} 28 | CFBundleInfoDictionaryVersion 29 | 6.0 30 | CFBundleName 31 | ${PRODUCT_NAME} 32 | CFBundlePackageType 33 | APPL 34 | CFBundleShortVersionString 35 | 1.0 36 | CFBundleSignature 37 | ???? 38 | CFBundleVersion 39 | 1 40 | LSRequiresIPhoneOS 41 | 42 | NSMainNibFile 43 | 44 | NSMainNibFile~ipad 45 | 46 | UISupportedInterfaceOrientations 47 | 48 | UIInterfaceOrientationPortrait 49 | 50 | UISupportedInterfaceOrientations~ipad 51 | 52 | UIInterfaceOrientationPortrait 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /samples/HelloWorld/assets/Roboto-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notlion/Cinder-NanoVG/691fb921c8517bfe8c7d92da482c906ff24accc6/samples/HelloWorld/assets/Roboto-Regular.ttf -------------------------------------------------------------------------------- /samples/HelloWorld/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 | 9 | -------------------------------------------------------------------------------- /samples/HelloWorld/resources/CinderApp.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notlion/Cinder-NanoVG/691fb921c8517bfe8c7d92da482c906ff24accc6/samples/HelloWorld/resources/CinderApp.icns -------------------------------------------------------------------------------- /samples/HelloWorld/resources/CinderApp_ios.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notlion/Cinder-NanoVG/691fb921c8517bfe8c7d92da482c906ff24accc6/samples/HelloWorld/resources/CinderApp_ios.png -------------------------------------------------------------------------------- /samples/HelloWorld/resources/cinder_app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notlion/Cinder-NanoVG/691fb921c8517bfe8c7d92da482c906ff24accc6/samples/HelloWorld/resources/cinder_app_icon.ico -------------------------------------------------------------------------------- /samples/HelloWorld/src/HelloWorldApp.cpp: -------------------------------------------------------------------------------- 1 | #include "cinder/app/App.h" 2 | #include "cinder/app/RendererGl.h" 3 | #include "cinder/gl/gl.h" 4 | 5 | #include "cinder/Color.h" 6 | #include "cinder/PolyLine.h" 7 | 8 | #include "ci_nanovg_gl.hpp" 9 | 10 | using namespace ci; 11 | using namespace ci::app; 12 | using namespace std; 13 | 14 | class HelloWorldApp : public App { 15 | public: 16 | void setup(); 17 | void update(); 18 | void draw(); 19 | 20 | private: 21 | std::shared_ptr mNanoVG; 22 | PolyLine2f mTriangle; 23 | }; 24 | 25 | void HelloWorldApp::setup() { 26 | // We return a value from nvg::createContextGL() in order to remain 27 | // agnostic to how your app is managing memory. Most of the time you'll want 28 | // to either store this value or create a unique/shared_ptr. A unique_ptr 29 | // would be more appropriate here, but we're using make_shared for brevity. 30 | mNanoVG = std::make_shared(nvg::createContextGL()); 31 | 32 | // Load a font 33 | mNanoVG->createFont("roboto", getAssetPath("Roboto-Regular.ttf").string()); 34 | 35 | // Create triangle PolyLine 36 | int numPts = 3; 37 | for (size_t i = 0; i < numPts; ++i) { 38 | float u = static_cast(i) / static_cast(numPts); 39 | float t = u * M_PI * 2.0f; 40 | mTriangle.push_back({cosf(t), sinf(t)}); 41 | } 42 | mTriangle.setClosed(); 43 | } 44 | 45 | void HelloWorldApp::update() { 46 | } 47 | 48 | void HelloWorldApp::draw() { 49 | gl::clear(Color(0, 0, 0)); 50 | 51 | // Store a reference so we can use dot-notation. 52 | auto& vg = *mNanoVG; 53 | 54 | auto time = getElapsedSeconds(); 55 | 56 | vg.beginFrame(getWindowSize(), getWindowContentScale()); 57 | vg.translate(getWindowCenter()); 58 | 59 | // Draw Hue Wheel 60 | vg.save(); 61 | { 62 | float sc = 1.0f + sinf(time * 4.0f) * 0.5f; 63 | vg.scale(sc, sc); 64 | vg.rotate(time); 65 | for (int n = 64, i = 0; i < n; ++i) { 66 | float u1 = (float)i / (float)n; 67 | float u2 = (float)(i + 1) / (float)n; 68 | float t1 = u1 * M_PI * 2.0f; 69 | float t2 = u2 * M_PI * 2.0f; 70 | float r1 = 200.0f + sinf(u1 * M_PI * 12.0f + time * 16.0f) * 25.0f; 71 | float r2 = 200.0f + sinf(u2 * M_PI * 12.0f + time * 16.0f) * 25.0f; 72 | vg.beginPath(); 73 | vg.moveTo(0, 0); 74 | vg.lineTo(cosf(t1) * r1, sinf(t1) * r1); 75 | vg.lineTo(cosf(t2) * r2, sinf(t2) * r2); 76 | vg.closePath(); 77 | vg.fillColor(ColorAf{CM_HSV, u1, 1.0f, 1.0f}); 78 | vg.fill(); 79 | } 80 | } 81 | vg.restore(); 82 | 83 | // Draw Triangle 84 | vg.save(); 85 | { 86 | vg.rotate(-time); 87 | float r = 100.0f - sinf(time * 4.0f) * 40.0f; 88 | vg.scale(r, r); 89 | vg.beginPath(); 90 | vg.polyLine(mTriangle); 91 | vg.strokeWidth(10 / r); 92 | vg.strokeColor(ColorAf{1.0f, 1.0f, 1.0f, 0.75f}); 93 | vg.stroke(); 94 | } 95 | vg.restore(); 96 | 97 | // Draw Arc 98 | { 99 | float r = 200.0f; 100 | vg.beginPath(); 101 | vg.arc(0, 0, r, -M_PI * 0.5f, fmod(time, M_PI * 2.0f) - M_PI * 0.5f, NVG_CW); 102 | vg.strokeColor(ColorAf{1.0f, 1.0f, 1.0f}); 103 | vg.strokeWidth(2); 104 | vg.stroke(); 105 | } 106 | 107 | // Draw Text 108 | vg.fontSize(50); 109 | vg.fontFace("roboto"); 110 | vg.textAlign(NVG_ALIGN_CENTER | NVG_ALIGN_MIDDLE); 111 | vg.textLetterSpacing(-4.0); 112 | vg.fillColor(ColorAf{0.0f, 0.0f, 0.0f}); 113 | vg.text(0, 0, "hello, world"); 114 | 115 | vg.endFrame(); 116 | } 117 | 118 | // NanoVG requires a stencil buffer in the main framebuffer and performs it's 119 | // own anti-aliasing by default. We disable opengl's AA and enable stencil here 120 | // to allow for this. 121 | CINDER_APP(HelloWorldApp, RendererGl(RendererGl::Options().stencil().msaa(0)), 122 | [](App::Settings *settings) { settings->setHighDensityDisplayEnabled(); }) 123 | -------------------------------------------------------------------------------- /samples/HelloWorld/vc2013/.gitignore: -------------------------------------------------------------------------------- 1 | Debug/ 2 | Release/ 3 | *.suo 4 | *.sdf 5 | -------------------------------------------------------------------------------- /samples/HelloWorld/vc2013/HelloWorld.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloWorld", "HelloWorld.vcxproj", "{A647A280-8FB5-4814-B51D-30F8EFECC9B8}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {A647A280-8FB5-4814-B51D-30F8EFECC9B8}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {A647A280-8FB5-4814-B51D-30F8EFECC9B8}.Debug|Win32.Build.0 = Debug|Win32 14 | {A647A280-8FB5-4814-B51D-30F8EFECC9B8}.Release|Win32.ActiveCfg = Release|Win32 15 | {A647A280-8FB5-4814-B51D-30F8EFECC9B8}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /samples/HelloWorld/vc2013/HelloWorld.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | Win32 6 | 7 | 8 | Release 9 | Win32 10 | 11 | 12 | 13 | {A647A280-8FB5-4814-B51D-30F8EFECC9B8} 14 | HelloWorld 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 | $(SolutionDir)$(Configuration)\ 43 | $(Configuration)\ 44 | true 45 | $(SolutionDir)$(Configuration)\ 46 | $(Configuration)\ 47 | false 48 | 49 | 50 | 51 | Disabled 52 | ..\include;"..\..\..\..\..\\include";"..\..\..\..\..\\boost";..\..\..\include;..\..\..\deps\nanovg\src 53 | WIN32;_DEBUG;_WINDOWS;NOMINMAX;_WIN32_WINNT=0x0502;%(PreprocessorDefinitions) 54 | true 55 | EnableFastChecks 56 | MultiThreadedDebug 57 | 58 | Level3 59 | EditAndContinue 60 | true 61 | 62 | 63 | "..\..\..\..\..\\include";..\include 64 | 65 | 66 | cinder-$(PlatformToolset)_d.lib;%(AdditionalDependencies) 67 | "..\..\..\..\..\\lib\msw\$(PlatformTarget)" 68 | true 69 | Windows 70 | false 71 | 72 | MachineX86 73 | LIBCMT;LIBCPMT 74 | 75 | 76 | 77 | 78 | ..\include;"..\..\..\..\..\\include";"..\..\..\..\..\\boost";..\..\..\include;..\..\..\deps\nanovg\src 79 | WIN32;NDEBUG;_WINDOWS;NOMINMAX;_WIN32_WINNT=0x0502;%(PreprocessorDefinitions) 80 | MultiThreaded 81 | 82 | Level3 83 | ProgramDatabase 84 | true 85 | 86 | 87 | true 88 | 89 | 90 | "..\..\..\..\..\\include";..\include 91 | 92 | 93 | cinder-$(PlatformToolset).lib;%(AdditionalDependencies) 94 | "..\..\..\..\..\\lib\msw\$(PlatformTarget)" 95 | false 96 | true 97 | Windows 98 | true 99 | 100 | false 101 | 102 | MachineX86 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /samples/HelloWorld/vc2013/HelloWorld.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 | {6FCC77A2-EF61-4F33-8C23-6A1280F8B0EF} 17 | 18 | 19 | {CD8246B3-515C-4D32-9459-AC4E5EA8C6B0} 20 | 21 | 22 | {605FBD4F-03FF-40DC-B2F5-4B77F921F129} 23 | 24 | 25 | {47CF133D-D04C-4714-BE21-C0C529B349F4} 26 | 27 | 28 | {2C8ED4FB-EBFA-4C2C-A93B-69A93ED2EE3E} 29 | 30 | 31 | {486C5064-BF38-415A-B2EC-2E432F20DBF4} 32 | 33 | 34 | {A789EB07-CB79-4AB7-B4F7-97BED48CFE75} 35 | 36 | 37 | 38 | 39 | Source Files 40 | 41 | 42 | Source Files 43 | 44 | 45 | Header Files 46 | 47 | 48 | Blocks\NanoVG\deps\nanovg\src 49 | 50 | 51 | Blocks\NanoVG\deps\nanovg\src 52 | 53 | 54 | Blocks\NanoVG\deps\nanovg\src 55 | 56 | 57 | Blocks\NanoVG\deps\nanovg\src 58 | 59 | 60 | Blocks\NanoVG\deps\nanovg\src 61 | 62 | 63 | Blocks\NanoVG\deps\nanovg\src 64 | 65 | 66 | Blocks\NanoVG\deps\nanovg\src 67 | 68 | 69 | Blocks\NanoVG\include 70 | 71 | 72 | Blocks\NanoVG\include 73 | 74 | 75 | Blocks\NanoVG\include 76 | 77 | 78 | Blocks\NanoVG\src 79 | 80 | 81 | Blocks\NanoVG\src 82 | 83 | 84 | Blocks\NanoVG\src 85 | 86 | 87 | 88 | 89 | Header Files 90 | 91 | 92 | 93 | 94 | Resource Files 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /samples/HelloWorld/vc2013/Resources.rc: -------------------------------------------------------------------------------- 1 | #include "../include/Resources.h" 2 | 3 | 1 ICON "..\\resources\\cinder_app_icon.ico" 4 | -------------------------------------------------------------------------------- /samples/HelloWorld/xcode/.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | *.pbxuser 3 | !default.pbxuser 4 | *.mode1v3 5 | !default.mode1v3 6 | *.mode2v3 7 | !default.mode2v3 8 | *.perspectivev3 9 | !default.perspectivev3 10 | xcuserdata 11 | *.xccheckout 12 | *.moved-aside 13 | DerivedData 14 | *.xcuserstate 15 | *.xcworkspace 16 | -------------------------------------------------------------------------------- /samples/HelloWorld/xcode/HelloWorld.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 006D720419952D00008149E2 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 006D720219952D00008149E2 /* AVFoundation.framework */; }; 11 | 006D720519952D00008149E2 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 006D720319952D00008149E2 /* CoreMedia.framework */; }; 12 | 0091D8F90E81B9330029341E /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0091D8F80E81B9330029341E /* OpenGL.framework */; }; 13 | 00B784B30FF439BC000DE1D7 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00B784AF0FF439BC000DE1D7 /* Accelerate.framework */; }; 14 | 00B784B40FF439BC000DE1D7 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00B784B00FF439BC000DE1D7 /* AudioToolbox.framework */; }; 15 | 00B784B50FF439BC000DE1D7 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00B784B10FF439BC000DE1D7 /* AudioUnit.framework */; }; 16 | 00B784B60FF439BC000DE1D7 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00B784B20FF439BC000DE1D7 /* CoreAudio.framework */; }; 17 | 36096922A2524D39806D833F /* ci_nanovg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 85A40458CECF4D5AB7C0ACF5 /* ci_nanovg.cpp */; }; 18 | 4ADC8727BB9C4625B440ABBF /* SvgRenderer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5153DC3B34764EE8B2BAA72F /* SvgRenderer.cpp */; }; 19 | 5323E6B20EAFCA74003A9687 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5323E6B10EAFCA74003A9687 /* CoreVideo.framework */; }; 20 | 5323E6B60EAFCA7E003A9687 /* QTKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5323E6B50EAFCA7E003A9687 /* QTKit.framework */; }; 21 | 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; 22 | A967163E3C724F1AB39C33D0 /* nanovg.c in Sources */ = {isa = PBXBuildFile; fileRef = 59C737DC7B8D45DAAE5202F6 /* nanovg.c */; }; 23 | B2A840C7671945B0BC6108BB /* HelloWorldApp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5D90083013FF4198B570B8D5 /* HelloWorldApp.cpp */; }; 24 | C4DAC764A27C48D599DCCCC6 /* CinderApp.icns in Resources */ = {isa = PBXBuildFile; fileRef = 0149862C1DA24CE1A1D63382 /* CinderApp.icns */; }; 25 | C8807AE880FC4E4C98575500 /* ci_nanovg_gl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 663B792339D14AED82A79783 /* ci_nanovg_gl.cpp */; }; 26 | D8634A001B39243E00B5C3D9 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D86349FF1B39243E00B5C3D9 /* IOKit.framework */; }; 27 | /* End PBXBuildFile section */ 28 | 29 | /* Begin PBXFileReference section */ 30 | 006D720219952D00008149E2 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; 31 | 006D720319952D00008149E2 /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; }; 32 | 0091D8F80E81B9330029341E /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = ""; }; 33 | 00B784AF0FF439BC000DE1D7 /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; }; 34 | 00B784B00FF439BC000DE1D7 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; 35 | 00B784B10FF439BC000DE1D7 /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = System/Library/Frameworks/AudioUnit.framework; sourceTree = SDKROOT; }; 36 | 00B784B20FF439BC000DE1D7 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; }; 37 | 0149862C1DA24CE1A1D63382 /* CinderApp.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = CinderApp.icns; path = ../resources/CinderApp.icns; sourceTree = ""; }; 38 | 0D26869611904EE29507B92A /* nanovg_gl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = nanovg_gl.h; path = ../../../deps/nanovg/src/nanovg_gl.h; sourceTree = ""; }; 39 | 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 40 | 22A2C41E736F42848FF14FA8 /* ci_nanovg.hpp */ = {isa = PBXFileReference; lastKnownFileType = "\"\""; name = ci_nanovg.hpp; path = ../../../include/ci_nanovg.hpp; sourceTree = ""; }; 41 | 2453B3C6F0144C6B930FE5A8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 42 | 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 43 | 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 44 | 4B0F3019D5464AE9B417100C /* SvgRenderer.hpp */ = {isa = PBXFileReference; lastKnownFileType = "\"\""; name = SvgRenderer.hpp; path = ../../../include/SvgRenderer.hpp; sourceTree = ""; }; 45 | 5153DC3B34764EE8B2BAA72F /* SvgRenderer.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.cpp; name = SvgRenderer.cpp; path = ../../../src/SvgRenderer.cpp; sourceTree = ""; }; 46 | 5323E6B10EAFCA74003A9687 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = /System/Library/Frameworks/CoreVideo.framework; sourceTree = ""; }; 47 | 5323E6B50EAFCA7E003A9687 /* QTKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QTKit.framework; path = /System/Library/Frameworks/QTKit.framework; sourceTree = ""; }; 48 | 59C737DC7B8D45DAAE5202F6 /* nanovg.c */ = {isa = PBXFileReference; lastKnownFileType = "\"\""; name = nanovg.c; path = ../../../deps/nanovg/src/nanovg.c; sourceTree = ""; }; 49 | 5D90083013FF4198B570B8D5 /* HelloWorldApp.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.cpp; name = HelloWorldApp.cpp; path = ../src/HelloWorldApp.cpp; sourceTree = ""; }; 50 | 64A54F87B146437A9AC619EB /* nanovg_gl_utils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = nanovg_gl_utils.h; path = ../../../deps/nanovg/src/nanovg_gl_utils.h; sourceTree = ""; }; 51 | 65D262F7F44C413E98CA03E3 /* ci_nanovg_gl.hpp */ = {isa = PBXFileReference; lastKnownFileType = "\"\""; name = ci_nanovg_gl.hpp; path = ../../../include/ci_nanovg_gl.hpp; sourceTree = ""; }; 52 | 663B792339D14AED82A79783 /* ci_nanovg_gl.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.cpp; name = ci_nanovg_gl.cpp; path = ../../../src/ci_nanovg_gl.cpp; sourceTree = ""; }; 53 | 7845BE3148004424B3B01990 /* nanovg.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = nanovg.h; path = ../../../deps/nanovg/src/nanovg.h; sourceTree = ""; }; 54 | 78896EB713C940BA9032EA2C /* Resources.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Resources.h; path = ../include/Resources.h; sourceTree = ""; }; 55 | 85A40458CECF4D5AB7C0ACF5 /* ci_nanovg.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.cpp; name = ci_nanovg.cpp; path = ../../../src/ci_nanovg.cpp; sourceTree = ""; }; 56 | 8D1107320486CEB800E47090 /* HelloWorld.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HelloWorld.app; sourceTree = BUILT_PRODUCTS_DIR; }; 57 | 8FFA3B4F9F0241B58754D677 /* fontstash.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = fontstash.h; path = ../../../deps/nanovg/src/fontstash.h; sourceTree = ""; }; 58 | B09D187F323544EA80FC07A0 /* HelloWorld_Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = "\"\""; path = HelloWorld_Prefix.pch; sourceTree = ""; }; 59 | B755786403424F2DB9B3F01E /* stb_truetype.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = stb_truetype.h; path = ../../../deps/nanovg/src/stb_truetype.h; sourceTree = ""; }; 60 | BF37075F32854494AE7525DB /* stb_image.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = stb_image.h; path = ../../../deps/nanovg/src/stb_image.h; sourceTree = ""; }; 61 | D86349FF1B39243E00B5C3D9 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; }; 62 | /* End PBXFileReference section */ 63 | 64 | /* Begin PBXFrameworksBuildPhase section */ 65 | 8D11072E0486CEB800E47090 /* Frameworks */ = { 66 | isa = PBXFrameworksBuildPhase; 67 | buildActionMask = 2147483647; 68 | files = ( 69 | D8634A001B39243E00B5C3D9 /* IOKit.framework in Frameworks */, 70 | 006D720419952D00008149E2 /* AVFoundation.framework in Frameworks */, 71 | 006D720519952D00008149E2 /* CoreMedia.framework in Frameworks */, 72 | 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, 73 | 0091D8F90E81B9330029341E /* OpenGL.framework in Frameworks */, 74 | 5323E6B20EAFCA74003A9687 /* CoreVideo.framework in Frameworks */, 75 | 5323E6B60EAFCA7E003A9687 /* QTKit.framework in Frameworks */, 76 | 00B784B30FF439BC000DE1D7 /* Accelerate.framework in Frameworks */, 77 | 00B784B40FF439BC000DE1D7 /* AudioToolbox.framework in Frameworks */, 78 | 00B784B50FF439BC000DE1D7 /* AudioUnit.framework in Frameworks */, 79 | 00B784B60FF439BC000DE1D7 /* CoreAudio.framework in Frameworks */, 80 | ); 81 | runOnlyForDeploymentPostprocessing = 0; 82 | }; 83 | /* End PBXFrameworksBuildPhase section */ 84 | 85 | /* Begin PBXGroup section */ 86 | 01B97315FEAEA392516A2CEA /* Blocks */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | C1AE792326DD46109AFF9609 /* NanoVG */, 90 | ); 91 | name = Blocks; 92 | sourceTree = ""; 93 | }; 94 | 080E96DDFE201D6D7F000001 /* Source */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | 5D90083013FF4198B570B8D5 /* HelloWorldApp.cpp */, 98 | ); 99 | name = Source; 100 | sourceTree = ""; 101 | }; 102 | 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | D86349FF1B39243E00B5C3D9 /* IOKit.framework */, 106 | 006D720219952D00008149E2 /* AVFoundation.framework */, 107 | 006D720319952D00008149E2 /* CoreMedia.framework */, 108 | 00B784AF0FF439BC000DE1D7 /* Accelerate.framework */, 109 | 00B784B00FF439BC000DE1D7 /* AudioToolbox.framework */, 110 | 00B784B10FF439BC000DE1D7 /* AudioUnit.framework */, 111 | 00B784B20FF439BC000DE1D7 /* CoreAudio.framework */, 112 | 5323E6B50EAFCA7E003A9687 /* QTKit.framework */, 113 | 5323E6B10EAFCA74003A9687 /* CoreVideo.framework */, 114 | 0091D8F80E81B9330029341E /* OpenGL.framework */, 115 | 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, 116 | ); 117 | name = "Linked Frameworks"; 118 | sourceTree = ""; 119 | }; 120 | 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = { 121 | isa = PBXGroup; 122 | children = ( 123 | 29B97324FDCFA39411CA2CEA /* AppKit.framework */, 124 | 29B97325FDCFA39411CA2CEA /* Foundation.framework */, 125 | ); 126 | name = "Other Frameworks"; 127 | sourceTree = ""; 128 | }; 129 | 19C28FACFE9D520D11CA2CBB /* Products */ = { 130 | isa = PBXGroup; 131 | children = ( 132 | 8D1107320486CEB800E47090 /* HelloWorld.app */, 133 | ); 134 | name = Products; 135 | sourceTree = ""; 136 | }; 137 | 29B97314FDCFA39411CA2CEA /* HelloWorld */ = { 138 | isa = PBXGroup; 139 | children = ( 140 | 01B97315FEAEA392516A2CEA /* Blocks */, 141 | 29B97315FDCFA39411CA2CEA /* Headers */, 142 | 080E96DDFE201D6D7F000001 /* Source */, 143 | 29B97317FDCFA39411CA2CEA /* Resources */, 144 | 29B97323FDCFA39411CA2CEA /* Frameworks */, 145 | 19C28FACFE9D520D11CA2CBB /* Products */, 146 | ); 147 | name = HelloWorld; 148 | sourceTree = ""; 149 | }; 150 | 29B97315FDCFA39411CA2CEA /* Headers */ = { 151 | isa = PBXGroup; 152 | children = ( 153 | 78896EB713C940BA9032EA2C /* Resources.h */, 154 | B09D187F323544EA80FC07A0 /* HelloWorld_Prefix.pch */, 155 | ); 156 | name = Headers; 157 | sourceTree = ""; 158 | }; 159 | 29B97317FDCFA39411CA2CEA /* Resources */ = { 160 | isa = PBXGroup; 161 | children = ( 162 | 0149862C1DA24CE1A1D63382 /* CinderApp.icns */, 163 | 2453B3C6F0144C6B930FE5A8 /* Info.plist */, 164 | ); 165 | name = Resources; 166 | sourceTree = ""; 167 | }; 168 | 29B97323FDCFA39411CA2CEA /* Frameworks */ = { 169 | isa = PBXGroup; 170 | children = ( 171 | 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */, 172 | 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */, 173 | ); 174 | name = Frameworks; 175 | sourceTree = ""; 176 | }; 177 | 3A4B00DE5A2B46708133C552 /* src */ = { 178 | isa = PBXGroup; 179 | children = ( 180 | 85A40458CECF4D5AB7C0ACF5 /* ci_nanovg.cpp */, 181 | 663B792339D14AED82A79783 /* ci_nanovg_gl.cpp */, 182 | 5153DC3B34764EE8B2BAA72F /* SvgRenderer.cpp */, 183 | ); 184 | name = src; 185 | sourceTree = ""; 186 | }; 187 | 764FA817D0184E2F9F7F574F /* src */ = { 188 | isa = PBXGroup; 189 | children = ( 190 | 8FFA3B4F9F0241B58754D677 /* fontstash.h */, 191 | 7845BE3148004424B3B01990 /* nanovg.h */, 192 | 0D26869611904EE29507B92A /* nanovg_gl.h */, 193 | 64A54F87B146437A9AC619EB /* nanovg_gl_utils.h */, 194 | BF37075F32854494AE7525DB /* stb_image.h */, 195 | B755786403424F2DB9B3F01E /* stb_truetype.h */, 196 | 59C737DC7B8D45DAAE5202F6 /* nanovg.c */, 197 | ); 198 | name = src; 199 | sourceTree = ""; 200 | }; 201 | A07726419CC94060966D398C /* nanovg */ = { 202 | isa = PBXGroup; 203 | children = ( 204 | 764FA817D0184E2F9F7F574F /* src */, 205 | ); 206 | name = nanovg; 207 | sourceTree = ""; 208 | }; 209 | A192C0870D36497E92984CF5 /* deps */ = { 210 | isa = PBXGroup; 211 | children = ( 212 | A07726419CC94060966D398C /* nanovg */, 213 | ); 214 | name = deps; 215 | sourceTree = ""; 216 | }; 217 | C1AE792326DD46109AFF9609 /* NanoVG */ = { 218 | isa = PBXGroup; 219 | children = ( 220 | A192C0870D36497E92984CF5 /* deps */, 221 | C9CC2D12940040D7AC212891 /* include */, 222 | 3A4B00DE5A2B46708133C552 /* src */, 223 | ); 224 | name = NanoVG; 225 | sourceTree = ""; 226 | }; 227 | C9CC2D12940040D7AC212891 /* include */ = { 228 | isa = PBXGroup; 229 | children = ( 230 | 22A2C41E736F42848FF14FA8 /* ci_nanovg.hpp */, 231 | 65D262F7F44C413E98CA03E3 /* ci_nanovg_gl.hpp */, 232 | 4B0F3019D5464AE9B417100C /* SvgRenderer.hpp */, 233 | ); 234 | name = include; 235 | sourceTree = ""; 236 | }; 237 | /* End PBXGroup section */ 238 | 239 | /* Begin PBXNativeTarget section */ 240 | 8D1107260486CEB800E47090 /* HelloWorld */ = { 241 | isa = PBXNativeTarget; 242 | buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "HelloWorld" */; 243 | buildPhases = ( 244 | 8D1107290486CEB800E47090 /* Resources */, 245 | 8D11072C0486CEB800E47090 /* Sources */, 246 | 8D11072E0486CEB800E47090 /* Frameworks */, 247 | ); 248 | buildRules = ( 249 | ); 250 | dependencies = ( 251 | ); 252 | name = HelloWorld; 253 | productInstallPath = "$(HOME)/Applications"; 254 | productName = HelloWorld; 255 | productReference = 8D1107320486CEB800E47090 /* HelloWorld.app */; 256 | productType = "com.apple.product-type.application"; 257 | }; 258 | /* End PBXNativeTarget section */ 259 | 260 | /* Begin PBXProject section */ 261 | 29B97313FDCFA39411CA2CEA /* Project object */ = { 262 | isa = PBXProject; 263 | attributes = { 264 | }; 265 | buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "HelloWorld" */; 266 | compatibilityVersion = "Xcode 3.2"; 267 | developmentRegion = English; 268 | hasScannedForEncodings = 1; 269 | knownRegions = ( 270 | English, 271 | Japanese, 272 | French, 273 | German, 274 | ); 275 | mainGroup = 29B97314FDCFA39411CA2CEA /* HelloWorld */; 276 | projectDirPath = ""; 277 | projectRoot = ""; 278 | targets = ( 279 | 8D1107260486CEB800E47090 /* HelloWorld */, 280 | ); 281 | }; 282 | /* End PBXProject section */ 283 | 284 | /* Begin PBXResourcesBuildPhase section */ 285 | 8D1107290486CEB800E47090 /* Resources */ = { 286 | isa = PBXResourcesBuildPhase; 287 | buildActionMask = 2147483647; 288 | files = ( 289 | C4DAC764A27C48D599DCCCC6 /* CinderApp.icns in Resources */, 290 | ); 291 | runOnlyForDeploymentPostprocessing = 0; 292 | }; 293 | /* End PBXResourcesBuildPhase section */ 294 | 295 | /* Begin PBXSourcesBuildPhase section */ 296 | 8D11072C0486CEB800E47090 /* Sources */ = { 297 | isa = PBXSourcesBuildPhase; 298 | buildActionMask = 2147483647; 299 | files = ( 300 | B2A840C7671945B0BC6108BB /* HelloWorldApp.cpp in Sources */, 301 | A967163E3C724F1AB39C33D0 /* nanovg.c in Sources */, 302 | 36096922A2524D39806D833F /* ci_nanovg.cpp in Sources */, 303 | C8807AE880FC4E4C98575500 /* ci_nanovg_gl.cpp in Sources */, 304 | 4ADC8727BB9C4625B440ABBF /* SvgRenderer.cpp in Sources */, 305 | ); 306 | runOnlyForDeploymentPostprocessing = 0; 307 | }; 308 | /* End PBXSourcesBuildPhase section */ 309 | 310 | /* Begin XCBuildConfiguration section */ 311 | C01FCF4B08A954540054247B /* Debug */ = { 312 | isa = XCBuildConfiguration; 313 | buildSettings = { 314 | COMBINE_HIDPI_IMAGES = YES; 315 | COPY_PHASE_STRIP = NO; 316 | DEAD_CODE_STRIPPING = YES; 317 | GCC_DYNAMIC_NO_PIC = NO; 318 | GCC_INLINES_ARE_PRIVATE_EXTERN = YES; 319 | GCC_OPTIMIZATION_LEVEL = 0; 320 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 321 | GCC_PREFIX_HEADER = HelloWorld_Prefix.pch; 322 | GCC_PREPROCESSOR_DEFINITIONS = ( 323 | "DEBUG=1", 324 | "$(inherited)", 325 | ); 326 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 327 | INFOPLIST_FILE = Info.plist; 328 | INSTALL_PATH = "$(HOME)/Applications"; 329 | OTHER_LDFLAGS = "\"$(CINDER_PATH)/lib/libcinder_d.a\""; 330 | PRODUCT_NAME = HelloWorld; 331 | SYMROOT = ./build; 332 | WRAPPER_EXTENSION = app; 333 | }; 334 | name = Debug; 335 | }; 336 | C01FCF4C08A954540054247B /* Release */ = { 337 | isa = XCBuildConfiguration; 338 | buildSettings = { 339 | COMBINE_HIDPI_IMAGES = YES; 340 | DEAD_CODE_STRIPPING = YES; 341 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 342 | GCC_FAST_MATH = YES; 343 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO; 344 | GCC_INLINES_ARE_PRIVATE_EXTERN = YES; 345 | GCC_OPTIMIZATION_LEVEL = 3; 346 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 347 | GCC_PREFIX_HEADER = HelloWorld_Prefix.pch; 348 | GCC_PREPROCESSOR_DEFINITIONS = ( 349 | "NDEBUG=1", 350 | "$(inherited)", 351 | ); 352 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 353 | INFOPLIST_FILE = Info.plist; 354 | INSTALL_PATH = "$(HOME)/Applications"; 355 | OTHER_LDFLAGS = "\"$(CINDER_PATH)/lib/libcinder.a\""; 356 | PRODUCT_NAME = HelloWorld; 357 | STRIP_INSTALLED_PRODUCT = YES; 358 | SYMROOT = ./build; 359 | WRAPPER_EXTENSION = app; 360 | }; 361 | name = Release; 362 | }; 363 | C01FCF4F08A954540054247B /* Debug */ = { 364 | isa = XCBuildConfiguration; 365 | buildSettings = { 366 | ALWAYS_SEARCH_USER_PATHS = NO; 367 | ARCHS = x86_64; 368 | CINDER_PATH = ../../../../..; 369 | CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; 370 | CLANG_CXX_LIBRARY = "libc++"; 371 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 372 | GCC_WARN_UNUSED_VARIABLE = YES; 373 | HEADER_SEARCH_PATHS = "\"$(CINDER_PATH)/include\""; 374 | MACOSX_DEPLOYMENT_TARGET = 10.8; 375 | SDKROOT = macosx; 376 | USER_HEADER_SEARCH_PATHS = ../include; 377 | }; 378 | name = Debug; 379 | }; 380 | C01FCF5008A954540054247B /* Release */ = { 381 | isa = XCBuildConfiguration; 382 | buildSettings = { 383 | ALWAYS_SEARCH_USER_PATHS = NO; 384 | ARCHS = x86_64; 385 | CINDER_PATH = ../../../../..; 386 | CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; 387 | CLANG_CXX_LIBRARY = "libc++"; 388 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 389 | GCC_WARN_UNUSED_VARIABLE = YES; 390 | HEADER_SEARCH_PATHS = "\"$(CINDER_PATH)/include\""; 391 | MACOSX_DEPLOYMENT_TARGET = 10.8; 392 | SDKROOT = macosx; 393 | USER_HEADER_SEARCH_PATHS = ../include; 394 | }; 395 | name = Release; 396 | }; 397 | /* End XCBuildConfiguration section */ 398 | 399 | /* Begin XCConfigurationList section */ 400 | C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "HelloWorld" */ = { 401 | isa = XCConfigurationList; 402 | buildConfigurations = ( 403 | C01FCF4B08A954540054247B /* Debug */, 404 | C01FCF4C08A954540054247B /* Release */, 405 | ); 406 | defaultConfigurationIsVisible = 0; 407 | defaultConfigurationName = Release; 408 | }; 409 | C01FCF4E08A954540054247B /* Build configuration list for PBXProject "HelloWorld" */ = { 410 | isa = XCConfigurationList; 411 | buildConfigurations = ( 412 | C01FCF4F08A954540054247B /* Debug */, 413 | C01FCF5008A954540054247B /* Release */, 414 | ); 415 | defaultConfigurationIsVisible = 0; 416 | defaultConfigurationName = Release; 417 | }; 418 | /* End XCConfigurationList section */ 419 | }; 420 | rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; 421 | } 422 | -------------------------------------------------------------------------------- /samples/HelloWorld/xcode/HelloWorld_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 | -------------------------------------------------------------------------------- /samples/HelloWorld/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 | -------------------------------------------------------------------------------- /samples/HelloWorld/xcode_ios/.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | *.pbxuser 3 | !default.pbxuser 4 | *.mode1v3 5 | !default.mode1v3 6 | *.mode2v3 7 | !default.mode2v3 8 | *.perspectivev3 9 | !default.perspectivev3 10 | xcuserdata 11 | *.xccheckout 12 | *.moved-aside 13 | DerivedData 14 | *.xcuserstate 15 | *.xcworkspace 16 | -------------------------------------------------------------------------------- /samples/HelloWorld/xcode_ios/HelloWorld_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 -------------------------------------------------------------------------------- /samples/HelloWorld/xcode_ios/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "8.0", 8 | "subtype" : "736h", 9 | "filename" : "Default-736h@3x~iphone.png", 10 | "scale" : "3x" 11 | }, 12 | { 13 | "orientation" : "landscape", 14 | "idiom" : "iphone", 15 | "extent" : "full-screen", 16 | "minimum-system-version" : "8.0", 17 | "subtype" : "736h", 18 | "scale" : "3x" 19 | }, 20 | { 21 | "extent" : "full-screen", 22 | "idiom" : "iphone", 23 | "subtype" : "667h", 24 | "filename" : "Default-667@2x.png", 25 | "minimum-system-version" : "8.0", 26 | "orientation" : "portrait", 27 | "scale" : "2x" 28 | }, 29 | { 30 | "orientation" : "portrait", 31 | "idiom" : "iphone", 32 | "extent" : "full-screen", 33 | "minimum-system-version" : "7.0", 34 | "scale" : "2x" 35 | }, 36 | { 37 | "extent" : "full-screen", 38 | "idiom" : "iphone", 39 | "subtype" : "retina4", 40 | "filename" : "Default-568h@2x.png", 41 | "minimum-system-version" : "7.0", 42 | "orientation" : "portrait", 43 | "scale" : "2x" 44 | }, 45 | { 46 | "orientation" : "portrait", 47 | "idiom" : "ipad", 48 | "extent" : "full-screen", 49 | "minimum-system-version" : "7.0", 50 | "scale" : "1x" 51 | }, 52 | { 53 | "orientation" : "landscape", 54 | "idiom" : "ipad", 55 | "extent" : "full-screen", 56 | "minimum-system-version" : "7.0", 57 | "scale" : "1x" 58 | }, 59 | { 60 | "orientation" : "portrait", 61 | "idiom" : "ipad", 62 | "extent" : "full-screen", 63 | "minimum-system-version" : "7.0", 64 | "scale" : "2x" 65 | }, 66 | { 67 | "orientation" : "landscape", 68 | "idiom" : "ipad", 69 | "extent" : "full-screen", 70 | "minimum-system-version" : "7.0", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "orientation" : "portrait", 75 | "idiom" : "iphone", 76 | "extent" : "full-screen", 77 | "scale" : "1x" 78 | }, 79 | { 80 | "orientation" : "portrait", 81 | "idiom" : "iphone", 82 | "extent" : "full-screen", 83 | "scale" : "2x" 84 | }, 85 | { 86 | "orientation" : "portrait", 87 | "idiom" : "iphone", 88 | "extent" : "full-screen", 89 | "filename" : "Default-568h@2x.png", 90 | "subtype" : "retina4", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "orientation" : "portrait", 95 | "idiom" : "ipad", 96 | "extent" : "to-status-bar", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "orientation" : "portrait", 101 | "idiom" : "ipad", 102 | "extent" : "to-status-bar", 103 | "scale" : "2x" 104 | } 105 | ], 106 | "info" : { 107 | "version" : 1, 108 | "author" : "xcode" 109 | } 110 | } -------------------------------------------------------------------------------- /samples/HelloWorld/xcode_ios/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notlion/Cinder-NanoVG/691fb921c8517bfe8c7d92da482c906ff24accc6/samples/HelloWorld/xcode_ios/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png -------------------------------------------------------------------------------- /samples/HelloWorld/xcode_ios/Images.xcassets/LaunchImage.launchimage/Default-667@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notlion/Cinder-NanoVG/691fb921c8517bfe8c7d92da482c906ff24accc6/samples/HelloWorld/xcode_ios/Images.xcassets/LaunchImage.launchimage/Default-667@2x.png -------------------------------------------------------------------------------- /samples/HelloWorld/xcode_ios/Images.xcassets/LaunchImage.launchimage/Default-736h@3x~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notlion/Cinder-NanoVG/691fb921c8517bfe8c7d92da482c906ff24accc6/samples/HelloWorld/xcode_ios/Images.xcassets/LaunchImage.launchimage/Default-736h@3x~iphone.png -------------------------------------------------------------------------------- /samples/HelloWorld/xcode_ios/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIcons 14 | 15 | CFBundlePrimaryIcon 16 | 17 | CFBundleIconFiles 18 | 19 | 20 | CinderApp_ios.png 21 | 22 | UIPrerenderedIcon 23 | 24 | 25 | 26 | CFBundleIdentifier 27 | org.libcinder.${PRODUCT_NAME:rfc1034identifier} 28 | CFBundleInfoDictionaryVersion 29 | 6.0 30 | CFBundleName 31 | ${PRODUCT_NAME} 32 | CFBundlePackageType 33 | APPL 34 | CFBundleShortVersionString 35 | 1.0 36 | CFBundleSignature 37 | ???? 38 | CFBundleVersion 39 | 1 40 | LSRequiresIPhoneOS 41 | 42 | NSMainNibFile 43 | 44 | NSMainNibFile~ipad 45 | 46 | UISupportedInterfaceOrientations 47 | 48 | UIInterfaceOrientationPortrait 49 | 50 | UISupportedInterfaceOrientations~ipad 51 | 52 | UIInterfaceOrientationPortrait 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /samples/MultiWindow/assets/Roboto-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notlion/Cinder-NanoVG/691fb921c8517bfe8c7d92da482c906ff24accc6/samples/MultiWindow/assets/Roboto-Regular.ttf -------------------------------------------------------------------------------- /samples/MultiWindow/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 | 9 | -------------------------------------------------------------------------------- /samples/MultiWindow/resources/CinderApp.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notlion/Cinder-NanoVG/691fb921c8517bfe8c7d92da482c906ff24accc6/samples/MultiWindow/resources/CinderApp.icns -------------------------------------------------------------------------------- /samples/MultiWindow/resources/cinder_app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notlion/Cinder-NanoVG/691fb921c8517bfe8c7d92da482c906ff24accc6/samples/MultiWindow/resources/cinder_app_icon.ico -------------------------------------------------------------------------------- /samples/MultiWindow/src/MultiWindowApp.cpp: -------------------------------------------------------------------------------- 1 | #include "cinder/app/App.h" 2 | #include "cinder/app/RendererGl.h" 3 | #include "cinder/gl/gl.h" 4 | 5 | #include "cinder/Color.h" 6 | #include "cinder/PolyLine.h" 7 | #include "cinder/Rand.h" 8 | 9 | #include "ci_nanovg_gl.hpp" 10 | 11 | using namespace ci; 12 | using namespace ci::app; 13 | using namespace std; 14 | 15 | struct WindowData { 16 | shared_ptr ctx; 17 | PolyLine2f polygon; 18 | uint32_t id; 19 | 20 | WindowData(uint32_t id) 21 | : ctx{ make_shared(nvg::createContextGL()) }, 22 | id{ id } 23 | { 24 | // Load a font. 25 | ctx->createFont("roboto", getAssetPath("Roboto-Regular.ttf").string()); 26 | 27 | // Create some geometry to draw. 28 | int numVerts = Rand::randInt(8); 29 | float scale = 100; 30 | for (int i = 0; i < numVerts; ++i) { 31 | float u = float(i) / float(numVerts); 32 | float t = u * M_PI * 2.0f; 33 | polygon.push_back({ cosf(t) * scale, sinf(t) * scale }); 34 | } 35 | polygon.setClosed(); 36 | } 37 | }; 38 | 39 | class MultiWindowApp : public App { 40 | public: 41 | void setup(); 42 | void update(); 43 | void draw(); 44 | void spawnWindow(); 45 | }; 46 | 47 | void MultiWindowApp::setup() { 48 | getWindow()->setUserData(new WindowData(getNumWindows())); 49 | spawnWindow(); 50 | } 51 | 52 | void MultiWindowApp::spawnWindow() { 53 | auto newWindow = createWindow(Window::Format().size(getWindowSize())); 54 | newWindow->setUserData(new WindowData(getNumWindows())); 55 | } 56 | 57 | void MultiWindowApp::update() { 58 | } 59 | 60 | void MultiWindowApp::draw() { 61 | auto data = getWindow()->getUserData(); 62 | auto& vg = *data->ctx; 63 | 64 | gl::clear(Color(0, 0, 0)); 65 | 66 | vg.beginFrame(getWindowWidth(), getWindowHeight(), getWindowContentScale()); 67 | 68 | vg.translate(getWindowCenter()); 69 | 70 | vg.save(); 71 | vg.rotate(getElapsedSeconds()); 72 | vg.beginPath(); 73 | vg.polyLine(data->polygon); 74 | vg.strokeWidth(10); 75 | vg.strokeColor(Colorf::white()); 76 | vg.stroke(); 77 | vg.restore(); 78 | 79 | vg.fontFace("roboto"); 80 | vg.fontSize(100); 81 | vg.textAlign(NVG_ALIGN_CENTER | NVG_ALIGN_MIDDLE); 82 | vg.text(0, 0, to_string(data->id)); 83 | 84 | vg.endFrame(); 85 | } 86 | 87 | // NanoVG requires a stencil buffer in the main framebuffer and performs it's 88 | // own anti-aliasing by default. We disable opengl's AA and enable stencil here 89 | // to allow for this. 90 | CINDER_APP(MultiWindowApp, RendererGl(RendererGl::Options().stencil().msaa(0)), 91 | [](App::Settings *settings) { settings->setHighDensityDisplayEnabled(); }) 92 | -------------------------------------------------------------------------------- /samples/MultiWindow/vc2013/.gitignore: -------------------------------------------------------------------------------- 1 | Debug/ 2 | Release/ 3 | *.suo 4 | *.sdf 5 | -------------------------------------------------------------------------------- /samples/MultiWindow/vc2013/MultiWindow.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MultiWindow", "MultiWindow.vcxproj", "{A4BABEF0-D849-41B2-84AB-E0143F0C7D3E}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {A4BABEF0-D849-41B2-84AB-E0143F0C7D3E}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {A4BABEF0-D849-41B2-84AB-E0143F0C7D3E}.Debug|Win32.Build.0 = Debug|Win32 14 | {A4BABEF0-D849-41B2-84AB-E0143F0C7D3E}.Release|Win32.ActiveCfg = Release|Win32 15 | {A4BABEF0-D849-41B2-84AB-E0143F0C7D3E}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /samples/MultiWindow/vc2013/MultiWindow.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | Win32 6 | 7 | 8 | Release 9 | Win32 10 | 11 | 12 | 13 | {A4BABEF0-D849-41B2-84AB-E0143F0C7D3E} 14 | MultiWindow 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 | $(SolutionDir)$(Configuration)\ 43 | $(Configuration)\ 44 | true 45 | $(SolutionDir)$(Configuration)\ 46 | $(Configuration)\ 47 | false 48 | 49 | 50 | 51 | Disabled 52 | ..\include;"..\..\..\..\..\..\cinder\include";"..\..\..\..\..\..\cinder\boost" 53 | WIN32;_DEBUG;_WINDOWS;NOMINMAX;_WIN32_WINNT=0x0502;%(PreprocessorDefinitions) 54 | true 55 | EnableFastChecks 56 | MultiThreadedDebug 57 | 58 | Level3 59 | EditAndContinue 60 | true 61 | 62 | 63 | "..\..\..\..\..\..\cinder\include";..\include 64 | 65 | 66 | cinder-$(PlatformToolset)_d.lib;%(AdditionalDependencies) 67 | "..\..\..\..\..\..\cinder\lib\msw\$(PlatformTarget)" 68 | true 69 | Windows 70 | false 71 | 72 | MachineX86 73 | LIBCMT;LIBCPMT 74 | 75 | 76 | 77 | 78 | ..\include;"..\..\..\..\..\..\cinder\include";"..\..\..\..\..\..\cinder\boost" 79 | WIN32;NDEBUG;_WINDOWS;NOMINMAX;_WIN32_WINNT=0x0502;%(PreprocessorDefinitions) 80 | MultiThreaded 81 | 82 | Level3 83 | ProgramDatabase 84 | true 85 | 86 | 87 | true 88 | 89 | 90 | "..\..\..\..\..\..\cinder\include";..\include 91 | 92 | 93 | cinder-$(PlatformToolset).lib;%(AdditionalDependencies) 94 | "..\..\..\..\..\..\cinder\lib\msw\$(PlatformTarget)" 95 | false 96 | true 97 | Windows 98 | true 99 | 100 | false 101 | 102 | MachineX86 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | -------------------------------------------------------------------------------- /samples/MultiWindow/vc2013/MultiWindow.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 | -------------------------------------------------------------------------------- /samples/MultiWindow/vc2013/Resources.rc: -------------------------------------------------------------------------------- 1 | #include "../include/Resources.h" 2 | 3 | 1 ICON "..\\resources\\cinder_app_icon.ico" 4 | -------------------------------------------------------------------------------- /samples/MultiWindow/xcode/.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | *.pbxuser 3 | !default.pbxuser 4 | *.mode1v3 5 | !default.mode1v3 6 | *.mode2v3 7 | !default.mode2v3 8 | *.perspectivev3 9 | !default.perspectivev3 10 | xcuserdata 11 | *.xccheckout 12 | *.moved-aside 13 | DerivedData 14 | *.xcuserstate 15 | *.xcworkspace 16 | -------------------------------------------------------------------------------- /samples/MultiWindow/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 | -------------------------------------------------------------------------------- /samples/MultiWindow/xcode/MultiWindow.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 006D720419952D00008149E2 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 006D720219952D00008149E2 /* AVFoundation.framework */; }; 11 | 006D720519952D00008149E2 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 006D720319952D00008149E2 /* CoreMedia.framework */; }; 12 | 0091D8F90E81B9330029341E /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0091D8F80E81B9330029341E /* OpenGL.framework */; }; 13 | 00B784B30FF439BC000DE1D7 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00B784AF0FF439BC000DE1D7 /* Accelerate.framework */; }; 14 | 00B784B40FF439BC000DE1D7 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00B784B00FF439BC000DE1D7 /* AudioToolbox.framework */; }; 15 | 00B784B50FF439BC000DE1D7 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00B784B10FF439BC000DE1D7 /* AudioUnit.framework */; }; 16 | 00B784B60FF439BC000DE1D7 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00B784B20FF439BC000DE1D7 /* CoreAudio.framework */; }; 17 | 2B2FF55D0F0044A0B3C8249F /* nanovg.c in Sources */ = {isa = PBXBuildFile; fileRef = C60688CBADB04452ACAC2ADE /* nanovg.c */; }; 18 | 36AB83036C1B4DABA3F7D3D1 /* ci_nanovg_gl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E89198BF0E564531B1CDA5AB /* ci_nanovg_gl.cpp */; }; 19 | 5323E6B20EAFCA74003A9687 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5323E6B10EAFCA74003A9687 /* CoreVideo.framework */; }; 20 | 5323E6B60EAFCA7E003A9687 /* QTKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5323E6B50EAFCA7E003A9687 /* QTKit.framework */; }; 21 | 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; 22 | 96B698272F8F4714B99ED466 /* CinderApp.icns in Resources */ = {isa = PBXBuildFile; fileRef = 6397D4420B34495398047FFA /* CinderApp.icns */; }; 23 | 99485653E94049DAB1DD9069 /* MultiWindowApp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 70B967BF02464724B2A7CF79 /* MultiWindowApp.cpp */; }; 24 | C1EECDDB7F2B4178A2509A80 /* ci_nanovg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C9A1DED751C94902B6ED293F /* ci_nanovg.cpp */; }; 25 | C3D9AF50729143DD8B208E8D /* SvgRenderer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 614F60A623764E308F6E3B65 /* SvgRenderer.cpp */; }; 26 | D8634A021B39249500B5C3D9 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D8634A011B39249500B5C3D9 /* IOKit.framework */; }; 27 | /* End PBXBuildFile section */ 28 | 29 | /* Begin PBXFileReference section */ 30 | 003A927FFE474A91B1CBE579 /* stb_truetype.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = stb_truetype.h; path = ../../../deps/nanovg/src/stb_truetype.h; sourceTree = ""; }; 31 | 006D720219952D00008149E2 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; 32 | 006D720319952D00008149E2 /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; }; 33 | 0091D8F80E81B9330029341E /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = ""; }; 34 | 00B784AF0FF439BC000DE1D7 /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; }; 35 | 00B784B00FF439BC000DE1D7 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; 36 | 00B784B10FF439BC000DE1D7 /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = System/Library/Frameworks/AudioUnit.framework; sourceTree = SDKROOT; }; 37 | 00B784B20FF439BC000DE1D7 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; }; 38 | 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 39 | 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 40 | 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 41 | 38B5C764DE684F329B160E2B /* nanovg_gl_utils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = nanovg_gl_utils.h; path = ../../../deps/nanovg/src/nanovg_gl_utils.h; sourceTree = ""; }; 42 | 5323E6B10EAFCA74003A9687 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = /System/Library/Frameworks/CoreVideo.framework; sourceTree = ""; }; 43 | 5323E6B50EAFCA7E003A9687 /* QTKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QTKit.framework; path = /System/Library/Frameworks/QTKit.framework; sourceTree = ""; }; 44 | 5B5635CBBD5540EC85B94809 /* Resources.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Resources.h; path = ../include/Resources.h; sourceTree = ""; }; 45 | 614F60A623764E308F6E3B65 /* SvgRenderer.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.cpp; name = SvgRenderer.cpp; path = ../../../src/SvgRenderer.cpp; sourceTree = ""; }; 46 | 6397D4420B34495398047FFA /* CinderApp.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = CinderApp.icns; path = ../resources/CinderApp.icns; sourceTree = ""; }; 47 | 6BBD181B497F428A8DD824CB /* ci_nanovg_gl.hpp */ = {isa = PBXFileReference; lastKnownFileType = "\"\""; name = ci_nanovg_gl.hpp; path = ../../../include/ci_nanovg_gl.hpp; sourceTree = ""; }; 48 | 6D71086DA1B24110A93714C4 /* stb_image.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = stb_image.h; path = ../../../deps/nanovg/src/stb_image.h; sourceTree = ""; }; 49 | 70B967BF02464724B2A7CF79 /* MultiWindowApp.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.cpp; name = MultiWindowApp.cpp; path = ../src/MultiWindowApp.cpp; sourceTree = ""; }; 50 | 760F3FC3618640A493C38F78 /* nanovg_gl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = nanovg_gl.h; path = ../../../deps/nanovg/src/nanovg_gl.h; sourceTree = ""; }; 51 | 8D1107320486CEB800E47090 /* MultiWindow.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MultiWindow.app; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | 941A0E2742974FEA8ED23F18 /* MultiWindow_Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = "\"\""; path = MultiWindow_Prefix.pch; sourceTree = ""; }; 53 | AB6123F538024125999A940C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 54 | C06B1D2B83ED45B687945B5C /* ci_nanovg.hpp */ = {isa = PBXFileReference; lastKnownFileType = "\"\""; name = ci_nanovg.hpp; path = ../../../include/ci_nanovg.hpp; sourceTree = ""; }; 55 | C60688CBADB04452ACAC2ADE /* nanovg.c */ = {isa = PBXFileReference; lastKnownFileType = "\"\""; name = nanovg.c; path = ../../../deps/nanovg/src/nanovg.c; sourceTree = ""; }; 56 | C9A1DED751C94902B6ED293F /* ci_nanovg.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.cpp; name = ci_nanovg.cpp; path = ../../../src/ci_nanovg.cpp; sourceTree = ""; }; 57 | D8634A011B39249500B5C3D9 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; }; 58 | DA1F1D636DFC4584B3F2243A /* nanovg.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = nanovg.h; path = ../../../deps/nanovg/src/nanovg.h; sourceTree = ""; }; 59 | DC36A3AD561F4DC5A6D8D46B /* fontstash.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = fontstash.h; path = ../../../deps/nanovg/src/fontstash.h; sourceTree = ""; }; 60 | E89198BF0E564531B1CDA5AB /* ci_nanovg_gl.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.cpp; name = ci_nanovg_gl.cpp; path = ../../../src/ci_nanovg_gl.cpp; sourceTree = ""; }; 61 | F6EE405BF41E4AE2B6D5F72B /* SvgRenderer.hpp */ = {isa = PBXFileReference; lastKnownFileType = "\"\""; name = SvgRenderer.hpp; path = ../../../include/SvgRenderer.hpp; sourceTree = ""; }; 62 | /* End PBXFileReference section */ 63 | 64 | /* Begin PBXFrameworksBuildPhase section */ 65 | 8D11072E0486CEB800E47090 /* Frameworks */ = { 66 | isa = PBXFrameworksBuildPhase; 67 | buildActionMask = 2147483647; 68 | files = ( 69 | D8634A021B39249500B5C3D9 /* IOKit.framework in Frameworks */, 70 | 006D720419952D00008149E2 /* AVFoundation.framework in Frameworks */, 71 | 006D720519952D00008149E2 /* CoreMedia.framework in Frameworks */, 72 | 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, 73 | 0091D8F90E81B9330029341E /* OpenGL.framework in Frameworks */, 74 | 5323E6B20EAFCA74003A9687 /* CoreVideo.framework in Frameworks */, 75 | 5323E6B60EAFCA7E003A9687 /* QTKit.framework in Frameworks */, 76 | 00B784B30FF439BC000DE1D7 /* Accelerate.framework in Frameworks */, 77 | 00B784B40FF439BC000DE1D7 /* AudioToolbox.framework in Frameworks */, 78 | 00B784B50FF439BC000DE1D7 /* AudioUnit.framework in Frameworks */, 79 | 00B784B60FF439BC000DE1D7 /* CoreAudio.framework in Frameworks */, 80 | ); 81 | runOnlyForDeploymentPostprocessing = 0; 82 | }; 83 | /* End PBXFrameworksBuildPhase section */ 84 | 85 | /* Begin PBXGroup section */ 86 | 01B97315FEAEA392516A2CEA /* Blocks */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | D4BA6AA7089B436D812315BA /* NanoVG */, 90 | ); 91 | name = Blocks; 92 | sourceTree = ""; 93 | }; 94 | 080E96DDFE201D6D7F000001 /* Source */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | 70B967BF02464724B2A7CF79 /* MultiWindowApp.cpp */, 98 | ); 99 | name = Source; 100 | sourceTree = ""; 101 | }; 102 | 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | D8634A011B39249500B5C3D9 /* IOKit.framework */, 106 | 006D720219952D00008149E2 /* AVFoundation.framework */, 107 | 006D720319952D00008149E2 /* CoreMedia.framework */, 108 | 00B784AF0FF439BC000DE1D7 /* Accelerate.framework */, 109 | 00B784B00FF439BC000DE1D7 /* AudioToolbox.framework */, 110 | 00B784B10FF439BC000DE1D7 /* AudioUnit.framework */, 111 | 00B784B20FF439BC000DE1D7 /* CoreAudio.framework */, 112 | 5323E6B50EAFCA7E003A9687 /* QTKit.framework */, 113 | 5323E6B10EAFCA74003A9687 /* CoreVideo.framework */, 114 | 0091D8F80E81B9330029341E /* OpenGL.framework */, 115 | 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, 116 | ); 117 | name = "Linked Frameworks"; 118 | sourceTree = ""; 119 | }; 120 | 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = { 121 | isa = PBXGroup; 122 | children = ( 123 | 29B97324FDCFA39411CA2CEA /* AppKit.framework */, 124 | 29B97325FDCFA39411CA2CEA /* Foundation.framework */, 125 | ); 126 | name = "Other Frameworks"; 127 | sourceTree = ""; 128 | }; 129 | 19C28FACFE9D520D11CA2CBB /* Products */ = { 130 | isa = PBXGroup; 131 | children = ( 132 | 8D1107320486CEB800E47090 /* MultiWindow.app */, 133 | ); 134 | name = Products; 135 | sourceTree = ""; 136 | }; 137 | 29B97314FDCFA39411CA2CEA /* MultiWindow */ = { 138 | isa = PBXGroup; 139 | children = ( 140 | 01B97315FEAEA392516A2CEA /* Blocks */, 141 | 29B97315FDCFA39411CA2CEA /* Headers */, 142 | 080E96DDFE201D6D7F000001 /* Source */, 143 | 29B97317FDCFA39411CA2CEA /* Resources */, 144 | 29B97323FDCFA39411CA2CEA /* Frameworks */, 145 | 19C28FACFE9D520D11CA2CBB /* Products */, 146 | ); 147 | name = MultiWindow; 148 | sourceTree = ""; 149 | }; 150 | 29B97315FDCFA39411CA2CEA /* Headers */ = { 151 | isa = PBXGroup; 152 | children = ( 153 | 5B5635CBBD5540EC85B94809 /* Resources.h */, 154 | 941A0E2742974FEA8ED23F18 /* MultiWindow_Prefix.pch */, 155 | ); 156 | name = Headers; 157 | sourceTree = ""; 158 | }; 159 | 29B97317FDCFA39411CA2CEA /* Resources */ = { 160 | isa = PBXGroup; 161 | children = ( 162 | 6397D4420B34495398047FFA /* CinderApp.icns */, 163 | AB6123F538024125999A940C /* Info.plist */, 164 | ); 165 | name = Resources; 166 | sourceTree = ""; 167 | }; 168 | 29B97323FDCFA39411CA2CEA /* Frameworks */ = { 169 | isa = PBXGroup; 170 | children = ( 171 | 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */, 172 | 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */, 173 | ); 174 | name = Frameworks; 175 | sourceTree = ""; 176 | }; 177 | 57AFC53B24374C859EBFC1FE /* deps */ = { 178 | isa = PBXGroup; 179 | children = ( 180 | 5D73028AC6DD440D8C3D36D2 /* nanovg */, 181 | ); 182 | name = deps; 183 | sourceTree = ""; 184 | }; 185 | 5D73028AC6DD440D8C3D36D2 /* nanovg */ = { 186 | isa = PBXGroup; 187 | children = ( 188 | 6A0C4A48945C4F63AF6090BB /* src */, 189 | ); 190 | name = nanovg; 191 | sourceTree = ""; 192 | }; 193 | 6A0C4A48945C4F63AF6090BB /* src */ = { 194 | isa = PBXGroup; 195 | children = ( 196 | DC36A3AD561F4DC5A6D8D46B /* fontstash.h */, 197 | DA1F1D636DFC4584B3F2243A /* nanovg.h */, 198 | 760F3FC3618640A493C38F78 /* nanovg_gl.h */, 199 | 38B5C764DE684F329B160E2B /* nanovg_gl_utils.h */, 200 | 6D71086DA1B24110A93714C4 /* stb_image.h */, 201 | 003A927FFE474A91B1CBE579 /* stb_truetype.h */, 202 | C60688CBADB04452ACAC2ADE /* nanovg.c */, 203 | ); 204 | name = src; 205 | sourceTree = ""; 206 | }; 207 | BBE8F7AD8A9B4ECBAE2EE8D5 /* include */ = { 208 | isa = PBXGroup; 209 | children = ( 210 | C06B1D2B83ED45B687945B5C /* ci_nanovg.hpp */, 211 | 6BBD181B497F428A8DD824CB /* ci_nanovg_gl.hpp */, 212 | F6EE405BF41E4AE2B6D5F72B /* SvgRenderer.hpp */, 213 | ); 214 | name = include; 215 | sourceTree = ""; 216 | }; 217 | C6DA44214B8249B98EDF0BC0 /* src */ = { 218 | isa = PBXGroup; 219 | children = ( 220 | C9A1DED751C94902B6ED293F /* ci_nanovg.cpp */, 221 | E89198BF0E564531B1CDA5AB /* ci_nanovg_gl.cpp */, 222 | 614F60A623764E308F6E3B65 /* SvgRenderer.cpp */, 223 | ); 224 | name = src; 225 | sourceTree = ""; 226 | }; 227 | D4BA6AA7089B436D812315BA /* NanoVG */ = { 228 | isa = PBXGroup; 229 | children = ( 230 | 57AFC53B24374C859EBFC1FE /* deps */, 231 | BBE8F7AD8A9B4ECBAE2EE8D5 /* include */, 232 | C6DA44214B8249B98EDF0BC0 /* src */, 233 | ); 234 | name = NanoVG; 235 | sourceTree = ""; 236 | }; 237 | /* End PBXGroup section */ 238 | 239 | /* Begin PBXNativeTarget section */ 240 | 8D1107260486CEB800E47090 /* MultiWindow */ = { 241 | isa = PBXNativeTarget; 242 | buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "MultiWindow" */; 243 | buildPhases = ( 244 | 8D1107290486CEB800E47090 /* Resources */, 245 | 8D11072C0486CEB800E47090 /* Sources */, 246 | 8D11072E0486CEB800E47090 /* Frameworks */, 247 | ); 248 | buildRules = ( 249 | ); 250 | dependencies = ( 251 | ); 252 | name = MultiWindow; 253 | productInstallPath = "$(HOME)/Applications"; 254 | productName = MultiWindow; 255 | productReference = 8D1107320486CEB800E47090 /* MultiWindow.app */; 256 | productType = "com.apple.product-type.application"; 257 | }; 258 | /* End PBXNativeTarget section */ 259 | 260 | /* Begin PBXProject section */ 261 | 29B97313FDCFA39411CA2CEA /* Project object */ = { 262 | isa = PBXProject; 263 | attributes = { 264 | }; 265 | buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "MultiWindow" */; 266 | compatibilityVersion = "Xcode 3.2"; 267 | developmentRegion = English; 268 | hasScannedForEncodings = 1; 269 | knownRegions = ( 270 | English, 271 | Japanese, 272 | French, 273 | German, 274 | ); 275 | mainGroup = 29B97314FDCFA39411CA2CEA /* MultiWindow */; 276 | projectDirPath = ""; 277 | projectRoot = ""; 278 | targets = ( 279 | 8D1107260486CEB800E47090 /* MultiWindow */, 280 | ); 281 | }; 282 | /* End PBXProject section */ 283 | 284 | /* Begin PBXResourcesBuildPhase section */ 285 | 8D1107290486CEB800E47090 /* Resources */ = { 286 | isa = PBXResourcesBuildPhase; 287 | buildActionMask = 2147483647; 288 | files = ( 289 | 96B698272F8F4714B99ED466 /* CinderApp.icns in Resources */, 290 | ); 291 | runOnlyForDeploymentPostprocessing = 0; 292 | }; 293 | /* End PBXResourcesBuildPhase section */ 294 | 295 | /* Begin PBXSourcesBuildPhase section */ 296 | 8D11072C0486CEB800E47090 /* Sources */ = { 297 | isa = PBXSourcesBuildPhase; 298 | buildActionMask = 2147483647; 299 | files = ( 300 | 99485653E94049DAB1DD9069 /* MultiWindowApp.cpp in Sources */, 301 | 2B2FF55D0F0044A0B3C8249F /* nanovg.c in Sources */, 302 | C1EECDDB7F2B4178A2509A80 /* ci_nanovg.cpp in Sources */, 303 | 36AB83036C1B4DABA3F7D3D1 /* ci_nanovg_gl.cpp in Sources */, 304 | C3D9AF50729143DD8B208E8D /* SvgRenderer.cpp in Sources */, 305 | ); 306 | runOnlyForDeploymentPostprocessing = 0; 307 | }; 308 | /* End PBXSourcesBuildPhase section */ 309 | 310 | /* Begin XCBuildConfiguration section */ 311 | C01FCF4B08A954540054247B /* Debug */ = { 312 | isa = XCBuildConfiguration; 313 | buildSettings = { 314 | COMBINE_HIDPI_IMAGES = YES; 315 | COPY_PHASE_STRIP = NO; 316 | DEAD_CODE_STRIPPING = YES; 317 | GCC_DYNAMIC_NO_PIC = NO; 318 | GCC_INLINES_ARE_PRIVATE_EXTERN = YES; 319 | GCC_OPTIMIZATION_LEVEL = 0; 320 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 321 | GCC_PREFIX_HEADER = MultiWindow_Prefix.pch; 322 | GCC_PREPROCESSOR_DEFINITIONS = ( 323 | "DEBUG=1", 324 | "$(inherited)", 325 | ); 326 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 327 | INFOPLIST_FILE = Info.plist; 328 | INSTALL_PATH = "$(HOME)/Applications"; 329 | OTHER_LDFLAGS = "\"$(CINDER_PATH)/lib/libcinder_d.a\""; 330 | PRODUCT_NAME = MultiWindow; 331 | SYMROOT = ./build; 332 | WRAPPER_EXTENSION = app; 333 | }; 334 | name = Debug; 335 | }; 336 | C01FCF4C08A954540054247B /* Release */ = { 337 | isa = XCBuildConfiguration; 338 | buildSettings = { 339 | COMBINE_HIDPI_IMAGES = YES; 340 | DEAD_CODE_STRIPPING = YES; 341 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 342 | GCC_FAST_MATH = YES; 343 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO; 344 | GCC_INLINES_ARE_PRIVATE_EXTERN = YES; 345 | GCC_OPTIMIZATION_LEVEL = 3; 346 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 347 | GCC_PREFIX_HEADER = MultiWindow_Prefix.pch; 348 | GCC_PREPROCESSOR_DEFINITIONS = ( 349 | "NDEBUG=1", 350 | "$(inherited)", 351 | ); 352 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 353 | INFOPLIST_FILE = Info.plist; 354 | INSTALL_PATH = "$(HOME)/Applications"; 355 | OTHER_LDFLAGS = "\"$(CINDER_PATH)/lib/libcinder.a\""; 356 | PRODUCT_NAME = MultiWindow; 357 | STRIP_INSTALLED_PRODUCT = YES; 358 | SYMROOT = ./build; 359 | WRAPPER_EXTENSION = app; 360 | }; 361 | name = Release; 362 | }; 363 | C01FCF4F08A954540054247B /* Debug */ = { 364 | isa = XCBuildConfiguration; 365 | buildSettings = { 366 | ALWAYS_SEARCH_USER_PATHS = NO; 367 | ARCHS = x86_64; 368 | CINDER_PATH = ../../../../..; 369 | CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; 370 | CLANG_CXX_LIBRARY = "libc++"; 371 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 372 | GCC_WARN_UNUSED_VARIABLE = YES; 373 | HEADER_SEARCH_PATHS = "\"$(CINDER_PATH)/include\""; 374 | MACOSX_DEPLOYMENT_TARGET = 10.8; 375 | SDKROOT = macosx; 376 | USER_HEADER_SEARCH_PATHS = ../include; 377 | }; 378 | name = Debug; 379 | }; 380 | C01FCF5008A954540054247B /* Release */ = { 381 | isa = XCBuildConfiguration; 382 | buildSettings = { 383 | ALWAYS_SEARCH_USER_PATHS = NO; 384 | ARCHS = x86_64; 385 | CINDER_PATH = ../../../../..; 386 | CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; 387 | CLANG_CXX_LIBRARY = "libc++"; 388 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 389 | GCC_WARN_UNUSED_VARIABLE = YES; 390 | HEADER_SEARCH_PATHS = "\"$(CINDER_PATH)/include\""; 391 | MACOSX_DEPLOYMENT_TARGET = 10.8; 392 | SDKROOT = macosx; 393 | USER_HEADER_SEARCH_PATHS = ../include; 394 | }; 395 | name = Release; 396 | }; 397 | /* End XCBuildConfiguration section */ 398 | 399 | /* Begin XCConfigurationList section */ 400 | C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "MultiWindow" */ = { 401 | isa = XCConfigurationList; 402 | buildConfigurations = ( 403 | C01FCF4B08A954540054247B /* Debug */, 404 | C01FCF4C08A954540054247B /* Release */, 405 | ); 406 | defaultConfigurationIsVisible = 0; 407 | defaultConfigurationName = Release; 408 | }; 409 | C01FCF4E08A954540054247B /* Build configuration list for PBXProject "MultiWindow" */ = { 410 | isa = XCConfigurationList; 411 | buildConfigurations = ( 412 | C01FCF4F08A954540054247B /* Debug */, 413 | C01FCF5008A954540054247B /* Release */, 414 | ); 415 | defaultConfigurationIsVisible = 0; 416 | defaultConfigurationName = Release; 417 | }; 418 | /* End XCConfigurationList section */ 419 | }; 420 | rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; 421 | } 422 | -------------------------------------------------------------------------------- /samples/MultiWindow/xcode/MultiWindow_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 | -------------------------------------------------------------------------------- /samples/RenderToTexture/assets/Roboto-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notlion/Cinder-NanoVG/691fb921c8517bfe8c7d92da482c906ff24accc6/samples/RenderToTexture/assets/Roboto-Regular.ttf -------------------------------------------------------------------------------- /samples/RenderToTexture/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 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /samples/RenderToTexture/resources/CinderApp.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notlion/Cinder-NanoVG/691fb921c8517bfe8c7d92da482c906ff24accc6/samples/RenderToTexture/resources/CinderApp.icns -------------------------------------------------------------------------------- /samples/RenderToTexture/resources/CinderApp_ios.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notlion/Cinder-NanoVG/691fb921c8517bfe8c7d92da482c906ff24accc6/samples/RenderToTexture/resources/CinderApp_ios.png -------------------------------------------------------------------------------- /samples/RenderToTexture/resources/cinder_app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notlion/Cinder-NanoVG/691fb921c8517bfe8c7d92da482c906ff24accc6/samples/RenderToTexture/resources/cinder_app_icon.ico -------------------------------------------------------------------------------- /samples/RenderToTexture/src/RenderToTextureApp.cpp: -------------------------------------------------------------------------------- 1 | #include "cinder/app/App.h" 2 | #include "cinder/app/RendererGl.h" 3 | 4 | #include "cinder/gl/gl.h" 5 | #include "cinder/gl/Fbo.h" 6 | #include "cinder/gl/Texture.h" 7 | #include "cinder/gl/Shader.h" 8 | 9 | #include "cinder/Rand.h" 10 | #include "cinder/BSpline.h" 11 | 12 | #include "ci_nanovg_gl.hpp" 13 | 14 | using namespace ci; 15 | using namespace ci::app; 16 | using namespace std; 17 | 18 | static Colorf randColor() { 19 | return { Rand::randFloat(), Rand::randFloat(), Rand::randFloat() }; 20 | } 21 | 22 | class Shape { 23 | Path2d mPath; 24 | Colorf mColor; 25 | vec2 mPosition; 26 | 27 | public: 28 | Shape(Path2d path, vec2 position) : mPath{ move(path) }, 29 | mPosition{ position }, 30 | mColor{ randColor() } { 31 | } 32 | 33 | void draw(nvg::Context& vg) const { 34 | vg.beginPath(); 35 | vg.path2d(mPath); 36 | vg.fillColor(mColor); 37 | vg.fill(); 38 | } 39 | 40 | vec2 getPosition() { 41 | return mPosition; 42 | } 43 | 44 | Rectf getBounds() const { 45 | return mPath.calcPreciseBoundingBox(); 46 | } 47 | }; 48 | 49 | class ShapeProxy { 50 | gl::TextureRef mTexture; 51 | Rectf mBounds; 52 | shared_ptr mShape; 53 | 54 | public: 55 | ShapeProxy(nvg::Context& vg, shared_ptr shape) : mShape{ shape } { 56 | mBounds = mShape->getBounds(); 57 | 58 | // Grow the bounds a little to preserve nice anti-aliasing at the edges. 59 | mBounds.inflate(vec2(2)); 60 | 61 | auto fboSize = mBounds.getSize() * getWindow()->getContentScale(); 62 | auto fbo = gl::Fbo::create(fboSize.x, fboSize.y, gl::Fbo::Format().stencilBuffer()); 63 | gl::ScopedFramebuffer fboScp(fbo); 64 | 65 | gl::viewport(fboSize); 66 | gl::clear(ColorAf::zero()); 67 | gl::clear(GL_STENCIL_BUFFER_BIT); 68 | 69 | vg.beginFrame(mBounds.getSize(), getWindow()->getContentScale()); 70 | vg.translate(-mBounds.getUpperLeft()); 71 | mShape->draw(vg); 72 | vg.endFrame(); 73 | 74 | mTexture = fbo->getColorTexture(); 75 | } 76 | 77 | void draw() { 78 | gl::pushModelMatrix(); 79 | gl::draw(mTexture, mBounds); 80 | gl::popModelMatrix(); 81 | } 82 | 83 | vec2 getPosition() const { 84 | return mShape->getPosition(); 85 | } 86 | }; 87 | 88 | class RenderToTextureApp : public App { 89 | shared_ptr mCtx; 90 | vector> mShapes; 91 | vector> mProxies; 92 | 93 | bool mRenderProxies = false; 94 | 95 | public: 96 | void generateShapes(); 97 | void generateShapeTextures(); 98 | void setup() override; 99 | void update() override; 100 | void draw() override; 101 | }; 102 | 103 | void RenderToTextureApp::generateShapes() { 104 | auto generatePath = [](float radius, int numPoints) { 105 | // Generate a some random points. 106 | vector points(numPoints); 107 | generate(points.begin(), points.end(), [&] { 108 | static mat4 rotation; 109 | vec2 point = vec2(vec4(randFloat(radius * 0.5f, radius), 0, 0, 1) * rotation); 110 | rotation *= rotate((float)M_PI * 2.0f / numPoints, vec3(0, 0, 1)); 111 | return point; 112 | }); 113 | 114 | // Create a path from a closed looped BSpline. 115 | return Path2d{BSpline2f{points, 3, true, false}}; 116 | }; 117 | 118 | // Fill our array with shapes. 119 | mShapes.resize(32); 120 | generate(mShapes.begin(), mShapes.end(), [&] { 121 | float radius = randFloat(100, 300); 122 | int numPoints = randInt(4, 12); 123 | 124 | auto path = generatePath(radius, numPoints); 125 | auto position = vec2{randFloat(), randFloat()} * vec2{getWindowSize()}; 126 | 127 | return make_shared(path, position); 128 | }); 129 | 130 | // Generate texture proxies for each shape. 131 | mProxies.resize(mShapes.size()); 132 | transform(mShapes.begin(), mShapes.end(), mProxies.begin(), [&](shared_ptr shape) { 133 | return make_shared(*mCtx, shape); 134 | }); 135 | } 136 | 137 | void RenderToTextureApp::setup() { 138 | Rand::randomize(); 139 | mCtx = make_shared(nvg::createContextGL()); 140 | mCtx->createFont("roboto", getAssetPath("Roboto-Regular.ttf").string()); 141 | 142 | getWindow()->getSignalTouchesBegan().connect([&](const TouchEvent event) { 143 | generateShapes(); 144 | }); 145 | getWindow()->getSignalMouseDown().connect([&](const MouseEvent event) { 146 | generateShapes(); 147 | }); 148 | 149 | generateShapes(); 150 | } 151 | 152 | void RenderToTextureApp::update() { 153 | } 154 | 155 | void RenderToTextureApp::draw() { 156 | ivec2 windowPixelSize = vec2(getWindowSize()) * getWindowContentScale(); 157 | 158 | gl::viewport(windowPixelSize); 159 | gl::clear(Colorf{0, 0, 0}); 160 | gl::clear(GL_STENCIL_BUFFER_BIT); 161 | 162 | auto& vg = *mCtx; 163 | 164 | auto time = getElapsedSeconds(); 165 | bool showProxies = fmod(getElapsedSeconds(), 10.0) < 5.0; 166 | 167 | if (showProxies) { // Switch every 3 seconds. 168 | gl::setMatricesWindow(getWindowSize()); 169 | gl::ScopedGlslProg shaderScp(gl::getStockShader(gl::ShaderDef().color())); 170 | for (auto& proxy : mProxies) { 171 | gl::ScopedModelMatrix modelScp; 172 | gl::translate(proxy->getPosition()); 173 | gl::rotate(time, vec3(0, 0, 1)); 174 | proxy->draw(); 175 | } 176 | } 177 | else { 178 | vg.beginFrame(getWindowSize(), getWindowContentScale()); 179 | for (auto& shape : mShapes) { 180 | vg.save(); 181 | vg.translate(shape->getPosition()); 182 | vg.rotate(time); 183 | shape->draw(vg); 184 | vg.restore(); 185 | } 186 | vg.endFrame(); 187 | } 188 | 189 | string mode = showProxies ? "Texture Proxies" : "NanoVG"; 190 | vg.beginFrame(getWindowSize(), getWindowContentScale()); 191 | vg.translate(10, getWindowHeight() - 10); 192 | vg.fontFace("roboto"); 193 | vg.fontSize(24); 194 | vg.fillColor(Colorf::white()); 195 | vg.text(vec2(), "Fps: " + to_string(getAverageFps())); 196 | vg.text(vec2(0, -20), "Mode: " + mode); 197 | vg.endFrame(); 198 | } 199 | 200 | // NanoVG requires a stencil buffer in the main framebuffer and performs it's 201 | // own anti-aliasing by default. We disable opengl's AA and enable stencil here 202 | // to allow for this. 203 | CINDER_APP(RenderToTextureApp, RendererGl(RendererGl::Options().stencil().msaa(0)), 204 | [](App::Settings *settings) { 205 | settings->setHighDensityDisplayEnabled(); 206 | settings->setMultiTouchEnabled(); 207 | }) 208 | -------------------------------------------------------------------------------- /samples/RenderToTexture/vc2013/.gitignore: -------------------------------------------------------------------------------- 1 | Debug/ 2 | Release/ 3 | *.suo 4 | *.sdf 5 | -------------------------------------------------------------------------------- /samples/RenderToTexture/vc2013/RenderToTexture.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RenderToTexture", "RenderToTexture.vcxproj", "{B4E788AD-35F3-400B-9592-6D6F2BBD1716}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {B4E788AD-35F3-400B-9592-6D6F2BBD1716}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {B4E788AD-35F3-400B-9592-6D6F2BBD1716}.Debug|Win32.Build.0 = Debug|Win32 14 | {B4E788AD-35F3-400B-9592-6D6F2BBD1716}.Release|Win32.ActiveCfg = Release|Win32 15 | {B4E788AD-35F3-400B-9592-6D6F2BBD1716}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /samples/RenderToTexture/vc2013/RenderToTexture.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | Win32 6 | 7 | 8 | Release 9 | Win32 10 | 11 | 12 | 13 | {B4E788AD-35F3-400B-9592-6D6F2BBD1716} 14 | RenderToTexture 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 | $(SolutionDir)$(Configuration)\ 43 | $(Configuration)\ 44 | true 45 | $(SolutionDir)$(Configuration)\ 46 | $(Configuration)\ 47 | false 48 | 49 | 50 | 51 | Disabled 52 | ..\include;"..\..\..\..\..\..\cinder\include";"..\..\..\..\..\..\cinder\boost" 53 | WIN32;_DEBUG;_WINDOWS;NOMINMAX;_WIN32_WINNT=0x0502;%(PreprocessorDefinitions) 54 | true 55 | EnableFastChecks 56 | MultiThreadedDebug 57 | 58 | Level3 59 | EditAndContinue 60 | true 61 | 62 | 63 | "..\..\..\..\..\..\cinder\include";..\include 64 | 65 | 66 | cinder-$(PlatformToolset)_d.lib;%(AdditionalDependencies) 67 | "..\..\..\..\..\..\cinder\lib\msw\$(PlatformTarget)" 68 | true 69 | Windows 70 | false 71 | 72 | MachineX86 73 | LIBCMT;LIBCPMT 74 | 75 | 76 | 77 | 78 | ..\include;"..\..\..\..\..\..\cinder\include";"..\..\..\..\..\..\cinder\boost" 79 | WIN32;NDEBUG;_WINDOWS;NOMINMAX;_WIN32_WINNT=0x0502;%(PreprocessorDefinitions) 80 | MultiThreaded 81 | 82 | Level3 83 | ProgramDatabase 84 | true 85 | 86 | 87 | true 88 | 89 | 90 | "..\..\..\..\..\..\cinder\include";..\include 91 | 92 | 93 | cinder-$(PlatformToolset).lib;%(AdditionalDependencies) 94 | "..\..\..\..\..\..\cinder\lib\msw\$(PlatformTarget)" 95 | false 96 | true 97 | Windows 98 | true 99 | 100 | false 101 | 102 | MachineX86 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | -------------------------------------------------------------------------------- /samples/RenderToTexture/vc2013/RenderToTexture.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 | -------------------------------------------------------------------------------- /samples/RenderToTexture/vc2013/Resources.rc: -------------------------------------------------------------------------------- 1 | #include "../include/Resources.h" 2 | 3 | 1 ICON "..\\resources\\cinder_app_icon.ico" 4 | -------------------------------------------------------------------------------- /samples/RenderToTexture/xcode/.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | *.pbxuser 3 | !default.pbxuser 4 | *.mode1v3 5 | !default.mode1v3 6 | *.mode2v3 7 | !default.mode2v3 8 | *.perspectivev3 9 | !default.perspectivev3 10 | xcuserdata 11 | *.xccheckout 12 | *.moved-aside 13 | DerivedData 14 | *.xcuserstate 15 | *.xcworkspace 16 | -------------------------------------------------------------------------------- /samples/RenderToTexture/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 | -------------------------------------------------------------------------------- /samples/RenderToTexture/xcode/RenderToTexture.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 006D720419952D00008149E2 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 006D720219952D00008149E2 /* AVFoundation.framework */; }; 11 | 006D720519952D00008149E2 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 006D720319952D00008149E2 /* CoreMedia.framework */; }; 12 | 0091D8F90E81B9330029341E /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0091D8F80E81B9330029341E /* OpenGL.framework */; }; 13 | 00B784B30FF439BC000DE1D7 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00B784AF0FF439BC000DE1D7 /* Accelerate.framework */; }; 14 | 00B784B40FF439BC000DE1D7 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00B784B00FF439BC000DE1D7 /* AudioToolbox.framework */; }; 15 | 00B784B50FF439BC000DE1D7 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00B784B10FF439BC000DE1D7 /* AudioUnit.framework */; }; 16 | 00B784B60FF439BC000DE1D7 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00B784B20FF439BC000DE1D7 /* CoreAudio.framework */; }; 17 | 02CB5600D14E4A3D8D9248A3 /* RenderToTextureApp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5A840F6F981942E79088B711 /* RenderToTextureApp.cpp */; }; 18 | 5323E6B20EAFCA74003A9687 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5323E6B10EAFCA74003A9687 /* CoreVideo.framework */; }; 19 | 5323E6B60EAFCA7E003A9687 /* QTKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5323E6B50EAFCA7E003A9687 /* QTKit.framework */; }; 20 | 6A25695FBC6F483EBCFB894C /* nanovg.c in Sources */ = {isa = PBXBuildFile; fileRef = EF4F94986DD347D198F49FBA /* nanovg.c */; }; 21 | 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; 22 | 9A437DB3E97F47008F93A666 /* SvgRenderer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FC1488946CC44E109EAB052A /* SvgRenderer.cpp */; }; 23 | D853E97AA3D24D68AD07894A /* ci_nanovg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C97A0DB646184C73BE7C892F /* ci_nanovg.cpp */; }; 24 | D8634A041B392B2200B5C3D9 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D8634A031B392B2200B5C3D9 /* IOKit.framework */; }; 25 | DCAB05C30EA94FD299367443 /* CinderApp.icns in Resources */ = {isa = PBXBuildFile; fileRef = F47E35DE042B47DEA2921D19 /* CinderApp.icns */; }; 26 | EF9652FBDD4E4F4399DBDF00 /* ci_nanovg_gl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AC8E472CE15E491C9A3649B5 /* ci_nanovg_gl.cpp */; }; 27 | /* End PBXBuildFile section */ 28 | 29 | /* Begin PBXFileReference section */ 30 | 006D720219952D00008149E2 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; 31 | 006D720319952D00008149E2 /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; }; 32 | 0091D8F80E81B9330029341E /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = ""; }; 33 | 00B784AF0FF439BC000DE1D7 /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; }; 34 | 00B784B00FF439BC000DE1D7 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; 35 | 00B784B10FF439BC000DE1D7 /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = System/Library/Frameworks/AudioUnit.framework; sourceTree = SDKROOT; }; 36 | 00B784B20FF439BC000DE1D7 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; }; 37 | 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 38 | 11F86062FE1E49B981CE0FC5 /* ci_nanovg.hpp */ = {isa = PBXFileReference; lastKnownFileType = "\"\""; name = ci_nanovg.hpp; path = ../../../include/ci_nanovg.hpp; sourceTree = ""; }; 39 | 232B0F7BD67F4C95935944BC /* nanovg_gl_utils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = nanovg_gl_utils.h; path = ../../../deps/nanovg/src/nanovg_gl_utils.h; sourceTree = ""; }; 40 | 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 41 | 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 42 | 3D9422BF556F4A4FBF4A970B /* SvgRenderer.hpp */ = {isa = PBXFileReference; lastKnownFileType = "\"\""; name = SvgRenderer.hpp; path = ../../../include/SvgRenderer.hpp; sourceTree = ""; }; 43 | 49D69BE54CC94FBA8F718854 /* nanovg_gl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = nanovg_gl.h; path = ../../../deps/nanovg/src/nanovg_gl.h; sourceTree = ""; }; 44 | 5323E6B10EAFCA74003A9687 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = /System/Library/Frameworks/CoreVideo.framework; sourceTree = ""; }; 45 | 5323E6B50EAFCA7E003A9687 /* QTKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QTKit.framework; path = /System/Library/Frameworks/QTKit.framework; sourceTree = ""; }; 46 | 5856B8CE1E13436086D03946 /* stb_truetype.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = stb_truetype.h; path = ../../../deps/nanovg/src/stb_truetype.h; sourceTree = ""; }; 47 | 5A840F6F981942E79088B711 /* RenderToTextureApp.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.cpp; name = RenderToTextureApp.cpp; path = ../src/RenderToTextureApp.cpp; sourceTree = ""; }; 48 | 5E8ECEE71F624BFBA2A9F541 /* stb_image.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = stb_image.h; path = ../../../deps/nanovg/src/stb_image.h; sourceTree = ""; }; 49 | 658D98E0724149A389FD4826 /* nanovg.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = nanovg.h; path = ../../../deps/nanovg/src/nanovg.h; sourceTree = ""; }; 50 | 6622BBA08AAA4584A77835BF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 51 | 8D1107320486CEB800E47090 /* RenderToTexture.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RenderToTexture.app; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | 8F5FB09F42B8486B8BAF64A3 /* fontstash.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = fontstash.h; path = ../../../deps/nanovg/src/fontstash.h; sourceTree = ""; }; 53 | AC8E472CE15E491C9A3649B5 /* ci_nanovg_gl.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.cpp; name = ci_nanovg_gl.cpp; path = ../../../src/ci_nanovg_gl.cpp; sourceTree = ""; }; 54 | C97A0DB646184C73BE7C892F /* ci_nanovg.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.cpp; name = ci_nanovg.cpp; path = ../../../src/ci_nanovg.cpp; sourceTree = ""; }; 55 | D315003ABE704E52AF1FEF21 /* ci_nanovg_gl.hpp */ = {isa = PBXFileReference; lastKnownFileType = "\"\""; name = ci_nanovg_gl.hpp; path = ../../../include/ci_nanovg_gl.hpp; sourceTree = ""; }; 56 | D8634A031B392B2200B5C3D9 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; }; 57 | D9DBB3DA8BFD4D4893D49964 /* RenderToTexture_Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = "\"\""; path = RenderToTexture_Prefix.pch; sourceTree = ""; }; 58 | E516E0791B864B6E96645814 /* Resources.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Resources.h; path = ../include/Resources.h; sourceTree = ""; }; 59 | EF4F94986DD347D198F49FBA /* nanovg.c */ = {isa = PBXFileReference; lastKnownFileType = "\"\""; name = nanovg.c; path = ../../../deps/nanovg/src/nanovg.c; sourceTree = ""; }; 60 | F47E35DE042B47DEA2921D19 /* CinderApp.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = CinderApp.icns; path = ../resources/CinderApp.icns; sourceTree = ""; }; 61 | FC1488946CC44E109EAB052A /* SvgRenderer.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.cpp; name = SvgRenderer.cpp; path = ../../../src/SvgRenderer.cpp; sourceTree = ""; }; 62 | /* End PBXFileReference section */ 63 | 64 | /* Begin PBXFrameworksBuildPhase section */ 65 | 8D11072E0486CEB800E47090 /* Frameworks */ = { 66 | isa = PBXFrameworksBuildPhase; 67 | buildActionMask = 2147483647; 68 | files = ( 69 | D8634A041B392B2200B5C3D9 /* IOKit.framework in Frameworks */, 70 | 006D720419952D00008149E2 /* AVFoundation.framework in Frameworks */, 71 | 006D720519952D00008149E2 /* CoreMedia.framework in Frameworks */, 72 | 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, 73 | 0091D8F90E81B9330029341E /* OpenGL.framework in Frameworks */, 74 | 5323E6B20EAFCA74003A9687 /* CoreVideo.framework in Frameworks */, 75 | 5323E6B60EAFCA7E003A9687 /* QTKit.framework in Frameworks */, 76 | 00B784B30FF439BC000DE1D7 /* Accelerate.framework in Frameworks */, 77 | 00B784B40FF439BC000DE1D7 /* AudioToolbox.framework in Frameworks */, 78 | 00B784B50FF439BC000DE1D7 /* AudioUnit.framework in Frameworks */, 79 | 00B784B60FF439BC000DE1D7 /* CoreAudio.framework in Frameworks */, 80 | ); 81 | runOnlyForDeploymentPostprocessing = 0; 82 | }; 83 | /* End PBXFrameworksBuildPhase section */ 84 | 85 | /* Begin PBXGroup section */ 86 | 01B97315FEAEA392516A2CEA /* Blocks */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | D7645E5FA9E145FAADFD90E1 /* NanoVG */, 90 | ); 91 | name = Blocks; 92 | sourceTree = ""; 93 | }; 94 | 080E96DDFE201D6D7F000001 /* Source */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | 5A840F6F981942E79088B711 /* RenderToTextureApp.cpp */, 98 | ); 99 | name = Source; 100 | sourceTree = ""; 101 | }; 102 | 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | D8634A031B392B2200B5C3D9 /* IOKit.framework */, 106 | 006D720219952D00008149E2 /* AVFoundation.framework */, 107 | 006D720319952D00008149E2 /* CoreMedia.framework */, 108 | 00B784AF0FF439BC000DE1D7 /* Accelerate.framework */, 109 | 00B784B00FF439BC000DE1D7 /* AudioToolbox.framework */, 110 | 00B784B10FF439BC000DE1D7 /* AudioUnit.framework */, 111 | 00B784B20FF439BC000DE1D7 /* CoreAudio.framework */, 112 | 5323E6B50EAFCA7E003A9687 /* QTKit.framework */, 113 | 5323E6B10EAFCA74003A9687 /* CoreVideo.framework */, 114 | 0091D8F80E81B9330029341E /* OpenGL.framework */, 115 | 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, 116 | ); 117 | name = "Linked Frameworks"; 118 | sourceTree = ""; 119 | }; 120 | 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = { 121 | isa = PBXGroup; 122 | children = ( 123 | 29B97324FDCFA39411CA2CEA /* AppKit.framework */, 124 | 29B97325FDCFA39411CA2CEA /* Foundation.framework */, 125 | ); 126 | name = "Other Frameworks"; 127 | sourceTree = ""; 128 | }; 129 | 19C28FACFE9D520D11CA2CBB /* Products */ = { 130 | isa = PBXGroup; 131 | children = ( 132 | 8D1107320486CEB800E47090 /* RenderToTexture.app */, 133 | ); 134 | name = Products; 135 | sourceTree = ""; 136 | }; 137 | 29B97314FDCFA39411CA2CEA /* RenderToTexture */ = { 138 | isa = PBXGroup; 139 | children = ( 140 | 01B97315FEAEA392516A2CEA /* Blocks */, 141 | 29B97315FDCFA39411CA2CEA /* Headers */, 142 | 080E96DDFE201D6D7F000001 /* Source */, 143 | 29B97317FDCFA39411CA2CEA /* Resources */, 144 | 29B97323FDCFA39411CA2CEA /* Frameworks */, 145 | 19C28FACFE9D520D11CA2CBB /* Products */, 146 | ); 147 | name = RenderToTexture; 148 | sourceTree = ""; 149 | }; 150 | 29B97315FDCFA39411CA2CEA /* Headers */ = { 151 | isa = PBXGroup; 152 | children = ( 153 | E516E0791B864B6E96645814 /* Resources.h */, 154 | D9DBB3DA8BFD4D4893D49964 /* RenderToTexture_Prefix.pch */, 155 | ); 156 | name = Headers; 157 | sourceTree = ""; 158 | }; 159 | 29B97317FDCFA39411CA2CEA /* Resources */ = { 160 | isa = PBXGroup; 161 | children = ( 162 | F47E35DE042B47DEA2921D19 /* CinderApp.icns */, 163 | 6622BBA08AAA4584A77835BF /* Info.plist */, 164 | ); 165 | name = Resources; 166 | sourceTree = ""; 167 | }; 168 | 29B97323FDCFA39411CA2CEA /* Frameworks */ = { 169 | isa = PBXGroup; 170 | children = ( 171 | 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */, 172 | 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */, 173 | ); 174 | name = Frameworks; 175 | sourceTree = ""; 176 | }; 177 | 35F3E08929FA42FCAA105E2A /* include */ = { 178 | isa = PBXGroup; 179 | children = ( 180 | 11F86062FE1E49B981CE0FC5 /* ci_nanovg.hpp */, 181 | D315003ABE704E52AF1FEF21 /* ci_nanovg_gl.hpp */, 182 | 3D9422BF556F4A4FBF4A970B /* SvgRenderer.hpp */, 183 | ); 184 | name = include; 185 | sourceTree = ""; 186 | }; 187 | 5EE19D83200543B18A12DF93 /* src */ = { 188 | isa = PBXGroup; 189 | children = ( 190 | C97A0DB646184C73BE7C892F /* ci_nanovg.cpp */, 191 | AC8E472CE15E491C9A3649B5 /* ci_nanovg_gl.cpp */, 192 | FC1488946CC44E109EAB052A /* SvgRenderer.cpp */, 193 | ); 194 | name = src; 195 | sourceTree = ""; 196 | }; 197 | 7862CEBDC0FE42A2B13FF18C /* src */ = { 198 | isa = PBXGroup; 199 | children = ( 200 | 8F5FB09F42B8486B8BAF64A3 /* fontstash.h */, 201 | 658D98E0724149A389FD4826 /* nanovg.h */, 202 | 49D69BE54CC94FBA8F718854 /* nanovg_gl.h */, 203 | 232B0F7BD67F4C95935944BC /* nanovg_gl_utils.h */, 204 | 5E8ECEE71F624BFBA2A9F541 /* stb_image.h */, 205 | 5856B8CE1E13436086D03946 /* stb_truetype.h */, 206 | EF4F94986DD347D198F49FBA /* nanovg.c */, 207 | ); 208 | name = src; 209 | sourceTree = ""; 210 | }; 211 | 89C1C54934134405B8C788F7 /* nanovg */ = { 212 | isa = PBXGroup; 213 | children = ( 214 | 7862CEBDC0FE42A2B13FF18C /* src */, 215 | ); 216 | name = nanovg; 217 | sourceTree = ""; 218 | }; 219 | D7645E5FA9E145FAADFD90E1 /* NanoVG */ = { 220 | isa = PBXGroup; 221 | children = ( 222 | DCF485C29DA84364A14F1EDD /* deps */, 223 | 35F3E08929FA42FCAA105E2A /* include */, 224 | 5EE19D83200543B18A12DF93 /* src */, 225 | ); 226 | name = NanoVG; 227 | sourceTree = ""; 228 | }; 229 | DCF485C29DA84364A14F1EDD /* deps */ = { 230 | isa = PBXGroup; 231 | children = ( 232 | 89C1C54934134405B8C788F7 /* nanovg */, 233 | ); 234 | name = deps; 235 | sourceTree = ""; 236 | }; 237 | /* End PBXGroup section */ 238 | 239 | /* Begin PBXNativeTarget section */ 240 | 8D1107260486CEB800E47090 /* RenderToTexture */ = { 241 | isa = PBXNativeTarget; 242 | buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "RenderToTexture" */; 243 | buildPhases = ( 244 | 8D1107290486CEB800E47090 /* Resources */, 245 | 8D11072C0486CEB800E47090 /* Sources */, 246 | 8D11072E0486CEB800E47090 /* Frameworks */, 247 | ); 248 | buildRules = ( 249 | ); 250 | dependencies = ( 251 | ); 252 | name = RenderToTexture; 253 | productInstallPath = "$(HOME)/Applications"; 254 | productName = RenderToTexture; 255 | productReference = 8D1107320486CEB800E47090 /* RenderToTexture.app */; 256 | productType = "com.apple.product-type.application"; 257 | }; 258 | /* End PBXNativeTarget section */ 259 | 260 | /* Begin PBXProject section */ 261 | 29B97313FDCFA39411CA2CEA /* Project object */ = { 262 | isa = PBXProject; 263 | attributes = { 264 | }; 265 | buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "RenderToTexture" */; 266 | compatibilityVersion = "Xcode 3.2"; 267 | developmentRegion = English; 268 | hasScannedForEncodings = 1; 269 | knownRegions = ( 270 | English, 271 | Japanese, 272 | French, 273 | German, 274 | ); 275 | mainGroup = 29B97314FDCFA39411CA2CEA /* RenderToTexture */; 276 | projectDirPath = ""; 277 | projectRoot = ""; 278 | targets = ( 279 | 8D1107260486CEB800E47090 /* RenderToTexture */, 280 | ); 281 | }; 282 | /* End PBXProject section */ 283 | 284 | /* Begin PBXResourcesBuildPhase section */ 285 | 8D1107290486CEB800E47090 /* Resources */ = { 286 | isa = PBXResourcesBuildPhase; 287 | buildActionMask = 2147483647; 288 | files = ( 289 | DCAB05C30EA94FD299367443 /* CinderApp.icns in Resources */, 290 | ); 291 | runOnlyForDeploymentPostprocessing = 0; 292 | }; 293 | /* End PBXResourcesBuildPhase section */ 294 | 295 | /* Begin PBXSourcesBuildPhase section */ 296 | 8D11072C0486CEB800E47090 /* Sources */ = { 297 | isa = PBXSourcesBuildPhase; 298 | buildActionMask = 2147483647; 299 | files = ( 300 | 02CB5600D14E4A3D8D9248A3 /* RenderToTextureApp.cpp in Sources */, 301 | 6A25695FBC6F483EBCFB894C /* nanovg.c in Sources */, 302 | D853E97AA3D24D68AD07894A /* ci_nanovg.cpp in Sources */, 303 | EF9652FBDD4E4F4399DBDF00 /* ci_nanovg_gl.cpp in Sources */, 304 | 9A437DB3E97F47008F93A666 /* SvgRenderer.cpp in Sources */, 305 | ); 306 | runOnlyForDeploymentPostprocessing = 0; 307 | }; 308 | /* End PBXSourcesBuildPhase section */ 309 | 310 | /* Begin XCBuildConfiguration section */ 311 | C01FCF4B08A954540054247B /* Debug */ = { 312 | isa = XCBuildConfiguration; 313 | buildSettings = { 314 | COMBINE_HIDPI_IMAGES = YES; 315 | COPY_PHASE_STRIP = NO; 316 | DEAD_CODE_STRIPPING = YES; 317 | GCC_DYNAMIC_NO_PIC = NO; 318 | GCC_INLINES_ARE_PRIVATE_EXTERN = YES; 319 | GCC_OPTIMIZATION_LEVEL = 0; 320 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 321 | GCC_PREFIX_HEADER = RenderToTexture_Prefix.pch; 322 | GCC_PREPROCESSOR_DEFINITIONS = ( 323 | "DEBUG=1", 324 | "$(inherited)", 325 | ); 326 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 327 | INFOPLIST_FILE = Info.plist; 328 | INSTALL_PATH = "$(HOME)/Applications"; 329 | OTHER_LDFLAGS = "\"$(CINDER_PATH)/lib/libcinder_d.a\""; 330 | PRODUCT_NAME = RenderToTexture; 331 | SYMROOT = ./build; 332 | WRAPPER_EXTENSION = app; 333 | }; 334 | name = Debug; 335 | }; 336 | C01FCF4C08A954540054247B /* Release */ = { 337 | isa = XCBuildConfiguration; 338 | buildSettings = { 339 | COMBINE_HIDPI_IMAGES = YES; 340 | DEAD_CODE_STRIPPING = YES; 341 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 342 | GCC_FAST_MATH = YES; 343 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO; 344 | GCC_INLINES_ARE_PRIVATE_EXTERN = YES; 345 | GCC_OPTIMIZATION_LEVEL = 3; 346 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 347 | GCC_PREFIX_HEADER = RenderToTexture_Prefix.pch; 348 | GCC_PREPROCESSOR_DEFINITIONS = ( 349 | "NDEBUG=1", 350 | "$(inherited)", 351 | ); 352 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 353 | INFOPLIST_FILE = Info.plist; 354 | INSTALL_PATH = "$(HOME)/Applications"; 355 | OTHER_LDFLAGS = "\"$(CINDER_PATH)/lib/libcinder.a\""; 356 | PRODUCT_NAME = RenderToTexture; 357 | STRIP_INSTALLED_PRODUCT = YES; 358 | SYMROOT = ./build; 359 | WRAPPER_EXTENSION = app; 360 | }; 361 | name = Release; 362 | }; 363 | C01FCF4F08A954540054247B /* Debug */ = { 364 | isa = XCBuildConfiguration; 365 | buildSettings = { 366 | ALWAYS_SEARCH_USER_PATHS = NO; 367 | ARCHS = x86_64; 368 | CINDER_PATH = ../../../../..; 369 | CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; 370 | CLANG_CXX_LIBRARY = "libc++"; 371 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 372 | GCC_WARN_UNUSED_VARIABLE = YES; 373 | HEADER_SEARCH_PATHS = "\"$(CINDER_PATH)/include\""; 374 | MACOSX_DEPLOYMENT_TARGET = 10.8; 375 | SDKROOT = macosx; 376 | USER_HEADER_SEARCH_PATHS = ../include; 377 | }; 378 | name = Debug; 379 | }; 380 | C01FCF5008A954540054247B /* Release */ = { 381 | isa = XCBuildConfiguration; 382 | buildSettings = { 383 | ALWAYS_SEARCH_USER_PATHS = NO; 384 | ARCHS = x86_64; 385 | CINDER_PATH = ../../../../..; 386 | CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; 387 | CLANG_CXX_LIBRARY = "libc++"; 388 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 389 | GCC_WARN_UNUSED_VARIABLE = YES; 390 | HEADER_SEARCH_PATHS = "\"$(CINDER_PATH)/include\""; 391 | MACOSX_DEPLOYMENT_TARGET = 10.8; 392 | SDKROOT = macosx; 393 | USER_HEADER_SEARCH_PATHS = ../include; 394 | }; 395 | name = Release; 396 | }; 397 | /* End XCBuildConfiguration section */ 398 | 399 | /* Begin XCConfigurationList section */ 400 | C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "RenderToTexture" */ = { 401 | isa = XCConfigurationList; 402 | buildConfigurations = ( 403 | C01FCF4B08A954540054247B /* Debug */, 404 | C01FCF4C08A954540054247B /* Release */, 405 | ); 406 | defaultConfigurationIsVisible = 0; 407 | defaultConfigurationName = Release; 408 | }; 409 | C01FCF4E08A954540054247B /* Build configuration list for PBXProject "RenderToTexture" */ = { 410 | isa = XCConfigurationList; 411 | buildConfigurations = ( 412 | C01FCF4F08A954540054247B /* Debug */, 413 | C01FCF5008A954540054247B /* Release */, 414 | ); 415 | defaultConfigurationIsVisible = 0; 416 | defaultConfigurationName = Release; 417 | }; 418 | /* End XCConfigurationList section */ 419 | }; 420 | rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; 421 | } 422 | -------------------------------------------------------------------------------- /samples/RenderToTexture/xcode/RenderToTexture_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 | -------------------------------------------------------------------------------- /samples/RenderToTexture/xcode_ios/.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | *.pbxuser 3 | !default.pbxuser 4 | *.mode1v3 5 | !default.mode1v3 6 | *.mode2v3 7 | !default.mode2v3 8 | *.perspectivev3 9 | !default.perspectivev3 10 | xcuserdata 11 | *.xccheckout 12 | *.moved-aside 13 | DerivedData 14 | *.xcuserstate 15 | *.xcworkspace 16 | -------------------------------------------------------------------------------- /samples/RenderToTexture/xcode_ios/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "8.0", 8 | "subtype" : "736h", 9 | "filename" : "Default-736h@3x~iphone.png", 10 | "scale" : "3x" 11 | }, 12 | { 13 | "orientation" : "landscape", 14 | "idiom" : "iphone", 15 | "extent" : "full-screen", 16 | "minimum-system-version" : "8.0", 17 | "subtype" : "736h", 18 | "scale" : "3x" 19 | }, 20 | { 21 | "extent" : "full-screen", 22 | "idiom" : "iphone", 23 | "subtype" : "667h", 24 | "filename" : "Default-667@2x.png", 25 | "minimum-system-version" : "8.0", 26 | "orientation" : "portrait", 27 | "scale" : "2x" 28 | }, 29 | { 30 | "orientation" : "portrait", 31 | "idiom" : "iphone", 32 | "extent" : "full-screen", 33 | "minimum-system-version" : "7.0", 34 | "scale" : "2x" 35 | }, 36 | { 37 | "extent" : "full-screen", 38 | "idiom" : "iphone", 39 | "subtype" : "retina4", 40 | "filename" : "Default-568h@2x.png", 41 | "minimum-system-version" : "7.0", 42 | "orientation" : "portrait", 43 | "scale" : "2x" 44 | }, 45 | { 46 | "orientation" : "portrait", 47 | "idiom" : "ipad", 48 | "extent" : "full-screen", 49 | "minimum-system-version" : "7.0", 50 | "scale" : "1x" 51 | }, 52 | { 53 | "orientation" : "landscape", 54 | "idiom" : "ipad", 55 | "extent" : "full-screen", 56 | "minimum-system-version" : "7.0", 57 | "scale" : "1x" 58 | }, 59 | { 60 | "orientation" : "portrait", 61 | "idiom" : "ipad", 62 | "extent" : "full-screen", 63 | "minimum-system-version" : "7.0", 64 | "scale" : "2x" 65 | }, 66 | { 67 | "orientation" : "landscape", 68 | "idiom" : "ipad", 69 | "extent" : "full-screen", 70 | "minimum-system-version" : "7.0", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "orientation" : "portrait", 75 | "idiom" : "iphone", 76 | "extent" : "full-screen", 77 | "scale" : "1x" 78 | }, 79 | { 80 | "orientation" : "portrait", 81 | "idiom" : "iphone", 82 | "extent" : "full-screen", 83 | "scale" : "2x" 84 | }, 85 | { 86 | "orientation" : "portrait", 87 | "idiom" : "iphone", 88 | "extent" : "full-screen", 89 | "filename" : "Default-568h@2x.png", 90 | "subtype" : "retina4", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "orientation" : "portrait", 95 | "idiom" : "ipad", 96 | "extent" : "to-status-bar", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "orientation" : "portrait", 101 | "idiom" : "ipad", 102 | "extent" : "to-status-bar", 103 | "scale" : "2x" 104 | } 105 | ], 106 | "info" : { 107 | "version" : 1, 108 | "author" : "xcode" 109 | } 110 | } -------------------------------------------------------------------------------- /samples/RenderToTexture/xcode_ios/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notlion/Cinder-NanoVG/691fb921c8517bfe8c7d92da482c906ff24accc6/samples/RenderToTexture/xcode_ios/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png -------------------------------------------------------------------------------- /samples/RenderToTexture/xcode_ios/Images.xcassets/LaunchImage.launchimage/Default-667@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notlion/Cinder-NanoVG/691fb921c8517bfe8c7d92da482c906ff24accc6/samples/RenderToTexture/xcode_ios/Images.xcassets/LaunchImage.launchimage/Default-667@2x.png -------------------------------------------------------------------------------- /samples/RenderToTexture/xcode_ios/Images.xcassets/LaunchImage.launchimage/Default-736h@3x~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notlion/Cinder-NanoVG/691fb921c8517bfe8c7d92da482c906ff24accc6/samples/RenderToTexture/xcode_ios/Images.xcassets/LaunchImage.launchimage/Default-736h@3x~iphone.png -------------------------------------------------------------------------------- /samples/RenderToTexture/xcode_ios/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIcons 14 | 15 | CFBundlePrimaryIcon 16 | 17 | CFBundleIconFiles 18 | 19 | 20 | CinderApp_ios.png 21 | 22 | UIPrerenderedIcon 23 | 24 | 25 | 26 | CFBundleIdentifier 27 | org.libcinder.${PRODUCT_NAME:rfc1034identifier} 28 | CFBundleInfoDictionaryVersion 29 | 6.0 30 | CFBundleName 31 | ${PRODUCT_NAME} 32 | CFBundlePackageType 33 | APPL 34 | CFBundleShortVersionString 35 | 1.0 36 | CFBundleSignature 37 | ???? 38 | CFBundleVersion 39 | 1 40 | LSRequiresIPhoneOS 41 | 42 | NSMainNibFile 43 | 44 | NSMainNibFile~ipad 45 | 46 | UISupportedInterfaceOrientations 47 | 48 | UIInterfaceOrientationPortrait 49 | 50 | UISupportedInterfaceOrientations~ipad 51 | 52 | UIInterfaceOrientationPortrait 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /samples/RenderToTexture/xcode_ios/RenderToTexture_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 -------------------------------------------------------------------------------- /src/SvgRenderer.cpp: -------------------------------------------------------------------------------- 1 | #include "ci_nanovg.hpp" 2 | #include "SvgRenderer.hpp" 3 | 4 | #include "nanovg.h" 5 | 6 | namespace cinder { namespace nvg { 7 | 8 | SvgRenderer::SvgRenderer(Context &ctx) : mCtx{ ctx } { 9 | mMatrixStack.emplace_back(1); 10 | 11 | mFillStack.push_back(svg::Paint(Color::black())); 12 | mStrokeStack.push_back(svg::Paint()); 13 | 14 | mFillOpacityStack.push_back(1.0f); 15 | mStrokeOpacityStack.push_back(1.0f); 16 | mStrokeWidthStack.push_back(1.0f); 17 | 18 | pushLineCap(svg::LINE_CAP_BUTT); 19 | pushLineJoin(svg::LINE_JOIN_MITER); 20 | 21 | pushTextPen(vec2()); 22 | pushTextRotation(0.0f); 23 | } 24 | 25 | 26 | bool SvgRenderer::prepareFill() { 27 | const auto &paint = mFillStack.back(); 28 | 29 | if (paint.isNone()) { 30 | return false; 31 | } 32 | else { 33 | float opacity = mFillOpacityStack.back(); 34 | 35 | if (paint.isLinearGradient()) { 36 | auto nvgPaint = mCtx.convert(paint); 37 | nvgPaint.innerColor.a *= opacity; 38 | nvgPaint.outerColor.a *= opacity; 39 | mCtx.fillPaint(nvgPaint); 40 | } 41 | else if (paint.isRadialGradient()) { 42 | // TODO(ryan): Implement this. 43 | return false; 44 | } 45 | else { 46 | ColorAf color = paint.getColor(); 47 | color.a *= opacity; 48 | mCtx.fillColor(color); 49 | } 50 | 51 | return true; 52 | } 53 | } 54 | 55 | bool SvgRenderer::prepareStroke() { 56 | const auto &paint = mStrokeStack.back(); 57 | 58 | if (paint.isNone()) { 59 | return false; 60 | } 61 | else { 62 | float opacity = mStrokeOpacityStack.back(); 63 | 64 | if (paint.isLinearGradient()) { 65 | auto nvgPaint = mCtx.convert(paint); 66 | nvgPaint.innerColor.a *= opacity; 67 | nvgPaint.outerColor.a *= opacity; 68 | mCtx.strokePaint(nvgPaint); 69 | } 70 | else if (paint.isRadialGradient()) { 71 | // TODO(ryan): Implement this. 72 | return false; 73 | } 74 | else { 75 | ColorAf color = paint.getColor(); 76 | color.a *= opacity; 77 | mCtx.strokeColor(color); 78 | } 79 | 80 | return true; 81 | } 82 | } 83 | 84 | void SvgRenderer::fillAndStroke() { 85 | if (prepareFill()) mCtx.fill(); 86 | if (prepareStroke()) mCtx.stroke(); 87 | } 88 | 89 | 90 | void SvgRenderer::drawPath(const svg::Path &path) { 91 | mCtx.beginPath(); 92 | mCtx.shape2d(path.getShape2d()); 93 | fillAndStroke(); 94 | } 95 | 96 | void SvgRenderer::drawPolyline(const svg::Polyline &polyline) { 97 | mCtx.beginPath(); 98 | mCtx.polyLine(polyline.getPolyLine()); 99 | fillAndStroke(); 100 | } 101 | 102 | void SvgRenderer::drawPolygon(const svg::Polygon &polygon) { 103 | mCtx.beginPath(); 104 | mCtx.polyLine(polygon.getPolyLine()); 105 | fillAndStroke(); 106 | } 107 | 108 | void SvgRenderer::drawLine(const svg::Line &line) { 109 | mCtx.beginPath(); 110 | mCtx.moveTo(line.getPoint1()); 111 | mCtx.lineTo(line.getPoint2()); 112 | fillAndStroke(); 113 | } 114 | 115 | void SvgRenderer::drawRect(const svg::Rect &rect) { 116 | mCtx.beginPath(); 117 | mCtx.rect(rect.getRect()); 118 | fillAndStroke(); 119 | } 120 | 121 | void SvgRenderer::drawCircle(const svg::Circle &circle) { 122 | mCtx.beginPath(); 123 | mCtx.circle(circle.getCenter(), circle.getRadius()); 124 | fillAndStroke(); 125 | } 126 | 127 | void SvgRenderer::drawEllipse(const svg::Ellipse &ellipse) { 128 | mCtx.beginPath(); 129 | mCtx.ellipse(ellipse.getCenter(), ellipse.getRadiusX(), ellipse.getRadiusY()); 130 | fillAndStroke(); 131 | } 132 | 133 | void SvgRenderer::drawTextSpan(const svg::TextSpan &span) { 134 | mCtx.save(); 135 | mCtx.rotate(toRadians(mTextRotationStack.back())); 136 | 137 | // TODO(ryan): This font size multiplier was just guessed based on how the test text looked and 138 | // may not be correct. Check with other fonts / sizes. 139 | mCtx.fontSize(span.getFontSize().asUser() * 1.1666f); 140 | 141 | mCtx.fillColor(span.getFill().getColor()); 142 | mCtx.textAlign(NVG_ALIGN_LEFT | NVG_ALIGN_BOTTOM); 143 | mCtx.text(mTextPenStack.back(), span.getString()); 144 | mCtx.restore(); 145 | } 146 | 147 | 148 | void SvgRenderer::pushMatrix(const mat3 &top) { 149 | mMatrixStack.push_back(mMatrixStack.back() * top); 150 | mCtx.setTransform(mMatrixStack.back()); 151 | } 152 | void SvgRenderer::popMatrix() { 153 | mMatrixStack.pop_back(); 154 | mCtx.setTransform(mMatrixStack.back()); 155 | } 156 | 157 | void SvgRenderer::pushFill(const class svg::Paint &paint) { 158 | mFillStack.push_back(paint); 159 | } 160 | void SvgRenderer::popFill() { 161 | mFillStack.pop_back(); 162 | } 163 | 164 | void SvgRenderer::pushStroke(const class svg::Paint &paint) { 165 | mStrokeStack.push_back(paint); 166 | } 167 | void SvgRenderer::popStroke() { 168 | mStrokeStack.pop_back(); 169 | } 170 | 171 | void SvgRenderer::pushFillOpacity(float opacity ) { 172 | mFillOpacityStack.push_back(opacity); 173 | } 174 | void SvgRenderer::popFillOpacity() { 175 | mFillOpacityStack.pop_back(); 176 | } 177 | 178 | void SvgRenderer::pushStrokeOpacity(float opacity) { 179 | mStrokeOpacityStack.push_back(opacity); 180 | } 181 | void SvgRenderer::popStrokeOpacity() { 182 | mStrokeOpacityStack.pop_back(); 183 | } 184 | 185 | void SvgRenderer::pushStrokeWidth(float width) { 186 | mStrokeWidthStack.push_back(width); 187 | mCtx.strokeWidth(width); 188 | } 189 | void SvgRenderer::popStrokeWidth() { 190 | mStrokeWidthStack.pop_back(); 191 | mCtx.strokeWidth(mStrokeWidthStack.back()); 192 | } 193 | 194 | void SvgRenderer::pushFillRule(svg::FillRule) { 195 | // NOTE(ryan): Fill rules other than even-odd are not supported by NanoVG. 196 | } 197 | void SvgRenderer::popFillRule() {} 198 | 199 | void SvgRenderer::pushLineCap(svg::LineCap lineCap) { 200 | int cap = lineCap == svg::LINE_CAP_ROUND ? NVG_ROUND : 201 | lineCap == svg::LINE_CAP_SQUARE ? NVG_SQUARE : NVG_BUTT; 202 | mLineCapStack.push_back(cap); 203 | mCtx.lineCap(cap); 204 | } 205 | void SvgRenderer::popLineCap() { 206 | mLineCapStack.pop_back(); 207 | mCtx.lineCap(mLineCapStack.back()); 208 | } 209 | 210 | void SvgRenderer::pushLineJoin(svg::LineJoin lineJoin) { 211 | int join = lineJoin == svg::LINE_JOIN_ROUND ? NVG_ROUND : 212 | lineJoin == svg::LINE_JOIN_BEVEL ? NVG_BEVEL : NVG_MITER; 213 | mLineJoinStack.push_back(join); 214 | mCtx.lineJoin(join); 215 | } 216 | void SvgRenderer::popLineJoin() { 217 | mLineJoinStack.pop_back(); 218 | mCtx.lineJoin(mLineJoinStack.back()); 219 | } 220 | 221 | void SvgRenderer::pushTextPen(const vec2 &penPos) { 222 | mTextPenStack.push_back(penPos); 223 | } 224 | 225 | void SvgRenderer::popTextPen() { 226 | mTextPenStack.pop_back(); 227 | } 228 | 229 | void SvgRenderer::pushTextRotation(float rotation) { 230 | mTextRotationStack.push_back(rotation); 231 | } 232 | 233 | void SvgRenderer::popTextRotation() { 234 | mTextRotationStack.pop_back(); 235 | } 236 | 237 | }} // cinder::nvg 238 | -------------------------------------------------------------------------------- /src/ci_nanovg.cpp: -------------------------------------------------------------------------------- 1 | #include "ci_nanovg.hpp" 2 | #include "SvgRenderer.hpp" 3 | 4 | namespace cinder { 5 | namespace nvg { 6 | 7 | Image::Image(Image &&image) : mCtx{ image.mCtx }, id{ image.id } { 8 | image.mCtx = nullptr; 9 | } 10 | 11 | Image &Image::operator=(Image &&image) { 12 | mCtx = image.mCtx; 13 | id = image.id; 14 | image.mCtx = nullptr; 15 | return *this; 16 | } 17 | 18 | Image::Image(NVGcontext *ctx, int id) : mCtx{ ctx }, id{ id } {} 19 | 20 | Image::~Image() { 21 | if (mCtx) nvgDeleteImage(mCtx, id); 22 | } 23 | 24 | Context::Context(NVGcontext *ptr, Deleter deleter) : mPtr{ ptr, deleter } {} 25 | 26 | // svg::Paint to NVGpaint conversion. 27 | // Currently only works for 2-color linear gradients. 28 | NVGpaint Context::convert(const svg::Paint &paint) { 29 | // NanoVG does not really support radial gradients in the same way as SVG. 30 | // Cinder seems to support unequal radius on x and y, and NVG has two radii. 31 | // Since I don't have a use for this i'm just going to punt for now. 32 | // There is probably also a better way to handle this.. 33 | assert(paint.isLinearGradient()); 34 | 35 | const auto &p0 = paint.getCoords0(); 36 | const auto &p1 = paint.getCoords1(); 37 | const auto &c0 = paint.getColor(0); 38 | const auto &c1 = paint.getColor(1); 39 | 40 | return linearGradient(p0, p1, c0, c1); 41 | } 42 | 43 | void Context::strokePaint(const svg::Paint &paint) { 44 | if (paint.isNone()) return; 45 | if (paint.isLinearGradient()) strokePaint(convert(paint)); 46 | strokeColor(paint.getColor()); 47 | } 48 | 49 | void Context::fillPaint(const svg::Paint &paint) { 50 | if (paint.isNone()) return; 51 | if (paint.isLinearGradient()) fillPaint(convert(paint)); 52 | fillColor(paint.getColor()); 53 | } 54 | 55 | void Context::polyLine(const PolyLine2f &polyline) { 56 | auto &pts = polyline.getPoints(); 57 | if (pts.size() >= 2) { 58 | moveTo(pts[0]); 59 | for (auto i = begin(pts) + 1; i != end(pts); ++i) { 60 | lineTo(*i); 61 | } 62 | if (polyline.isClosed()) closePath(); 63 | } 64 | } 65 | 66 | void Context::path2dSegment(Path2d::SegmentType type, const vec2 *p1, const vec2 *p2, 67 | const vec2 *p3) { 68 | switch (type) { 69 | case Path2d::MOVETO: 70 | moveTo(*p3); 71 | break; 72 | case Path2d::QUADTO: 73 | quadTo(*p2, *p3); 74 | break; 75 | case Path2d::CUBICTO: 76 | bezierTo(*p1, *p2, *p3); 77 | break; 78 | case Path2d::LINETO: 79 | case Path2d::CLOSE: 80 | lineTo(*p3); 81 | break; 82 | } 83 | } 84 | 85 | void Context::path2d(const cinder::Path2d &path) { 86 | const vec2 *p1 = nullptr, *p2 = nullptr, *p3 = &path.getPoint(0); 87 | 88 | path2dSegment(Path2d::MOVETO, p1, p2, p3); 89 | 90 | size_t i = 1; 91 | for (auto &seg : path.getSegments()) { 92 | if (seg == Path2d::CLOSE) { 93 | p1 = p2; 94 | p2 = p3; 95 | p3 = &path.getPoint(0); 96 | } else { 97 | for (size_t ni = i + Path2d::sSegmentTypePointCounts[seg]; i < ni; ++i) { 98 | p1 = p2; 99 | p2 = p3; 100 | p3 = &path.getPoint(i); 101 | } 102 | } 103 | 104 | path2dSegment(seg, p1, p2, p3); 105 | } 106 | } 107 | 108 | void Context::shape2d(const Shape2d &shape) { 109 | for (auto &contour : shape.getContours()) { 110 | path2d(contour); 111 | } 112 | } 113 | 114 | void Context::draw(const svg::Doc &svg) { 115 | SvgRenderer renderer(*this); 116 | svg.render(renderer); 117 | } 118 | 119 | // Frame // 120 | 121 | void Context::beginFrame(int windowWidth, int windowHeight, float devicePixelRatio) { 122 | nvgBeginFrame(get(), windowWidth, windowHeight, devicePixelRatio); 123 | } 124 | void Context::beginFrame(const ivec2 &windowSize, float devicePixelRatio) { 125 | beginFrame(windowSize.x, windowSize.y, devicePixelRatio); 126 | } 127 | void Context::cancelFrame() { 128 | nvgCancelFrame(get()); 129 | } 130 | void Context::endFrame() { 131 | nvgEndFrame(get()); 132 | } 133 | 134 | // Global Compositing // 135 | 136 | void Context::globalCompositeOperation(int op) { 137 | nvgGlobalCompositeOperation(get(), op); 138 | } 139 | void Context::globalCompositeBlendFunc(int sfactor, int dfactor) { 140 | nvgGlobalCompositeBlendFunc(get(), sfactor, dfactor); 141 | } 142 | void Context::globalCompositeBlendFuncSeparate(int srcRGB, int dstRGB, int srcAlpha, int dstAlpha) { 143 | nvgGlobalCompositeBlendFuncSeparate(get(), srcRGB, dstRGB, srcAlpha, dstAlpha); 144 | } 145 | 146 | // State Handling // 147 | 148 | void Context::save() { 149 | nvgSave(get()); 150 | } 151 | void Context::restore() { 152 | nvgRestore(get()); 153 | } 154 | void Context::reset() { 155 | nvgReset(get()); 156 | } 157 | 158 | // Render Styles // 159 | 160 | void Context::strokeColor(const NVGcolor &color) { 161 | nvgStrokeColor(get(), color); 162 | } 163 | void Context::strokeColor(const ColorAf &color) { 164 | strokeColor(reinterpret_cast(color)); 165 | } 166 | void Context::strokePaint(const NVGpaint &paint) { 167 | nvgStrokePaint(get(), paint); 168 | } 169 | void Context::fillColor(const NVGcolor &color) { 170 | nvgFillColor(get(), color); 171 | } 172 | void Context::fillColor(const ColorAf &color) { 173 | fillColor(reinterpret_cast(color)); 174 | } 175 | void Context::fillPaint(const NVGpaint &paint) { 176 | nvgFillPaint(get(), paint); 177 | } 178 | 179 | void Context::miterLimit(float limit) { 180 | nvgMiterLimit(get(), limit); 181 | } 182 | void Context::strokeWidth(float size) { 183 | nvgStrokeWidth(get(), size); 184 | } 185 | void Context::lineCap(int cap) { 186 | nvgLineCap(get(), cap); 187 | } 188 | void Context::lineJoin(int join) { 189 | nvgLineJoin(get(), join); 190 | } 191 | 192 | // Transform // 193 | 194 | void Context::resetTransform() { 195 | nvgResetTransform(get()); 196 | } 197 | void Context::transform(const mat3 &mtx) { 198 | nvgTransform(get(), mtx[0][0], mtx[0][1], mtx[1][0], mtx[1][1], mtx[2][0], mtx[2][1]); 199 | } 200 | void Context::setTransform(const mat3 &mtx) { 201 | resetTransform(); 202 | transform(mtx); 203 | } 204 | void Context::translate(float x, float y) { 205 | nvgTranslate(get(), x, y); 206 | } 207 | void Context::translate(const vec2 &translation) { 208 | translate(translation.x, translation.y); 209 | } 210 | void Context::rotate(float angle) { 211 | nvgRotate(get(), angle); 212 | } 213 | void Context::skewX(float angle) { 214 | nvgSkewX(get(), angle); 215 | } 216 | void Context::skewY(float angle) { 217 | nvgSkewY(get(), angle); 218 | } 219 | void Context::scale(float x, float y) { 220 | nvgScale(get(), x, y); 221 | } 222 | void Context::scale(const vec2 &s) { 223 | scale(s.x, s.y); 224 | } 225 | 226 | mat3 Context::currentTransform() { 227 | float m[6]; 228 | nvgCurrentTransform(get(), m); 229 | return mat3(m[0], m[1], 0.0f, m[2], m[3], 0.0f, m[4], m[5], 1.0f); 230 | } 231 | 232 | // Paints // 233 | 234 | NVGpaint Context::linearGradient(const vec2 &start, const vec2 &end, const ColorAf &c1, 235 | const ColorAf &c2) { 236 | return nvgLinearGradient(get(), start.x, start.y, end.x, end.y, nvgRGBAf(c1.r, c1.g, c1.b, c1.a), 237 | nvgRGBAf(c2.r, c2.g, c2.b, c2.a)); 238 | } 239 | NVGpaint Context::boxGradient(const Rectf &bounds, float r, float f, const ColorAf &c1, 240 | const ColorAf &c2) { 241 | return nvgBoxGradient(get(), bounds.getX1(), bounds.getY1(), bounds.getWidth(), bounds.getWidth(), 242 | r, f, nvgRGBAf(c1.r, c1.g, c1.b, c1.a), nvgRGBAf(c2.r, c2.g, c2.b, c2.a)); 243 | } 244 | NVGpaint Context::radialGradient(const vec2 ¢er, float innerRad, float outerRad, 245 | const ColorAf &innerColor, const ColorAf &outerColor) { 246 | return nvgRadialGradient(get(), center.x, center.y, innerRad, outerRad, 247 | reinterpret_cast(innerColor), 248 | reinterpret_cast(outerColor)); 249 | } 250 | 251 | NVGpaint Context::imagePattern(float cx, float cy, float w, float h, float angle, 252 | const Image &image, float alpha) { 253 | return nvgImagePattern(get(), cx, cy, w, h, angle, image.id, alpha); 254 | } 255 | 256 | // Scissoring // 257 | 258 | void Context::scissor(float x, float y, float w, float h) { 259 | nvgScissor(get(), x, y, w, h); 260 | } 261 | void Context::resetScissor() { 262 | nvgResetScissor(get()); 263 | } 264 | 265 | // Paths // 266 | 267 | void Context::beginPath() { 268 | nvgBeginPath(get()); 269 | } 270 | void Context::moveTo(float x, float y) { 271 | nvgMoveTo(get(), x, y); 272 | } 273 | void Context::moveTo(const vec2 &p) { 274 | moveTo(p.x, p.y); 275 | } 276 | void Context::lineTo(float x, float y) { 277 | nvgLineTo(get(), x, y); 278 | } 279 | void Context::lineTo(const vec2 &p) { 280 | lineTo(p.x, p.y); 281 | } 282 | void Context::quadTo(float cx, float cy, float x, float y) { 283 | nvgQuadTo(get(), cx, cy, x, y); 284 | } 285 | void Context::quadTo(const vec2 &p1, const vec2 &p2) { 286 | quadTo(p1.x, p1.y, p2.x, p2.y); 287 | } 288 | void Context::bezierTo(float c1x, float c1y, float c2x, float c2y, float x, float y) { 289 | nvgBezierTo(get(), c1x, c1y, c2x, c2y, x, y); 290 | } 291 | void Context::bezierTo(const vec2 &p1, const vec2 &p2, const vec2 &p3) { 292 | bezierTo(p1.x, p1.y, p2.x, p2.y, p3.x, p3.y); 293 | } 294 | void Context::arcTo(float x1, float y1, float x2, float y2, float radius) { 295 | nvgArcTo(get(), x1, y1, x2, y2, radius); 296 | } 297 | void Context::arcTo(const vec2 &p1, const vec2 &p2, float radius) { 298 | arcTo(p1.x, p1.y, p2.x, p2.y, radius); 299 | } 300 | void Context::closePath() { 301 | nvgClosePath(get()); 302 | } 303 | void Context::pathWinding(int dir) { 304 | nvgPathWinding(get(), dir); 305 | } 306 | void Context::arc(float cx, float cy, float r, float a0, float a1, int dir) { 307 | nvgArc(get(), cx, cy, r, a0, a1, dir); 308 | } 309 | void Context::arc(const vec2 ¢er, float r, float a0, float a1, int dir) { 310 | arc(center.x, center.y, r, a0, a1, dir); 311 | } 312 | void Context::rect(float x, float y, float w, float h) { 313 | nvgRect(get(), x, y, w, h); 314 | } 315 | void Context::rect(const Rectf &r) { 316 | rect(r.getX1(), r.getY1(), r.getWidth(), r.getHeight()); 317 | } 318 | void Context::roundedRect(float x, float y, float w, float h, float r) { 319 | nvgRoundedRect(get(), x, y, w, h, r); 320 | } 321 | void Context::roundedRect(const Rectf &rect, float r) { 322 | roundedRect(rect.getX1(), rect.getY1(), rect.getWidth(), rect.getHeight(), r); 323 | } 324 | void Context::ellipse(float cx, float cy, float rx, float ry) { 325 | nvgEllipse(get(), cx, cy, rx, ry); 326 | } 327 | void Context::ellipse(const vec2 ¢er, float rx, float ry) { 328 | ellipse(center.x, center.y, rx, ry); 329 | } 330 | void Context::circle(float cx, float cy, float r) { 331 | nvgCircle(get(), cx, cy, r); 332 | } 333 | void Context::circle(const vec2 ¢er, float radius) { 334 | circle(center.x, center.y, radius); 335 | } 336 | 337 | void Context::fill() { 338 | nvgFill(get()); 339 | } 340 | void Context::stroke() { 341 | nvgStroke(get()); 342 | } 343 | 344 | // Text // 345 | 346 | int Context::createFont(const std::string &name, const fs::path &filepath) { 347 | return createFont(name, filepath.string()); 348 | } 349 | int Context::createFont(const std::string &name, const std::string &filename) { 350 | return nvgCreateFont(get(), name.c_str(), filename.c_str()); 351 | } 352 | int Context::findFont(const std::string &name) { 353 | return nvgFindFont(get(), name.c_str()); 354 | } 355 | 356 | void Context::fontSize(float size) { 357 | nvgFontSize(get(), size); 358 | } 359 | void Context::fontBlur(float blur) { 360 | nvgFontBlur(get(), blur); 361 | } 362 | void Context::fontFaceId(int font) { 363 | nvgFontFaceId(get(), font); 364 | } 365 | void Context::fontFace(const std::string &font) { 366 | nvgFontFace(get(), font.c_str()); 367 | } 368 | 369 | void Context::textLetterSpacing(float spacing) { 370 | nvgTextLetterSpacing(get(), spacing); 371 | } 372 | void Context::textLineHeight(float lineHeight) { 373 | nvgTextLineHeight(get(), lineHeight); 374 | } 375 | void Context::textAlign(int align) { 376 | nvgTextAlign(get(), align); 377 | } 378 | 379 | float Context::text(float x, float y, const std::string &str) { 380 | return nvgText(get(), x, y, str.c_str(), NULL); 381 | } 382 | float Context::text(const vec2 &p, const std::string &str) { 383 | return text(p.x, p.y, str); 384 | } 385 | 386 | void Context::textBox(float x, float y, float breakRowWidth, const std::string &str) { 387 | nvgTextBox(get(), x, y, breakRowWidth, str.c_str(), NULL); 388 | } 389 | void Context::textBox(const vec2 &p, float breakRowWidth, const std::string &str) { 390 | textBox(p.x, p.y, breakRowWidth, str); 391 | } 392 | void Context::textBox(const Rectf &rect, const std::string &str) { 393 | textBox(rect.getX1(), rect.getY1(), rect.getWidth(), str); 394 | } 395 | 396 | Rectf Context::textBounds(float x, float y, const std::string &str) { 397 | Rectf bounds; 398 | nvgTextBounds(get(), x, y, str.c_str(), NULL, &bounds.x1); 399 | return bounds; 400 | } 401 | Rectf Context::textBounds(const vec2 &p, const std::string &str) { 402 | return textBounds(p.x, p.y, str); 403 | } 404 | 405 | Rectf Context::textBoxBounds(float x, float y, float breakRowWidth, const std::string &str) { 406 | Rectf bounds; 407 | nvgTextBoxBounds(get(), x, y, breakRowWidth, str.c_str(), NULL, &bounds.x1); 408 | return bounds; 409 | } 410 | Rectf Context::textBoxBounds(const vec2 &p, float breakRowWidth, const std::string &str) { 411 | return textBoxBounds(p.x, p.y, breakRowWidth, str); 412 | } 413 | Rectf Context::textBoxBounds(const Rectf &rect, const std::string &str) { 414 | return textBoxBounds(rect.getX1(), rect.getY1(), rect.getWidth(), str); 415 | } 416 | 417 | } // nvg 418 | } // cinder 419 | -------------------------------------------------------------------------------- /src/ci_nanovg_gl.cpp: -------------------------------------------------------------------------------- 1 | #include "ci_nanovg_gl.hpp" 2 | 3 | #if defined(CINDER_GL_ES_3) 4 | #define NANOVG_GLES3_IMPLEMENTATION 5 | #elif defined(CINDER_GL_ES_2) 6 | #define NANOVG_GLES2_IMPLEMENTATION 7 | #else 8 | #define NANOVG_GL3_IMPLEMENTATION 9 | #endif 10 | #include "nanovg_gl.h" 11 | 12 | namespace cinder { namespace nvg { 13 | 14 | ContextGL createContextGL(bool antiAlias, bool stencilStrokes) { 15 | int flags = (antiAlias ? NVG_ANTIALIAS : 0) | 16 | (stencilStrokes ? NVG_STENCIL_STROKES : 0); 17 | 18 | #if defined(NANOVG_GLES3) 19 | return { nvgCreateGLES3(flags), nvgDeleteGLES3 }; 20 | #elif defined(NANOVG_GLES2) 21 | return { nvgCreateGLES2(flags), nvgDeleteGLES2 }; 22 | #else 23 | return { nvgCreateGL3(flags), nvgDeleteGL3 }; 24 | #endif 25 | } 26 | 27 | Image ContextGL::createImageFromHandle(GLuint textureId, int w, int h, int imageFlags) { 28 | #if defined(NANOVG_GL3) 29 | int id = nvglCreateImageFromHandleGL3(get(), textureId, w, h, imageFlags); 30 | #elif defined(NANOVG_GLES2) 31 | int id = nvglCreateImageFromHandleGLES2(get(), textureId, w, h, imageFlags); 32 | #elif defined(NANOVG_GLES3) 33 | int id = nvglCreateImageFromHandleGLES3(get(), textureId, w, h, imageFlags); 34 | #endif 35 | 36 | return { get(), id }; 37 | } 38 | 39 | }} // cinder::nvg 40 | --------------------------------------------------------------------------------