Comments (12)
Hi, I have not test the shader on many computers yet, so some compatibility issues can be there.
Based on the images, looks like the sdroundrect() does not behave correctly on your set. Can you try to add:
"precision highp float;\n",
after the #version line in both of the shaders?
--mikko
from nanovg.
Doesn't help. It looks the same as the original image.
from nanovg.
FWIW, I think that when I ran on the Mac, it was also an NVIDIA GPU (650M)
from nanovg.
My Mac has Intel HD4000, and I always thought they were the lowest common nominator :) What if you truncate the shader main() just to:
"void main(void) {\n"
" // Stroke - from [0..1] to clipped pyramid, where the slope is 1px.\n"
" float strokeAlpha = min(1.0, (1.0-abs(alpha.x_2.0-1.0))_strokeMult) * alpha.y;\n"
1.0);\n"
" vec4 color = innerCol;\n"
" // Combine alpha\n"
" color.w *= strokeAlpha;\n"
" gl_FragColor = color;\n"
"}\n";
If that works, you won't get clipping nor gradients, but it should confirm that the sdroundrect() is the culprit.
from nanovg.
I ran that (after deleting the stray line 1.0);\n"), but it's still the same thing as the original image.
from nanovg.
Here's another piece of information, if I comment out both calls to glBlendFunc in example.c, everything appears (but obviously rendered incorrectly):
from nanovg.
Blending should not affect the shader. Does this shadertoy work for you?
https://www.shadertoy.com/view/MsS3zz
from nanovg.
from nanovg.
ok, so oddly enough the same code works in one place but in another :(
Let's see if the inputs are ok. How does this shader look like:
"void main(void) {\n"
" gl_FragColor = vec4(alpha.x,alpha.x,alpha.x,1.0);\n"
"}\n";
from nanovg.
I tried that out, and was curious, so I also tried out alpha.y, and then strokeMult. strokeMult was zero, even though the corresponding call to glUniform1f was passing in a value of something like 1.0. What I found is that none of the uniform variables are getting bound since every single call to glGetUniformLocation fails (returns -1, which is not reported by glGetError, so I added additional error checks). I should be to fix the issue of uniform variables not getting bound, will get back to you soon.
from nanovg.
glGetUniformLocation wasn't the problem -- glUniform1f was simply not working. Apparently this issue is common when glUniform1f isn't dynamically loaded at run-time [1]. A workaround is to use GLEW, which loads the function at run-time. I've added that to my clone of your repository, and will issue a pull request in case you want to merge this workaround.
Thanks for all your help. I'm looking forward to really getting started using nanovg.
[1] http://encelo.netsons.org/2008/03/17/gluniform1f-is-working/
from nanovg.
Thank you for taking the time to look into this! That would have been quite tricky to debug remotely :)
from nanovg.
Related Issues (20)
- Layer based drawing HOT 3
- outlines donβt draw properly HOT 2
- Edges of the curve are drawn at an angle HOT 9
- Draw an Arc with a Hole HOT 2
- Multiple scissors HOT 3
- Draw fill problems for complex polygons HOT 2
- Fix for MinGW: Replace -lGLEW with -lglew32
- support android ARGB format HOT 1
- Memory leak with freetype fonts [fix] HOT 4
- nvgArc does some ugly overdraw HOT 2
- [nvgTextBounds] string ending with space does not return expected bounds HOT 2
- `nvgArc` and `nvgArcTo` parameters correspondence and conversion
- building into a shared library HOT 6
- Transformation from Screen Space to World Space? HOT 1
- Arab, Hebrew and Persian
- ANSI Color Escape Sequences HOT 2
- Richtext HOT 2
- Proposal: Support for different NVGcontext types
- Frequent JVM crashes HOT 2
- nvgCreateGL failed
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nanovg.