From 91339544abffed267bcd33c1d34916ef64d75c4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCgler?= Date: Sat, 9 Mar 2013 04:15:17 +0100 Subject: [PATCH] editor now does fragment and vertex shaders --- .../contents/ui/EditorPage.qml | 39 ++++++++++++++++--- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/src/shell/applets/testshaderapplet/contents/ui/EditorPage.qml b/src/shell/applets/testshaderapplet/contents/ui/EditorPage.qml index 0b16913b8..c0be746e2 100644 --- a/src/shell/applets/testshaderapplet/contents/ui/EditorPage.qml +++ b/src/shell/applets/testshaderapplet/contents/ui/EditorPage.qml @@ -37,10 +37,16 @@ PlasmaComponents.Page { fill: parent margins: _s } - /* + + Image { + id: imageItem + anchors.fill: parent + //source: "../images/elarun-small.png" + } + ShaderEffectSource { id: effectSource - sourceItem: editorPage + sourceItem: imageItem hideSource: hideSourceCheckbox.checked } @@ -67,7 +73,6 @@ PlasmaComponents.Page { } } - */ PlasmaExtras.Heading { id: heading @@ -79,6 +84,20 @@ PlasmaComponents.Page { } text: pageName } + PlasmaComponents.ButtonColumn { + anchors { + right: parent.right + top: heading.top + } + PlasmaComponents.RadioButton { + id: fragmentRadio + text: "Fragment / Pixel Shader" + } + PlasmaComponents.RadioButton { + text: "Vertex Shader" + } + } + PlasmaComponents.TextArea { id: editor anchors { @@ -90,6 +109,11 @@ PlasmaComponents.Page { bottomMargin: _s } + text: { "void main(void) {\ + gl_FragColor = vec4(1.0, 0.0, 0.0, 0.3);\ + }" + } + // width: parent.width // parent.height-height: _h*2 } @@ -99,8 +123,13 @@ PlasmaComponents.Page { text: "Upload Shader" onClicked: { shader = editor.text - print("Uploading new vertex shader: \n" + shader); - mainShader.vertexShader = shader; + if (fragmentRadio.checked) { + print("Uploading new fragment shader: \n" + shader); + mainShader.fragmentShader = shader + } else { + print("Uploading new vertex shader: \n" + shader); + mainShader.vertexShader = shader; + } } anchors {