diff options
Diffstat (limited to 'examples/quick/scenegraph/openglunderqml')
-rw-r--r-- | examples/quick/scenegraph/openglunderqml/squircle.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/examples/quick/scenegraph/openglunderqml/squircle.cpp b/examples/quick/scenegraph/openglunderqml/squircle.cpp index 6b25756e61..b7082892b8 100644 --- a/examples/quick/scenegraph/openglunderqml/squircle.cpp +++ b/examples/quick/scenegraph/openglunderqml/squircle.cpp @@ -125,22 +125,22 @@ void SquircleRenderer::paint() initializeOpenGLFunctions(); m_program = new QOpenGLShaderProgram(); - m_program->addShaderFromSourceCode(QOpenGLShader::Vertex, - "attribute highp vec4 vertices;" - "varying highp vec2 coords;" - "void main() {" - " gl_Position = vertices;" - " coords = vertices.xy;" - "}"); - m_program->addShaderFromSourceCode(QOpenGLShader::Fragment, - "uniform lowp float t;" - "varying highp vec2 coords;" - "void main() {" - " lowp float i = 1. - (pow(abs(coords.x), 4.) + pow(abs(coords.y), 4.));" - " i = smoothstep(t - 0.8, t + 0.8, i);" - " i = floor(i * 20.) / 20.;" - " gl_FragColor = vec4(coords * .5 + .5, i, i);" - "}"); + m_program->addCacheableShaderFromSourceCode(QOpenGLShader::Vertex, + "attribute highp vec4 vertices;" + "varying highp vec2 coords;" + "void main() {" + " gl_Position = vertices;" + " coords = vertices.xy;" + "}"); + m_program->addCacheableShaderFromSourceCode(QOpenGLShader::Fragment, + "uniform lowp float t;" + "varying highp vec2 coords;" + "void main() {" + " lowp float i = 1. - (pow(abs(coords.x), 4.) + pow(abs(coords.y), 4.));" + " i = smoothstep(t - 0.8, t + 0.8, i);" + " i = floor(i * 20.) / 20.;" + " gl_FragColor = vec4(coords * .5 + .5, i, i);" + "}"); m_program->bindAttributeLocation("vertices", 0); m_program->link(); |