Android Question LibGDX - Max Texture size

jtare

Active Member
Licensed User
Longtime User
Im trying to get the max texture size that the device can handle and found this simple java code, but I don't know how to run it in B4A, does someone know how to translate it?
JAVA code:
B4X:
IntBuffer buf = BufferUtils.newIntBuffer(16);
Gdx.gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, buf);
int maxSize = buf.get(0);

I copied this code from https://github.com/mattdesl/lwjgl-basics/wiki/LibGDX-Textures

Thanks
 

jtare

Active Member
Licensed User
Longtime User
SOLVED.
Add this java code with the #if java

B4X:
#if java
import     java.lang.Integer;
import com.badlogic.gdx.utils.BufferUtils;
import java.nio.IntBuffer;
import com.badlogic.gdx.Gdx;

IntBuffer buf = BufferUtils.newIntBuffer(16);

public IntBuffer getBuf(){
return buf;
}
public int getMaxSize(IntBuffer buff){
int maxSize = buff.get(0);
return maxSize;
}
#End If

On B4A ask for the max texture size using this code

B4X:
    GL.glGetIntegerv(GL.GL10_MAX_TEXTURE_SIZE,nativeMe.RunMethod("getBuf",Null))
    maxTexSize = nativeMe.RunMethod("getMaxSize",Array (nativeMe.RunMethod("getBuf",Null)))
    Log("MaxtexSIze = "&maxTexSize)
 
Upvote 0
Top