Update breaks app

Hi monkeys,



after having updated to the recently nightly build, I am getting the following error:



14-06-2012 15:30:20 com.jme3.app.Application handleError

SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]

java.lang.IllegalArgumentException: Expected a Int value!

at com.jme3.shader.Uniform.setValue(Uniform.java:266)

at com.jme3.material.Technique.updateUniformParam(Technique.java:147)

at com.jme3.material.MatParam.apply(MatParam.java:147)

at com.jme3.material.Material.render(Material.java:1037)

at com.jme3.renderer.RenderManager.renderGeometry(RenderManager.java:657)

at com.jme3.renderer.queue.RenderQueue.renderGeometryList(RenderQueue.java:301)

at com.jme3.renderer.queue.RenderQueue.renderQueue(RenderQueue.java:353)

at com.jme3.renderer.RenderManager.renderViewPortQueues(RenderManager.java:893)

at com.jme3.renderer.RenderManager.flushQueue(RenderManager.java:849)

at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:1125)

at com.jme3.renderer.RenderManager.render(RenderManager.java:1167)

at com.jme3.app.SimpleApplication.update(SimpleApplication.java:251)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:149)

at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:182)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:223)

at java.lang.Thread.run(Thread.java:662)



Everything worked fine until I updated, so is there anyway to revert the update ?

@nightmare2real said:
Hi monkeys,

after having updated to the recently nightly build, I am getting the following error:

14-06-2012 15:30:20 com.jme3.app.Application handleError
SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.IllegalArgumentException: Expected a Int value!
at com.jme3.shader.Uniform.setValue(Uniform.java:266)


Are you certain you're passing an int and not a float or something else in the parameter?

I update daily and I can't say I'm having problems with the recent updates.

Yes I’m certain, my code worked fine before I updated, but then it wouldn’t even get to the setup screen after I updated, so it shouldn’t be my code. But just to make certain, I also made a new Test Folder and tried to run the test from the SDK, and with every test, did I receive the same error code.

Need more info on what material you are using, what you are passing etc.

How about posting the test case?

Ahh, I found the mistake… It wasn’t in the update afterall (sorry for the post)… But in one of my own models, that for somereason had been changed, so the .j3o file was corrupt.

@nightmare2real: Can you post the material file with the issue?

No I don’t think I can, since it was a model importet from blender, and suddently the .j3o file stopped working saying, that it expected a Vector4f (or a similar message) … I don’t think it has so much to do with the jMonkey Engine SDK, I think it has more todo with updating the GitHub reposotory, and that corrupted the file (I might be wrong)

Are you using yesterday’s nightly release? There were some changes to the material system that may have caused this issue.

Well I’m using the newest nightly release (don’t know if it’s yeasterdays or todays). I havn’t been updating the SDK for a couple of days, and when I finally did, I got the error.

Well, I tried to re-create my repository, but this is the error message I get, when I try to load the model:



java.lang.IllegalArgumentException: Expected a Vector4 value!

at com.jme3.shader.Uniform.setValue(Uniform.java:266)

at com.jme3.material.Technique.updateUniformParam(Technique.java:147)

at com.jme3.material.MatParam.apply(MatParam.java:147)

at com.jme3.material.Material.render(Material.java:1037)

at com.jme3.renderer.RenderManager.renderGeometry(RenderManager.java:657)

at com.jme3.renderer.queue.RenderQueue.renderGeometryList(RenderQueue.java:301)

at com.jme3.renderer.queue.RenderQueue.renderQueue(RenderQueue.java:353)

at com.jme3.renderer.RenderManager.renderViewPortQueues(RenderManager.java:893)

at com.jme3.renderer.RenderManager.flushQueue(RenderManager.java:849)

at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:1125)

at com.jme3.renderer.RenderManager.render(RenderManager.java:1167)

[catch] at com.jme3.gde.core.scene.SceneApplication.update(SceneApplication.java:284)

at com.jme3.system.awt.AwtPanelsContext.updateInThread(AwtPanelsContext.java:157)

at com.jme3.system.awt.AwtPanelsContext.access$100(AwtPanelsContext.java:13)

at com.jme3.system.awt.AwtPanelsContext$AwtPanelsListener.update(AwtPanelsContext.java:37)

at com.jme3.system.lwjgl.LwjglOffscreenBuffer.runLoop(LwjglOffscreenBuffer.java:123)

at com.jme3.system.lwjgl.LwjglOffscreenBuffer.run(LwjglOffscreenBuffer.java:147)

at java.lang.Thread.run(Thread.java:662)

Why are you not using the stable version?

guess he want’s to be on the bleeding edge :slight_smile:

I get a similar error with the newest code (reverting back to 2 days before does not show the error). The stack goes over MatParamTexture instead over MatParam.

I traced it down to a model trying to use Common/MatDefs/Light/Lighting.vert and .frag

MatParam.getPrefixedName() always returns null on a loaded material (is this a bug? in read() ?) which is passed in at com.jme3.material.Technique.updateUniformParam(Technique.java:147) from the

