Author Topic: Confirming 32bit color output via jPCT  (Read 16072 times)

Offline K24A3

  • long
  • ***
  • Posts: 231
    • View Profile
Re: Confirming 32bit color output via jPCT
« Reply #30 on: October 12, 2012, 11:41:07 am »
Here's the log:

10-12 09:39:39.422: E/AndroidRuntime(1567): java.lang.RuntimeException: [ 1350034779427 ] - ERROR: Failed to load and compile fragment shaders!
10-12 09:39:39.422: E/AndroidRuntime(1567):    at com.threed.jpct.Logger.log(Logger.java:189)
10-12 09:39:39.422: E/AndroidRuntime(1567):    at com.threed.jpct.GLSLShader.loadProgram(GLSLShader.java:764)
10-12 09:39:39.422: E/AndroidRuntime(1567):    at com.threed.jpct.GLSLShader.preInit(GLSLShader.java:276)
10-12 09:39:39.422: E/AndroidRuntime(1567):    at com.threed.jpct.GL20.setShader(GL20.java:336)
10-12 09:39:39.422: E/AndroidRuntime(1567):    at com.threed.jpct.GLRenderer.setShader(GLRenderer.java:510)
10-12 09:39:39.422: E/AndroidRuntime(1567):    at com.threed.jpct.CompiledInstance.render(CompiledInstance.java:159)
10-12 09:39:39.422: E/AndroidRuntime(1567):    at com.threed.jpct.GLRenderer.drawVertexArray(GLRenderer.java:2244)
10-12 09:39:39.422: E/AndroidRuntime(1567):    at com.threed.jpct.World.draw(World.java:1321)
10-12 09:39:39.422: E/AndroidRuntime(1567):    at com.threed.jpct.World.draw(World.java:1083)
10-12 09:39:39.422: E/AndroidRuntime(1567):    at com.threed.jpct.ES2Test.Scene.updateFrame(Scene.java:293)
10-12 09:39:39.422: E/AndroidRuntime(1567):    at com.threed.jpct.ES2Test.Scene.onDrawFrame(Scene.java:365)
10-12 09:39:39.422: E/AndroidRuntime(1567):    at com.threed.jpct.ES2Test.HelloShader$MyRenderer.onDrawFrame(HelloShader.java:206)
10-12 09:39:39.422: E/AndroidRuntime(1567):    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1516)
10-12 09:39:39.422: E/AndroidRuntime(1567):    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)


Attached are the available functions in the Light class
..by typing sun.

[attachment deleted by admin]

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Confirming 32bit color output via jPCT
« Reply #31 on: October 12, 2012, 02:41:37 pm »
It's definitely there...i just checked it with the latest beta version. Check your project setup. Maybe you are referencing some old version of the library.

About the shader error: Before that part, there should be some output from the driver that tells the actual problem.

Offline K24A3

  • long
  • ***
  • Posts: 231
    • View Profile
Re: Confirming 32bit color output via jPCT
« Reply #32 on: October 12, 2012, 03:39:26 pm »
You were right, the build path was pointing to the jPCT lib in the original HelloShader, which was earlier than v1.25 (you may want to update the lib in the HelloShader folder of the zip on the website), but running the app tells me it's using v1.26 in logcat during runtime - eclipse bug I suppose.

I added sun.setDistanceOverride(10000f) but the output is totally black, which is why I tried increasing the ambientColor in the shader. Below is the additional log info, which I assume it's because ambientColor is a uniform type, not a varying type?

Edit: It's totally black on the Tegra3 as well.


01-02 12:07:46.060: I/jPCT-AE(1088): Compiling shader program!
01-02 12:07:46.070: I/jPCT-AE(1088): Could not compile shader 35632: <invalid atom 65535>(30) : error C7563: assignment to uniform ambientColor
01-02 12:07:46.070: I/jPCT-AE(1088): <invalid atom 65535>(31) : error C7563: assignment to uniform ambientColor
01-02 12:07:46.070: I/jPCT-AE(1088): <invalid atom 65535>(32) : error C7563: assignment to uniform ambientColor
01-02 12:07:46.070: I/jPCT-AE(1088): [ 946814866081 ] - ERROR: Failed to load and compile fragment shaders!
« Last Edit: October 12, 2012, 03:47:14 pm by K24A3 »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Confirming 32bit color output via jPCT
« Reply #33 on: October 12, 2012, 06:19:54 pm »
You have to use a close distance for the override like 0.001 or similar. It's about making the first light source the closest one, not the farest.

