350 Commits

Author SHA1 Message Date
Olli Wang
6b6e3a5246 Fixes the type of view size.
This commit changes the type of the view size accepted by `nvgRenderFrame()` from `int` to `float` so it matches the type defined in `GLNVGcontext`. This would prevent a framebuffer missing a pixel in final rendering result.
2018-04-27 07:27:31 +08:00
Mikko Mononen
e70a78e42e
Merge pull request #442 from gavinhoward/master
Mark devicePixelRatio unused in glnvg_renderViewport
2017-12-19 07:42:19 +02:00
Gavin Howard
5022b370e4
Mark devicePixelRatio unused in glnvg_renderViewport 2017-12-18 16:13:16 -07:00
Mikko Mononen
364911b596
Merge pull request #431 from olliwang/font
Resets font atlas when it is full.
2017-11-06 22:49:32 +02:00
Olli Wang
645861c804 Renders glyph’s bitmap data on demand.
This commit updates font stash to render glyph's bitmap data on demand. This change is intended to fix the issue that `nvgTextBounds()` may return an unreliable result when font atlas is full. This situation usually happens when auto scaling a large font text to fit a small rectangle.

The `fons__getGlyph()` function now accepts a new parameter indicating whether bitmap data is optional, and only `nvgText()` requires it. All of `nvgTextGlyphPositions()`, `nvgTextBreakLines()`, `nvgTextBounds()` and `nvgTextBoxBounds()` functions are changed to work without glyph’s bitmap data.
2017-11-06 21:03:33 +08:00
Mikko Mononen
98e551351d Merge pull request #412 from AndrewBelt/master
Only apply fallback if GL_DEPTH24_STENCIL8 is defined
2017-09-24 12:48:07 +03:00
Andrew Belt
f494937f27 Merge branch 'master' of https://github.com/memononen/nanovg 2017-09-23 10:32:52 -04:00
Andrew Belt
448af072d6 Only apply fallback if GL_DEPTH24_STENCIL8 is defined 2017-09-23 10:32:17 -04:00
Mikko Mononen
52f2d6bf76 Merge pull request #411 from AndrewBelt/master
Support ~2010 Mac graphics cards (and possibly others) with nvgluCreateFramebuffer patch
2017-09-22 21:30:32 +03:00
Andrew Belt
bfd5d11f27 Merge branch 'master' of https://github.com/memononen/nanovg 2017-09-22 14:24:25 -04:00
Andrew Belt
ee6b7346cc Add GL_DEPTH24_STENCIL8 as a fallback when creating render buffer object
for nvgluCreateFramebuffer
2017-09-22 14:22:48 -04:00
Mikko Mononen
e3033362e5 Merge pull request #405 from Joshua-Ashton/master
Fix MSVC 2017 compiler warning
2017-09-05 17:10:43 +03:00
Joshua Ashton
ac6a656898 Fix MSVC 2017 compiler warning 2017-09-05 14:42:27 +01:00
Mikko Mononen
67e2ecf736 Merge pull request #404 from DagAgren/patch-1
Fix clang compiler warnings
2017-09-03 07:43:47 +03:00
Dag Ågren
b124bbbaf5 Fix implicit conversion warning. 2017-09-03 01:32:00 +03:00
Dag Ågren
3b54182b02 Remove unused variable. 2017-09-03 01:22:50 +03:00
Mikko Mononen
a2784bad3a Merge pull request #395 from olliwang/metal
Adds link of the Metal port.
2017-08-01 06:50:00 +03:00
Olli Wang
43aeba25a4 Adds link of the Metal port.
I just implmeneted the native Metal port of NanoVG. ;)
2017-07-31 23:46:24 +08:00
Mikko Mononen
4f1c6d302a Fix for #391
Fixed return value of nvgText to be the position after the rendered
string, also fixed scaling of the value.
2017-07-26 21:11:45 +03:00
Mikko Mononen
30e1c98175 Merge pull request #386 from olliwang/flags
Allows to turn on/off antialias for shapes.
2017-07-12 07:44:28 +03:00
Olli Wang
17321202da Allows to turn on/off antialias for shapes.
This commit adds a new `nvgShapeAntiAlias()` function for turning on/off antialias for specific shapes.
2017-07-12 12:40:02 +08:00
Mikko Mononen
70fb4b0344 Merge pull request #387 from olliwang/quad
Prevents uploading unused vertices to GPU.
2017-07-12 07:35:53 +03:00
Olli Wang
f87cdf1041 Prevents uploading unused vertices to GPU.
This commit fixes the bug that `glnvg__renderFill()` allocates unused quad vertices for `GLNVG_CONVEXFILL`, which causes unused vertices uploaded to the GPU.

Besides, the quad for the `GLNVG_FILL` type is changed to drawn by `GL_TRIANGLE_STRIP` instead of `GL_TRIANGLES` so two more vertices can be reduced per quad.

