Skip to content
ShaderToy demo by QML.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Component running on mac May 14, 2018
ShotScreen
example
.gitignore
MainView.qml
README.md
ShaderToy.qml.qmlproject
main.qml

README.md

ShaderToy 学习

ShaderToy demo by QML.

一些说明

一些 QMLGLSL 的封装,需要考虑 GLSL ES 接口。

// if not mac
#ifndef GL_ES

#extension GL_EXT_shader_texture_lod : enable
#extension GL_OES_standard_derivatives : enable

precision highp float;
precision highp int;
precision mediump sampler2D;

#endif

#ifdef GL_ES
precision mediump float;
#endif
// end if not mac

uniform lowp float qt_Opacity;
varying highp vec2 qt_TexCoord0;

uniform vec3 iResolution ;

uniform float iGlobalTime;

uniform float     iChannelTime[4];
uniform vec3      iChannelResolution[4];

uniform vec4      iMouse;
uniform sampler2D iChannel0;
uniform sampler2D iChannel1;
uniform sampler2D iChannel2;
uniform sampler2D iChannel3;
uniform vec4      iDate;

uniform float     iSampleRate;

ShaderToy 中一定会使用的 void mainImage( out vec4 fragColor, in vec2 fragCoord )

void main(void)
{
    mainImage(gl_FragColor, gl_FragCoord.xy);
}

注意,GLSL 支持函数重载,但是 GLSL 不支持隐式转换,所以参数传递时必须类型匹配。


参考

【ShaderToy】开篇

shadertoy-iOS-v2

You can’t perform that action at this time.