static void se_savePixelsData(JNIEnv *env, jobject obj, jstring savePath, jstring imageKey) {
    const char* imageKey8 = env->GetStringUTFChars(imageKey, 0);
    const char* savePath8 = env->GetStringUTFChars(savePath, 0);
    SE_ImageDataID imageDataid(imageKey8);
    SE_ResourceManager *resourceManager = SE_Application::getInstance()->getResourceManager();
    SE_ImageData* imgd = resourceManager->getImageData(imageDataid);
    if (imgd) {
        SE_File fbase(savePath8, SE_File::WRITE);
        fbase.write(imgd->getData(), imgd->getHeight() * imgd->getBytesPerRow());
        LOGI("SEHome:#################savePixelsData success!!!");
    }
    env->ReleaseStringUTFChars(imageKey, imageKey8);
    env->ReleaseStringUTFChars(savePath, savePath8);
}
static void se_changeTextureImage(JNIEnv* env, jobject clazz,
        jstring imageKey) {
    const char* imagePath = env->GetStringUTFChars(imageKey, NULL);
    SE_ResourceManager *resourceManager =
            SE_Application::getInstance()->getResourceManager();
    SE_ImageData* existdata = resourceManager->getImageDataFromPath(imagePath);
    if (existdata && !existdata->getData()) {
        GLuint texid = existdata->getTexID();
        if (texid != 0) {
            glDeleteTextures(1, &texid);
        }
        existdata->setTexID(0);

    }

    env->ReleaseStringUTFChars(imageKey, imagePath);
}
static void se_loadTextureImage(JNIEnv* env, jobject clazz, jstring imageKey,
        jobject jbitmap) {
    const char* imagePath = env->GetStringUTFChars(imageKey, NULL);
    SE_ResourceManager *resourceManager =
            SE_Application::getInstance()->getResourceManager();
    SE_ImageData* existdata = resourceManager->getImageDataFromPath(imagePath);
    if (existdata && !existdata->getData()) {
        GLuint texid = existdata->getTexID();
        if (texid != 0) {
            glDeleteTextures(1, &texid);
        }
        existdata->setTexID(0);
        AndroidBitmapInfo bitmapInfo;
        int ret;
        void* pixels;
        if ((ret = AndroidBitmap_getInfo(env, jbitmap, &bitmapInfo)) < 0) {
            LOGE("error: AndroidBitmap_getInfo() failed ! error = %d\n", ret);
            return;
        }
        if (bitmapInfo.format != ANDROID_BITMAP_FORMAT_RGB_565
                && bitmapInfo.format != ANDROID_BITMAP_FORMAT_RGBA_8888
                && bitmapInfo.format != ANDROID_BITMAP_FORMAT_RGBA_4444) {
            LOGE("error: Bitmap format is not supported\n");
            return;
        }
        if ((ret = AndroidBitmap_lockPixels(env, jbitmap, &pixels)) < 0) {
            LOGE("error: AndroidBitmap_lockPixels() failed ! error = %d\n",
                    ret);
            return;
        }

        GLint internalFormat = GL_RGB;
        GLenum format = GL_RGB;
        GLenum type = GL_UNSIGNED_BYTE;

        switch (bitmapInfo.format) {
        case ANDROID_BITMAP_FORMAT_RGB_565:
            type = GL_UNSIGNED_SHORT_5_6_5;
            break;
        case ANDROID_BITMAP_FORMAT_RGBA_8888:
            internalFormat = GL_RGBA;
            format = GL_RGBA;
            break;
        case ANDROID_BITMAP_FORMAT_RGBA_4444:
            internalFormat = GL_RGBA;
            format = GL_RGBA;
            type = GL_UNSIGNED_SHORT_4_4_4_4;
            break;
        default:
            return;
            break;
        }
        int width = bitmapInfo.width;
        int height = bitmapInfo.height;
        glPixelStorei(GL_UNPACK_ALIGNMENT,1);
        glActiveTexture(GL_TEXTURE0);
        glGenTextures(1, &texid);
        existdata->setTexID(texid);
        glBindTexture(GL_TEXTURE_2D, texid);
        glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, width, height, 0, format,
                type, pixels);
        glGenerateMipmap (GL_TEXTURE_2D);

        GLint wraps, wrapt;
        if (SE_Util::isPower2(width) && SE_Util::isPower2(height)) {
            wraps = GL_REPEAT;
        } else {
            wraps = GL_CLAMP_TO_EDGE;
        }

        if (SE_Util::isPower2(width) && SE_Util::isPower2(height)) {
            wrapt = GL_REPEAT;
        } else {
            wrapt = GL_CLAMP_TO_EDGE;
        }

        GLint sampleMin, sampleMag;
        sampleMin = GL_LINEAR_MIPMAP_LINEAR;
        sampleMag = GL_LINEAR;
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wraps);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrapt);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, sampleMin);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, sampleMag);
    }
    env->ReleaseStringUTFChars(imageKey, imagePath);
}