This issue was reported at the Discourse hub/forum: https://hub.jmonkeyengine.org/t/java-lang-illegalargumentexception-object-id-must-be-greater-than-zero-on-mac/46559
|
public void registerObject(NativeObject obj) { |
|
if (obj.getId() <= 0) { |
|
throw new IllegalArgumentException("object id must be greater than zero"); |
|
} |
While JME specifically reserves the value -1 for invalid IDs:
|
public static final int INVALID_ID = -1; |
I believe negative IDs in general don't justify throwing an exception.
The OpenGL documentation doesn't specify range of values for a texture name, only that they are GLuint:
According to the OpenGL spec, GLuint is at least 32 bits, so values > 0x7fffffff will produce negative values in a Java int.
I think the tests in lines 105 and 132 should be specifically for == INVALID_ID instead of <= 0.
This issue was reported at the Discourse hub/forum: https://hub.jmonkeyengine.org/t/java-lang-illegalargumentexception-object-id-must-be-greater-than-zero-on-mac/46559
jmonkeyengine/jme3-core/src/main/java/com/jme3/util/NativeObjectManager.java
Lines 104 to 107 in 44a50de
While JME specifically reserves the value
-1for invalid IDs:jmonkeyengine/jme3-core/src/main/java/com/jme3/util/NativeObject.java
Line 47 in 44a50de
I believe negative IDs in general don't justify throwing an exception.
The OpenGL documentation doesn't specify range of values for a texture name, only that they are
GLuint:According to the OpenGL spec,
GLuintis at least 32 bits, so values > 0x7fffffff will produce negative values in a Javaint.I think the tests in lines 105 and 132 should be specifically for
== INVALID_IDinstead of<= 0.