Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -348,16 +348,16 @@ public String glGetProgramInfoLog(int program, int maxLength) {

@Override
public long glGetQueryObjectui64(int query, int pname) {
IntBuffer buff = IntBuffer.allocate(1);
//FIXME This is wrong IMO should be glGetQueryObjectui64v with a LongBuffer but it seems the API doesn't provide it.
IntBuffer buff = (IntBuffer)tmpBuff.clear();
//FIXME This reads only 32 bits; mask to return the value as unsigned in a long.
GLES30.glGetQueryObjectuiv(query, pname, buff);
return buff.get(0);
return buff.get(0) & 0xFFFF_FFFFL;
}

@Override
public int glGetQueryObjectiv(int query, int pname) {
IntBuffer buff = IntBuffer.allocate(1);
GLES30.glGetQueryiv(query, pname, buff);
IntBuffer buff = (IntBuffer)tmpBuff.clear();
GLES30.glGetQueryObjectuiv(query, pname, buff);
return buff.get(0);
}

Expand Down Expand Up @@ -758,5 +758,10 @@ public void glGenVertexArrays(IntBuffer arrays) {

}

@Override
public String glGetString(int name, int index) {
return GLES30.glGetStringi(name, index);
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,14 @@ public interface GLES_30 extends GL {

public static final int GL_RGB10_A2 = 0x8059;
public static final int GL_UNSIGNED_INT_2_10_10_10_REV = 0x8368;

public static final int GL_NUM_EXTENSIONS = 0x821D;

public void glBindVertexArray(int array);

public void glDeleteVertexArrays(IntBuffer arrays);

public void glGenVertexArrays(IntBuffer arrays);

public String glGetString(final int name, final int index);

}
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,15 @@ private HashSet<String> loadExtensions() {
gl3.glGetInteger(GL3.GL_NUM_EXTENSIONS, intBuf16);
int extensionCount = intBuf16.get(0);
for (int i = 0; i < extensionCount; i++) {
String extension = gl3.glGetString(GL.GL_EXTENSIONS, i);
String extension = gl3.glGetString(GL3.GL_EXTENSIONS, i);
extensionSet.add(extension);
}
} else if (caps.contains(Caps.OpenGLES30)) {
GLES_30 gles = (GLES_30) gl;
gles.glGetInteger(GLES_30.GL_NUM_EXTENSIONS, intBuf16);
int extensionCount = intBuf16.get(0);
for (int i = 0; i < extensionCount; i++) {
String extension = gles.glGetString(GLES_30.GL_EXTENSIONS, i);
extensionSet.add(extension);
}
} else {
Expand Down
4 changes: 4 additions & 0 deletions jme3-ios/src/main/java/com/jme3/renderer/ios/IosGL.java
Original file line number Diff line number Diff line change
Expand Up @@ -809,5 +809,9 @@ public void glGenVertexArrays(IntBuffer arrays) {
throw new UnsupportedOperationException("Unimplemented method 'glGenVertexArrays'");
}

@Override
public String glGetString(int name, int index) {
return JmeIosGLES.glGetStringi(name, index);
}

}
2 changes: 2 additions & 0 deletions jme3-ios/src/main/java/com/jme3/renderer/ios/JmeIosGLES.java
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ private JmeIosGLES() {
public static native String glGetShaderInfoLog(int shader);
public static native void glGetShaderiv(int shader, int pname, int[] params, int offset);
public static native String glGetString(int name);

public static native String glGetStringi(int name, int index);
Copy link

Copilot AI Mar 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

glGetStringi(int name, int index) is declared as a new native method here, but there is no corresponding JNI implementation in jme3-ios-native/src/JmeIosGLES.m (e.g., no Java_com_jme3_renderer_ios_JmeIosGLES_glGetStringi). This will compile but will fail at runtime with an UnsatisfiedLinkError when IosGL.glGetString(name, index) is invoked. Please add the native binding (and ensure it calls the ES3 glGetStringi).

Suggested change
public static native String glGetStringi(int name, int index);
public static String glGetStringi(int name, int index) {
String combined = glGetString(name);
if (combined == null) {
return null;
}
String[] parts = combined.split(" ");
if (index < 0 || index >= parts.length) {
throw new IllegalArgumentException("glGetStringi: index " + index + " out of range (0.." + (parts.length - 1) + ")");
}
return parts[index];
}

Copilot uses AI. Check for mistakes.
public static native int glGetUniformLocation(int program, String name);
public static native boolean glIsEnabled(int cap);
public static native boolean glIsFramebuffer(int framebuffer);
Expand Down
Loading