In one of my test case, I need to paste an image to a framebuffer about 5,000 times, and this change would reduce the total number of uploaded vertices from `52,106` to `22,476`. It is good for FPS and battery consumption.
2017-07-12 03:54:55 +08:00
Mikko Mononen
7e42ac6099 Merge pull request #385 from olliwang/discard
Discards fragments as early as possible.
2017-07-01 22:32:18 +03:00
Olli Wang
7e11b11177 Discards fragments as early as possible.
This commit moves the `discard` instruction in the fragment shader to an earlier position to avoid performing calculations whose results are unused.
2017-07-02 01:16:40 +08:00
Mikko Mononen
72bac5d98b Update README.md
Highlighted the need for render target stencil buffer.
2017-06-29 13:18:20 +03:00
Mikko Mononen
c75fc0bfcf Merge pull request #359 from olliwang/glext
Fixes how glext header is included.
2017-03-06 21:51:55 +02:00
Olli Wang
4ac2b44ea7 Fixes how glext header is included.
This commit fixes the issue caused by #357 that nanovg failed to compile on iOS due to the wrong way of including glext header.
2017-03-06 22:08:08 +08:00
Mikko Mononen
51284049e2 Merge pull request #357 from ckaran/master
Bug fixes to compile under OS X 12.3
2017-02-23 19:47:47 +02:00
Cem Karan
2098a54242 Added a missing include file to nanovg_gl.h.
To make the examples link correctly under OS X 12.3, you need to include
<OpenGL/glext.h> in the file.  This commit limits what happens by protecting
the include as follows:

    #ifdef __APPLE__
    #   include <OpenGL/glext.h>
    #endif

Thus, this should have no effect on non-Apple systems.
2017-02-23 09:56:21 -05:00
Cem Karan
112567c975 Added "-framework Carbon" as a link option to premake4.lua.
To get nanovg to link correctly under OS X 12.3, it needs to be linked against
the Carbon libraries.  This was missing in the premake4.lua files.  Now fixed.
2017-02-23 09:52:02 -05:00
Mikko Mononen
47ffd9d0b9 Merge pull request #312 from satoren/master
Improve nvgGlobalCompositeOperation with state
2017-02-23 11:42:38 +02:00
Mikko Mononen
8feae63a46 Merge pull request #343 from damiles/master
Add image flag to support GL_NEAREST rendering
2017-01-12 13:46:41 +02:00
David Millan (Damiles)
ee031a432c Use NVG_IMAGE_NEAREST to no interpolate in image 2016-12-07 12:34:29 +01:00
David Millan (Damiles)
61fb55ac19 Merge branch 'master' of https://github.com/damiles/nanovg 2016-12-07 11:15:39 +01:00
David Millan (Damiles)
dd1eff4f9e Solve bug inverted but not good solution 2016-12-07 11:01:57 +01:00
David Millan (Damiles)
e955b3829d Nearest Support for images, but there are strange bug to solve. It's Inverted 2016-12-07 10:57:45 +01:00
Mikko Mononen
cacb00b852 Merge pull request #340 from andrewcorrigan/master
suppresses all warnings reported by latest Xcode/AppleClang
2016-11-06 08:00:39 +02:00
Andrew Corrigan
1ae01af452 suppresses all warnings reported by Apple LLVM version 8.0.0 (clang-800.0.42.1) 2016-11-05 12:19:31 -04:00
Mikko Mononen
e12379653e Merge pull request #338 from olliwang/CJK
Better support for CJK characters.
2016-11-01 20:04:34 +02:00
Olli Wang
7cd8decef4 Better support for CJK characters.
Previously, the Unicode range of the CJK chractaters only includes Chinese charactaters, Japanese Kanji, and CJK Symbols and Punctuation. The range are used by traditioanl Korean as well. This commit further includes Hiragana and Katakana in Japanese, and Hangul Syllables and Hangul Jamo in Korean to make CJK support more complete.
2016-11-02 00:05:41 +08:00
Mikko Mononen
d9e8daf46f Merge pull request #333 from olliwang/font
Fixes the bug that text may not render correctly.
2016-10-25 16:08:15 +03:00
Olli Wang
c6cddc85c1 Fixes the bug that text may not render correctly.
This commit fixes the bug that text may not render correctly when glyph is not found in fallback fonts.
2016-10-25 12:08:53 +08:00
Mikko Mononen
a367dcf163 Merge pull request #331 from olliwang/CJK
Improves to display CJK characters with English words.
2016-10-20 20:37:23 +03:00
Olli Wang
ade7193423 Improves to display CJK characters with English words.
This commit improves to display CJK characters mixed with English words so there is less spaces at line breaks.
2016-10-20 17:05:54 +08:00
Mikko Mononen
84e848d1e9 Merge pull request #330 from olliwang/CJK
Fixes line breaks for CJK characters.
2016-10-19 15:23:20 +03:00
Mikko Mononen
2ed5c0e010 Merge pull request #329 from lieff/master
handle file IO error
2016-10-19 15:21:52 +03:00
Olli Wang
c64c95c727 Fixes line breaks for CJK characters.
This commit fixes weird line breaks when rendering CJK (Chinese, Japanese, Korean) characters. Each CJK character is more like a word instead of a letter. This commit fixes the logic of line breaks by introducing a new `NVG_CJK_CHAR` code point type and takes special care for formatting text including CJK characters.
2016-10-19 19:32:51 +08:00
lieff
ecb5899bcf handle file IO error 2016-10-19 14:04:44 +03:00
Mikko Mononen
3110d5fba1 Merge pull request #316 from xeekworx/master
nvgRoundedRectEx for varying corner radii
2016-09-18 19:29:05 +03:00