Somehow the shader has a uniform with a key null, and a type Vector4. The passed in Uniform that blows at that positon is for the DiffuseMap, which is a Texture2D. Inside there is the test which checks if the two passed types match.

There might be several errors at once at work here.

-All MatParam missing a prefixedName after load.

-Shader having a null uniform entry in its uniform definitions

I will have a look at the Shader initialization right now.



Stacktrace:

java.lang.IllegalArgumentException: Expected a Vector4 value!

at com.jme3.shader.Uniform.setValue(Uniform.java:266)

at com.jme3.material.Technique.updateUniformParam(Technique.java:144)

at com.jme3.material.MatParamTexture.apply(MatParamTexture.java:48)

at com.jme3.material.Material.render(Material.java:1037)

at com.jme3.renderer.RenderManager.renderGeometry(RenderManager.java:657)

at com.jme3.renderer.queue.RenderQueue.renderGeometryList(RenderQueue.java:301)

at com.jme3.renderer.queue.RenderQueue.renderQueue(RenderQueue.java:353)

at com.jme3.renderer.RenderManager.renderViewPortQueues(RenderManager.java:893)

at com.jme3.renderer.RenderManager.flushQueue(RenderManager.java:849)

at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:1125)

at com.jme3.renderer.RenderManager.render(RenderManager.java:1167)

at com.jme3.app.SimpleApplication.update(SimpleApplication.java:251)

at com.l2client.test.TestDwarfWarrior.update(TestDwarfWarrior.java:93)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:149)

at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:182)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:223)

at java.lang.Thread.run(Thread.java:722)

1 Like

nightly is not the bleeding edge, its a work in progress ^^ just don’t use nightly if you don’t want to just test the build. as the manual states in the section on updating you cannot revert the update safely, thats why its suggested to create a test application.

Redoing the prefixedNames on read() has solved the issue. Not sure if the Technique.updateUniformParam should throw an exception if it receives a null named uniform, but somehow it should at least complain about it (I left this out).

The code in updateUniformParam tries to locate the uniform, if it is not able to find one, it creates one and stores it with the null key as index in the list of uniforms, of which the type is null. The next uniform to put in had a type of Vector4 which was ok for setValue(). After setting the value, the type of that null Uniform is also changed. So all uniforms came in and changed the type of the null one, until one came along, which was of type

case TextureBuffer:

case Texture2D: // fall intentional

case Texture3D:

case TextureArray:

case TextureCubeMap:

case Int:



where it tried to set it to an int, with u.setValue(VarType.Int, value);



Anyway, here are some patches…

[patch]

Index: src/core/com/jme3/material/MatParam.java

===================================================================

— src/core/com/jme3/material/MatParam.java (revision 9496)

+++ src/core/com/jme3/material/MatParam.java (working copy)

@@ -310,6 +310,7 @@

InputCapsule ic = im.getCapsule(this);

type = ic.readEnum("varType", VarType.class, null);

name = ic.readString("name", null);

  •    prefixedName = &quot;m_&quot; + name;<br />
    

ffBinding = ic.readEnum("ff_binding", FixedFuncBinding.class, null);

switch (getVarType()) {

case Boolean:



[/patch]



And I added this one to the Uniform toString readablity it returned just the ] in the null case.

[patch]

Index: src/core/com/jme3/shader/Uniform.java

===================================================================

— src/core/com/jme3/shader/Uniform.java (revision 9496)

+++ src/core/com/jme3/shader/Uniform.java (working copy)

@@ -158,24 +158,21 @@

}

}


  • @Override
  • public String toString(){
  •    StringBuilder sb = new StringBuilder();<br />
    
  •    if (name != null){<br />
    
  •        sb.append(&quot;Uniform[name=&quot;);<br />
    
  •        sb.append(name);<br />
    
  •        if (varType != null){<br />
    
  •            sb.append(&quot;, type=&quot;);<br />
    
  •            sb.append(varType);<br />
    
  •            sb.append(&quot;, value=&quot;);<br />
    
  •            sb.append(value);<br />
    
  •        }else{<br />
    
  •            sb.append(&quot;, value=&lt;not set&gt;&quot;);<br />
    
  •        }<br />
    
  •    }<br />
    
  •    sb.append(&quot;]&quot;);<br />
    
  •    return sb.toString();<br />
    
  • }
  • @Override
  • public String toString() {
  •   StringBuilder sb = new StringBuilder();<br />
    
  •   sb.append(&quot;Uniform[name=&quot;);<br />
    
  •   sb.append(name);<br />
    

+

  •   sb.append(&quot;, type=&quot;);<br />
    
  •   sb.append(varType);<br />
    

+

  •   sb.append(&quot;, value=&quot;);<br />
    
  •   sb.append(value);<br />
    

+

  •   sb.append(&quot;]&quot;);<br />
    
  •   return sb.toString();<br />
    
  • }



    public void setBinding(UniformBinding binding){

    this.binding = binding;

    [/patch]
1 Like

Thanks, the patch was applied.