hello
is it right, that krafix can not compile this code:
void kore() {
// vec2 p = gl_FragCoord.xy / iResolution;
vec3 col;
// float col[3]; // alternative also not work
float c = iGlobalTime;
for(int i = 0; i < 3; i++) {
c += 0.3;
col[i] = fract(c);
}
// gl_FragColor = vec4(col[0], col[1], col[2], 1.0);
gl_FragColor = vec4(col, 1.0);
}
I have tried this on windows 8.1 and linux and always get a black screen.
-
arrays in shaders do not compile
| last edited by webster Reputation: 0 | Posts: 20 -
arrays in shaders do not compile
gl_FragCoord is not supported because that's a very OpenGL thing that would have to be emulated on other APIs. But I thought local stack arrays like that would work, will have a look at what's going wrong. You can always have a look at the generated source code, there are comments about unimplemented instructions when such are used.
-
arrays in shaders do not compile
Hallo Robert,
that is a little bit strange to me, because in some cases the shader compiled this stuff. I want learn some of the cool stuff which can be done with fragment shaders. In the 'book of shaders' i found this example:
https://www.shadertoy.com/view/XsXXDn
I am surprised how the few lines create such a nice effect.
Without the loop but with gl_FragColor and glFragCoord does this work. I use the html5 tag from khamake. But what is the best approach to avoid these errors, should i use only the in- and out-qualifier from the shader language.
The frag.essl file in the debug-html5-resources folder show me this:
#version 100
// Unknown execution mode 8
...
and no more comments about wrong instructions. But this comment is in every essl file by me regardless of whether the shader compiled or not.
Another question, has kha a function for cropping a texture? -
arrays in shaders do not compile
@webster
remark to me;-)
have a look at the painter* files in the debug-html5-resources folder, which should contain all the patterns that I need. -
arrays in shaders do not compile
@webster said:
@webster
remark to me;-)
have a look at the painter* files in the debug-html5-resources folder, which should contain all the patterns that I need.now i think, i shoot a little bit to fast and to deep in the framework. The 'texture2D' is not defined in the painter-image.frag.essl file. Nevertheless, the files could be useful for me and my learning.
| last edited by webster Reputation: 0 | Posts: 20