Description
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 -1
for invalid IDs:
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
:
- https://registry.khronos.org/OpenGL-Refpages/gl4/html/glGenBuffers.xhtml
- https://registry.khronos.org/OpenGL-Refpages/gl4/html/glGenTextures.xhtml
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
.