www.jpct.net
jPCT-AE - a 3d engine for Android => Support => Topic started by: Thomas. on October 29, 2012, 12:13:14 pm
-
Please, is there anyone who knows a library that works with this?
#if USE_FOG
...shader code...
#endif
-
By GLSL ES specification it is supported. Could you implement it into jPCT-AE, please?
http://www.khronos.org/registry/gles/specs/2.0/GLSL_ES_Specification_1.0.17.pdf
-
I'm not sure what you mean!? I don't care about what the compiler does or does not, i'm just feeding the source code directly into the driver. What am i supposed to implement?
-
Preprocessor on page 11 :) It should be integrated in GPU, if I understood it correctly... I have to somehow send variables together with shader...
-
... I have to somehow send variables together with shader...
I don't think so. You can define something in the source code and then ask somewhere else if it has been defined and stuff like that. Like in C/C++...correct me, if i'm wrong.
-
Yes, you are right, I got it wrong...
-
And please, have you idea, how it should be used? Now, I have in VS code for fog, even if is not needed in FS (FS is dynamically generated). I want leave out calculation of fog, if is not needed. So I did this....
...
#ifdef USE_FOG
varying vec3 fogVertexColor;
varying float fogWeight;
#endif
...
#ifdef USE_FOG
fogWeight = clamp((-v_Position.z - fogStart) / (fogEnd - fogStart), 0.0, 1.0);
fogVertexColor = fogColor * fogWeight;
#endif
And if I need fog, I add "#define USE_FOG" on the first line of VS and FS, but it not works when I turn on fog.
11-06 15:40:34.768: I/jPCT-AE(11566): [ 1352212834770 ] - ERROR: Could not link shader program: L0008 Varying 'fogWeight' not found in vertex shader
-
No idea...looks fine to me, but then again, i don't trust my own understanding of these preprocessor commands nor the shader compilers on mobile devices. I would try to use two #define like USE_FOG and USE_FOG2 and then use the first on in the first #ifdef and the second one in the second. Just to see what happens then...
-
I have it. I was sending old VS without #define ... line to the GPU ::)