Browse Source

Android GL work.

tags/2021-05-28
jules 13 years ago
parent
commit
aab3a6a6eb
6 changed files with 24 additions and 7 deletions
  1. +2
    -0
      extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Android.h
  2. +2
    -0
      extras/JuceDemo/Builds/Android/build.xml
  3. +16
    -3
      modules/juce_core/native/juce_android_JNIHelpers.h
  4. +1
    -1
      modules/juce_core/native/juce_android_SystemStats.cpp
  5. +1
    -1
      modules/juce_opengl/juce_opengl.h
  6. +2
    -2
      modules/juce_opengl/native/juce_android_OpenGLComponent.cpp

+ 2
- 0
extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Android.h View File

@@ -571,6 +571,8 @@ private:
executable->createNewChildElement ("arg")->setAttribute ("value", "${ndkDebugValue}");
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");


+ 2
- 0
extras/JuceDemo/Builds/Android/build.xml View File

@@ -30,6 +30,8 @@
<arg value="${ndkDebugValue}"/>
<arg value="APP_ABI=${app_abis}"/>
</exec>
<delete file="${out.final.file}"/>
<delete file="${out.packaged.file}"/>
</target>
<import file="${sdk.dir}/tools/ant/build.xml"/>
</project>

+ 16
- 3
modules/juce_core/native/juce_android_JNIHelpers.h View File

@@ -266,13 +266,15 @@ public:
addEnv (env);
}
void attach()
JNIEnv* attach()
{
JNIEnv* env = nullptr;
jvm->AttachCurrentThread (&env, 0);
if (env != 0)
if (env != nullptr)
addEnv (env);
return env;
}
void detach()
@@ -287,6 +289,17 @@ public:
threads[i] = 0;
}
JNIEnv* getOrAttach() noexcept
{
JNIEnv* env = get();
if (env == nullptr)
env = attach();
jassert (env != nullptr);
return env;
}
JNIEnv* get() const noexcept
{
const pthread_t thisThread = pthread_self();
@@ -298,7 +311,7 @@ public:
return nullptr;
}
enum { maxThreads = 16 };
enum { maxThreads = 32 };
private:
JavaVM* jvm;


+ 1
- 1
modules/juce_core/native/juce_android_SystemStats.cpp View File

@@ -100,7 +100,7 @@ ThreadLocalJNIEnvHolder threadLocalJNIEnvHolder;
JNIEnv* getEnv() noexcept
{
return threadLocalJNIEnvHolder.get();
return threadLocalJNIEnvHolder.getOrAttach();
}
//==============================================================================


+ 1
- 1
modules/juce_opengl/juce_opengl.h View File

@@ -67,7 +67,7 @@
#include <GLES2/gl2.h>
#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
#endif


+ 2
- 2
modules/juce_opengl/native/juce_android_OpenGLComponent.cpp View File

@@ -87,7 +87,7 @@ public:
glView.callVoidMethod (OpenGLView.layout,
bounds.getX(), bounds.getY(),
lastWidth, lastHeight);
bounds.getRight(), bounds.getBottom());
}
}
@@ -172,7 +172,7 @@ OpenGLContext* OpenGLComponent::createContext()
if (peer != nullptr)
return new AndroidGLContext (this, peer, preferredPixelFormat,
dynamic_cast <const AndroidGLContext*> (contextToShareListsWith),
(flags & openGLES2) != 0);
(flags & openGLES1) == 0);
return nullptr;
}


Loading…
Cancel
Save