About the uniform: Just copy it into a local variable and use that one instead.

Offline K24A3

  • long
  • ***
  • Posts: 231
    • View Profile
Re: Confirming 32bit color output via jPCT
« Reply #34 on: October 15, 2012, 09:16:37 am »
I tried 0.001 with a light nearby and both devices are showing black textures.

Not to worry, I'll use the original shader since I need multiple light support and since it only fails on Mali.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Confirming 32bit color output via jPCT
« Reply #35 on: December 12, 2012, 10:27:29 pm »
So...finally...i had to buy K24A3's Galaxy Note to track this down... ;) The solution is, that Mali isn't very good (read: fails spectacular) on calculating the square root for higher values. Higher values mean anything larger than 655xx in this case. If you take the square root of a higher value, you'll get rubish. To fix this, you can change this line in the fragment shader:

Code: [Select]
float distSqr = dot(lightVec[0], lightVec[0]);

to this

Code: [Select]
float distSqr = min(65500.0, dot(lightVec[0], lightVec[0]));

...and it should work again. Of course, this isn't a real solution as it simply clamps the values. A better solution would be to get rid of the square root in the following line, but i can't be bothered with that right now... :)

Offline K24A3

  • long
  • ***
  • Posts: 231
    • View Profile
Re: Confirming 32bit color output via jPCT
« Reply #36 on: December 13, 2012, 01:44:53 pm »
Thanks Egon the shader looks normal now.

However the lighting direction on the objects seems to be in reverse or incorrect.  Can you replicate this on the Note?

Blue dot is the light source.

[attachment deleted by admin]
« Last Edit: December 13, 2012, 01:47:17 pm by K24A3 »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Confirming 32bit color output via jPCT
« Reply #37 on: December 13, 2012, 01:49:30 pm »
Only on Mali or on all devices? Can you send me a current version of the test case? I've modified mine in the process to an extend that i can't use it anymore to test this particular thing... ::)

Offline K24A3

  • long
  • ***
  • Posts: 231
    • View Profile
Re: Confirming 32bit color output via jPCT
« Reply #38 on: December 13, 2012, 02:01:10 pm »
I'll send the test case via email now.

Seems I misplaced the charging cable for the Tegra3, I'll need a moment to find it.

Offline K24A3

  • long
  • ***
  • Posts: 231
    • View Profile
Re: Confirming 32bit color output via jPCT
« Reply #39 on: December 13, 2012, 02:28:18 pm »
The Tegra3 is terribly flat needing a good hour to get up and running. But I'm seeing the same effect in the Emulator.

Perhaps you can try it on your tablet?

Offline K24A3

  • long
  • ***
  • Posts: 231
    • View Profile
Re: Confirming 32bit color output via jPCT
« Reply #40 on: December 13, 2012, 02:39:14 pm »
Emulator with four spheres 300 units respectively away from the light at 0,0,0

Tegra3 is still afraid of booting google's robot

[attachment deleted by admin]

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Confirming 32bit color output via jPCT
« Reply #41 on: December 13, 2012, 09:30:33 pm »
It's your globe model. It seems to have clockwise order in it's polygon definitions, i.e. jPCT culls the front faces and what you see are the lit back faces. Just add

Code: [Select]
oClonedSphere.invert();
and it will look fine again.

Offline K24A3

  • long
  • ***
  • Posts: 231
    • View Profile
Re: Confirming 32bit color output via jPCT
« Reply #42 on: December 14, 2012, 01:55:52 am »
Hmm where did that sphere come from.. not to worry it works fine using invert.

Thanks for all your help I can finally continue with this project :)