Android Nifty and android multitouch fixed : great work ! (Android 2.2 patch)

Thank you for fixing the Nifty slowdowns ! It really rocks now. Same for multitouch ! Great work.

Nifty is now 1.3.1 and should work faster: less garbage. It runs fine on my mobiles.

I made my own jni patch to use glVertexAttribPointer on Android 2.2 devices, maybe you should include this too.

Thank you!


1 Like


What is your jni patch for glVertexAttribPointer? you already talked about it in another thread?

Here it is: first two files are java,


import android.opengl.GLES20;

import android.os.Build;

import com.jme3.util.GLES20fix;

public class Android22Workaround {

public static void glVertexAttribPointer(int location, int components, int format, boolean normalize, int stride, int offset){

// prefer the java one in case we are on googleTV (no jni allowed til 2013)

if (Build.VERSION.SDK_INT >= 9)

GLES20.glVertexAttribPointer(location, components, format,

normalize, stride, offset);


GLES20fix.glVertexAttribPointer(location, components, format,

normalize, stride, offset);



[java]package com.jme3.util;

public class GLES20fix






native public static void glVertexAttribPointer(int index, int size, int type, boolean normalized, int stride, int offset);

native public static void glDrawElements(int mode, int count, int type, int offset);

private GLES20fix()



c file:

[java]#include <jni.h>

#include <GLES2/gl2.h>

//#include <GLES2/gl2ext.h>

void Java_com_jme3_util_GLES20fix_glVertexAttribPointer

(JNIEnv env, jclass c, jint index, jint size, jint type, jboolean normalized, jint stride, jint offset)


glVertexAttribPointer(index, size, type, normalized, stride, (void
) offset);


void Java_com_jme3_util_GLES20fix_glDrawElements

(JNIEnv env, jclass c, jint mode, jint count, jint type, jint offset)


glDrawElements(mode, count, type, (void
) offset);


[/java] :

[java]LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)









1 Like

Sorry, but…what does this fix, could you explain the issue, i’m not following

Google missed to wrap those two functions to java in 2.2, so no vbo etc

This fix wraps the missing fuctions from c


[java]Build.VERSION.SDK_INT >= 9[/java]

shouldn’t that just be == and not >= ? Since that was fixed in 2.3(api level 9) and above.

well , it’s definitively the same lol, we use the fix if sdk version is under 9.

Beware, googleTV don’t have access to ndk (google said it will, but not before 2013), so a googleTV with sdk_int < 9 would fail to load the jni functions. Fortunately, 90% of them are 2.3 and more.