| @@ -571,6 +571,8 @@ private: | |||||
| executable->createNewChildElement ("arg")->setAttribute ("value", "${ndkDebugValue}"); | executable->createNewChildElement ("arg")->setAttribute ("value", "${ndkDebugValue}"); | ||||
| executable->createNewChildElement ("arg")->setAttribute ("value", "APP_ABI=${app_abis}"); | executable->createNewChildElement ("arg")->setAttribute ("value", "APP_ABI=${app_abis}"); | ||||
| target->createNewChildElement ("delete")->setAttribute ("file", "${out.final.file}"); | |||||
| target->createNewChildElement ("delete")->setAttribute ("file", "${out.packaged.file}"); | |||||
| } | } | ||||
| proj->createNewChildElement ("import")->setAttribute ("file", "${sdk.dir}/tools/ant/build.xml"); | proj->createNewChildElement ("import")->setAttribute ("file", "${sdk.dir}/tools/ant/build.xml"); | ||||
| @@ -30,6 +30,8 @@ | |||||
| <arg value="${ndkDebugValue}"/> | <arg value="${ndkDebugValue}"/> | ||||
| <arg value="APP_ABI=${app_abis}"/> | <arg value="APP_ABI=${app_abis}"/> | ||||
| </exec> | </exec> | ||||
| <delete file="${out.final.file}"/> | |||||
| <delete file="${out.packaged.file}"/> | |||||
| </target> | </target> | ||||
| <import file="${sdk.dir}/tools/ant/build.xml"/> | <import file="${sdk.dir}/tools/ant/build.xml"/> | ||||
| </project> | </project> | ||||
| @@ -266,13 +266,15 @@ public: | |||||
| addEnv (env); | addEnv (env); | ||||
| } | } | ||||
| void attach() | |||||
| JNIEnv* attach() | |||||
| { | { | ||||
| JNIEnv* env = nullptr; | JNIEnv* env = nullptr; | ||||
| jvm->AttachCurrentThread (&env, 0); | jvm->AttachCurrentThread (&env, 0); | ||||
| if (env != 0) | |||||
| if (env != nullptr) | |||||
| addEnv (env); | addEnv (env); | ||||
| return env; | |||||
| } | } | ||||
| void detach() | void detach() | ||||
| @@ -287,6 +289,17 @@ public: | |||||
| threads[i] = 0; | threads[i] = 0; | ||||
| } | } | ||||
| JNIEnv* getOrAttach() noexcept | |||||
| { | |||||
| JNIEnv* env = get(); | |||||
| if (env == nullptr) | |||||
| env = attach(); | |||||
| jassert (env != nullptr); | |||||
| return env; | |||||
| } | |||||
| JNIEnv* get() const noexcept | JNIEnv* get() const noexcept | ||||
| { | { | ||||
| const pthread_t thisThread = pthread_self(); | const pthread_t thisThread = pthread_self(); | ||||
| @@ -298,7 +311,7 @@ public: | |||||
| return nullptr; | return nullptr; | ||||
| } | } | ||||
| enum { maxThreads = 16 }; | |||||
| enum { maxThreads = 32 }; | |||||
| private: | private: | ||||
| JavaVM* jvm; | JavaVM* jvm; | ||||
| @@ -100,7 +100,7 @@ ThreadLocalJNIEnvHolder threadLocalJNIEnvHolder; | |||||
| JNIEnv* getEnv() noexcept | JNIEnv* getEnv() noexcept | ||||
| { | { | ||||
| return threadLocalJNIEnvHolder.get(); | |||||
| return threadLocalJNIEnvHolder.getOrAttach(); | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -67,7 +67,7 @@ | |||||
| #include <GLES2/gl2.h> | #include <GLES2/gl2.h> | ||||
| #endif | #endif | ||||
| #if (JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX) && ! defined (JUCE_USE_OPENGL_SHADERS) | |||||
| #if (JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX || JUCE_ANDROID) && ! defined (JUCE_USE_OPENGL_SHADERS) | |||||
| #define JUCE_USE_OPENGL_SHADERS 1 | #define JUCE_USE_OPENGL_SHADERS 1 | ||||
| #endif | #endif | ||||
| @@ -87,7 +87,7 @@ public: | |||||
| glView.callVoidMethod (OpenGLView.layout, | glView.callVoidMethod (OpenGLView.layout, | ||||
| bounds.getX(), bounds.getY(), | bounds.getX(), bounds.getY(), | ||||
| lastWidth, lastHeight); | |||||
| bounds.getRight(), bounds.getBottom()); | |||||
| } | } | ||||
| } | } | ||||
| @@ -172,7 +172,7 @@ OpenGLContext* OpenGLComponent::createContext() | |||||
| if (peer != nullptr) | if (peer != nullptr) | ||||
| return new AndroidGLContext (this, peer, preferredPixelFormat, | return new AndroidGLContext (this, peer, preferredPixelFormat, | ||||
| dynamic_cast <const AndroidGLContext*> (contextToShareListsWith), | dynamic_cast <const AndroidGLContext*> (contextToShareListsWith), | ||||
| (flags & openGLES2) != 0); | |||||
| (flags & openGLES1) == 0); | |||||
| return nullptr; | return nullptr; | ||||
| } | } | ||||