Comments (12)
I think you have to add:
#ifdef GL_ES
precision mediump float;
#endif
from glslviewer.
iTime has to be renamed:
uniform float u_time;
from glslviewer.
OK, I did the following manually:
- Added float: medium
- replaced all iTime to u_time
- added u_time global
- replaced all iResolution to u_resolution
- added u_resolution global
No errors now, but all I see is 100% whiteness.
http://thebookofshaders.com/edit.php?log=171214193921
from glslviewer.
replace with
void main( )
{
vec3 finalColor;
vec2 uv = gl_FragCoord.xy;
//center of the image
vec2 c = u_resolution.xy/2.0;
finalColor = vec3( 0.3*_cross(uv, c, 240.0) );
finalColor += ( circle(uv, c, 100.0, 1.0)
+ circle(uv, c, 165.0, 1.0) ) * blue1;
finalColor += (circle(uv, c, 240.0, 2.0) );//+ dots(uv,c,240.0)) * blue4;
finalColor += circle3(uv, c, 313.0, 4.0) * blue1;
finalColor += triangles(uv, c, 315.0 + 30.0*sin(u_time)) * blue2;
finalColor += movingLine(uv, c, 240.0) * blue3;
finalColor += circle(uv, c, 10.0, 1.0) * blue3;
finalColor += 0.7 * circle2(uv, c, 262.0, 1.0, 0.5+0.2*cos(u_time)) * blue3;
if( length(uv-c) < 240.0 )
{
//animate some bips with random movements
vec2 p = 130.0*MOV(1.3,1.0,1.0,1.4,3.0+0.1*u_time);
finalColor += bip1(uv, c+p) * vec3(1,1,1);
p = 130.0*MOV(0.9,-1.1,1.7,0.8,-2.0+sin(0.1*u_time)+0.15*u_time);
finalColor += bip1(uv, c+p) * vec3(1,1,1);
p = 50.0*MOV(1.54,1.7,1.37,1.8,sin(0.1*u_time+7.0)+0.2*u_time);
finalColor += bip2(uv,c+p) * red;
}
gl_FragColor = vec4( finalColor, 1.0 );
}
from glslviewer.
Cool, it works, thanks!
So it was in addition:
- fragCoord -> gl_FragCoord
- fragColor -> gl_FragColor
void mainImage( out vec4 fragColor, in vec2 fragCoord )
->void main()
?
from glslviewer.
exactly!
from glslviewer.
Cool, I might submit a PR to glslLoader so it could convert files from disk at least.
Any idea why does editor display only a cropped view, while glslViewer displays more of the extents?
from glslviewer.
Are you in a retina laptop? If that's the case glslViewer will make use of that
from glslviewer.
ShaderToy have a custom scheme they use to wrap shaders and allow things like doing WebVR. Is not fragCoord
, fragColor
and mainImage()
are not part of GLSL language.
from glslviewer.
Yes, I have retina. But isn't the view always 0,0->1,1? How can one view display totally different parts then the other (in the same aspect ratio)?
from glslviewer.
Related #101
from glslviewer.
I believe is not about the aspect ration but about the pixel density. Because the scene is constructed from the center (.5,.5) with the double of the pixels things looks scaled at the half of the size.
Obviously this is not ideal. Needs to be fixed.
thanks for the patience
from glslviewer.
Related Issues (20)
- Trying to write shader with lines from OBJ file HOT 4
- Release 3.2.1 filenames mismatch version number
- es 3.0 not working, extensions not working HOT 2
- Can virtual cameras be opened as streams in Windows?
- Screenshots are twice the resolution specified
- Crash when clearing loaded models
- Spaces cauing issues without syntax errors
- Missing Include and installation docs for Suse
- glslViewer does not compile. HOT 8
- Setting Icon= in desktop file not always working HOT 1
- glslViewer looks for libavdevice.so.58, but I have 59 (Debian 12.1) HOT 4
- 3.2.2 win64 Record video rate not being set correctly HOT 1
- A way to pipe the image output directly to STDOUT instead of saving to a file in headless mode?
- Installer
- [bug] Segmentation fault within the `ncurses` console because of a race condition HOT 1
- [BUG] macro expansion causes syntax error
- Launch with file that doesn't have .frag extension HOT 2
- Audio - NULL Capture Device on Mac HOT 1
- Raspberry PI 5 HOT 3
- Fullscreen window disappear when losing focus
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 glslviewer.