Hi all, I’m trying to pass a small Vector3f ArrayList to a shader using an Uniform defined as arrPolygonShapeVertices. I understand there is a 1024 items hard limit on old graphics cards and I’m not even close to a fraction of it so it’s not the issue.
Using this code:
[java]
if(arrPolygonShapeVertices != null){
System.out.println("AAA: " + arrPolygonShapeVertices);
material.setParam(“arrPolygonShapeVertices”, VarType.Vector3Array, arrPolygonShapeVertices);
System.out.println("BBB: " + arrPolygonShapeVertices.size());
material.setInt(“polygonShapeVerticesLength”, arrPolygonShapeVertices.size());
}
[/java]
… I’m getting this in the console:
[java]
AAA: [(-127.0, 158.08269, -127.0), (93.0, 163.52136, -127.0), (-39.0, 167.57544, -119.0), (59.0, 164.05804, -111.0), (-37.0, 148.2067, -87.0), (-91.0, 133.28836, -71.0)]
BBB: 6
mars 06, 2014 12:02:41 PM com.jme3.app.Application handleError
SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.NullPointerException
at com.jme3.shader.Uniform.setValue(Uniform.java:185)
at com.jme3.material.Technique.updateUniformParam(Technique.java:151)
at com.jme3.material.MatParam.apply(MatParam.java:147)
at com.jme3.material.Material.render(Material.java:1103)
at com.jme3.renderer.RenderManager.renderGeometry(RenderManager.java:523)
at com.jme3.post.FilterPostProcessor.renderProcessing(FilterPostProcessor.java:204)
at com.jme3.post.FilterPostProcessor.renderFilterChain(FilterPostProcessor.java:282)
at com.jme3.post.FilterPostProcessor.postFrame(FilterPostProcessor.java:296)
at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:987)
at com.jme3.renderer.RenderManager.render(RenderManager.java:1029)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:252)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:151)
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:185)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:228)
at java.lang.Thread.run(Thread.java:722)
[/java]
The material file defines the uniform fine. The error message clearly states whenever you forget to define a uniform in the material file so this ain’t it either.
What makes it NULL by the time com.jme3.shader.Uniform.setValue(Uniform.java:185) processes it? Not getting it
As you can see in the error log, I’m running this off a thread that runs perfectly if I comment this part. I’m not sure if it’s related or not, I would assume that it’s not related tough.
Any ideas? Thx