Welcome on MasterOf13FPS! MasterOf13FPS

Register today or sign up if you are already a member and never miss any cool content again :)

Closed GuiShader

Status
Not open for further replies.

MasterOf13FPS

Administrator
Staff member
Administrator
MasterOf13FPS
Joined
Jul 11, 2020
Messages
0
Reaction score
25
Points
0
Hallo, ich wollte mit der ShaderUtil von DiZe mal ein wenig rumprobieren,
Wenn ich diesen Code
private static final String FRAGMENTSHADER = "#ifdef GL_ES\r\n" + "\r\n" + "precision mediump float;\r\n" + "\r\n" + "#endif\r\n" + "\r\n" + "uniform float time;\r\n" + "\r\n" + "uniform vec2 resolution;\r\n" + "\r\n" + "#define PI 3.14159265359\r\n" + "\r\n" + "#define T (time / 0.4)\r\n" + "\r\n" + "vec3 hsv2rgb(vec3 c) {\r\n" + "\r\n" + "vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 4.0);\r\n" + "\r\n" + "vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\r\n" + "\r\n" + "return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\r\n" + "\r\n" + "}\r\n" + "\r\n" + "void main(void) {\r\n" + "\r\n" + "vec2 position = (( gl_FragCoord.xy / resolution.xy ) - 0.5);\r\n" + "\r\n" + "position.x *= resolution.x / resolution.y;\r\n" + "\r\n" + "vec3 color = vec3(0.);\r\n" + "\r\n" + "for (float i = 0.; i < PI*2.0; i += PI/20.0) {\r\n" + "\r\n" + "vec2 p = position - vec2(cos(i), sin(i)) * 0.15;\r\n" + "\r\n" + "vec3 col = hsv2rgb(vec3((i + T)/(PI*2.0), 1., 1));\r\n" + "\r\n" + "color += col * (1./512.) / length(p);\r\n" + "\r\n" + "}\r\n" + "\r\n" + "gl_FragColor = vec4( color, 1.0 );\r\n" + "\r\n" + "}";
private static final String VERTEXSHADER = "attribute vec3 position;\r\n" + "\r\n" + "void main() {\r\n" + "\r\n" + "gl_Position = vec4( position, 1.0 );\r\n" + "\r\n" + "}";
Aber Benutze is das ganze nicht zentriert bzw, animiert woran liegt das?
 
Uniforms mein Junge, Uniforms ! Außerdem solltest du dich mal mit FileReadern beschäftigen.
 
Status
Not open for further replies.
shape1
shape2
shape3
shape4
shape5
shape6
Back
Top