mirror of
https://github.com/mauiaaron/apple2.git
synced 2026-04-26 19:17:42 +00:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 63b6e0a29a | |||
| f423c2dbe6 | |||
| dd7727f757 | |||
| e9bae19e9e | |||
| bc96417091 | |||
| fb4d6f466b | |||
| a6ac111707 | |||
| d0319bd2ff | |||
| 9b56050c1e | |||
| 871762975a |
+6
-6
@@ -71,8 +71,8 @@
|
|||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.1.0/jars" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/21.0.0/jars" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.1.0/jars" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/21.0.0/jars" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
|
||||||
@@ -88,10 +88,10 @@
|
|||||||
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
|
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
|
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="library" exported="" name="support-annotations-23.1.0" level="project" />
|
<orderEntry type="library" exported="" name="support-annotations-21.0.0" level="project" />
|
||||||
<orderEntry type="library" exported="" name="appcompat-v7-23.1.0" level="project" />
|
<orderEntry type="library" exported="" name="support-v4-21.0.0" level="project" />
|
||||||
<orderEntry type="library" exported="" name="support-v4-23.1.0" level="project" />
|
<orderEntry type="library" exported="" name="appcompat-v7-21.0.0" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 23
|
compileSdkVersion 21
|
||||||
buildToolsVersion "21.1.2"
|
buildToolsVersion "21.1.2"
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
release {
|
release {
|
||||||
@@ -26,9 +26,9 @@ android {
|
|||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "org.deadc0de.apple2ix.basic"
|
applicationId "org.deadc0de.apple2ix.basic"
|
||||||
minSdkVersion 10
|
minSdkVersion 10
|
||||||
targetSdkVersion 23
|
targetSdkVersion 21
|
||||||
versionCode 4
|
versionCode 6
|
||||||
versionName "1.0.1"
|
versionName "1.0.3"
|
||||||
ndk {
|
ndk {
|
||||||
moduleName "apple2ix"
|
moduleName "apple2ix"
|
||||||
}
|
}
|
||||||
@@ -37,5 +37,5 @@ android {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
compile 'com.android.support:appcompat-v7:23.1.0'
|
compile 'com.android.support:appcompat-v7:21.0.0'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ public class Apple2Activity extends Activity {
|
|||||||
private static volatile boolean DEBUG_STRICT = false;
|
private static volatile boolean DEBUG_STRICT = false;
|
||||||
|
|
||||||
private Apple2View mView = null;
|
private Apple2View mView = null;
|
||||||
|
private Runnable mGraphicsInitializedRunnable = null;
|
||||||
private Apple2SplashScreen mSplashScreen = null;
|
private Apple2SplashScreen mSplashScreen = null;
|
||||||
private Apple2MainMenu mMainMenu = null;
|
private Apple2MainMenu mMainMenu = null;
|
||||||
private Apple2SettingsMenu mSettingsMenu = null;
|
private Apple2SettingsMenu mSettingsMenu = null;
|
||||||
@@ -147,12 +148,32 @@ public class Apple2Activity extends Activity {
|
|||||||
String dataDir = Apple2DisksMenu.getDataDir(this);
|
String dataDir = Apple2DisksMenu.getDataDir(this);
|
||||||
nativeOnCreate(dataDir, sampleRate, monoBufferSize, stereoBufferSize);
|
nativeOnCreate(dataDir, sampleRate, monoBufferSize, stereoBufferSize);
|
||||||
|
|
||||||
showSplashScreen();
|
final boolean firstTime = !Apple2Preferences.FIRST_TIME_CONFIGURED.booleanValue(this);
|
||||||
Apple2CrashHandler.getInstance().checkForCrashes(Apple2Activity.this);
|
Apple2Preferences.FIRST_TIME_CONFIGURED.saveBoolean(this, true);
|
||||||
|
|
||||||
// first-time initializations #1
|
showSplashScreen(!firstTime);
|
||||||
if (!Apple2Preferences.FIRST_TIME_CONFIGURED.booleanValue(this)) {
|
Apple2CrashHandler.getInstance().checkForCrashes(this);
|
||||||
Apple2DisksMenu.firstTime(this);
|
|
||||||
|
mGraphicsInitializedRunnable = new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (firstTime) {
|
||||||
|
Apple2Preferences.KeypadPreset.IJKM_SPACE.apply(Apple2Activity.this);
|
||||||
|
}
|
||||||
|
Apple2Preferences.loadPreferences(Apple2Activity.this);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// first-time initializations
|
||||||
|
if (firstTime) {
|
||||||
|
new Thread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
Apple2DisksMenu.firstTime(Apple2Activity.this);
|
||||||
|
mSplashScreen.setDismissable(true);
|
||||||
|
Log.d(TAG, "Finished first time copying...");
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
mSettingsMenu = new Apple2SettingsMenu(this);
|
mSettingsMenu = new Apple2SettingsMenu(this);
|
||||||
@@ -180,8 +201,8 @@ public class Apple2Activity extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Log.d(TAG, "onResume()");
|
Log.d(TAG, "onResume()");
|
||||||
showSplashScreen();
|
showSplashScreen(/*dismissable:*/true);
|
||||||
Apple2CrashHandler.getInstance().checkForCrashes(Apple2Activity.this); // NOTE : needs to be called again to clean-up
|
Apple2CrashHandler.getInstance().checkForCrashes(this); // NOTE : needs to be called again to clean-up
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -415,11 +436,15 @@ public class Apple2Activity extends Activity {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showSplashScreen() {
|
public Apple2SplashScreen getSplashScreen() {
|
||||||
|
return mSplashScreen;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showSplashScreen(boolean dismissable) {
|
||||||
if (mSplashScreen != null) {
|
if (mSplashScreen != null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mSplashScreen = new Apple2SplashScreen(Apple2Activity.this);
|
mSplashScreen = new Apple2SplashScreen(this, dismissable);
|
||||||
mSplashScreen.show();
|
mSplashScreen.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -428,7 +453,8 @@ public class Apple2Activity extends Activity {
|
|||||||
boolean glViewFirstTime = false;
|
boolean glViewFirstTime = false;
|
||||||
if (mView == null) {
|
if (mView == null) {
|
||||||
glViewFirstTime = true;
|
glViewFirstTime = true;
|
||||||
mView = new Apple2View(this);
|
mView = new Apple2View(this, mGraphicsInitializedRunnable);
|
||||||
|
mGraphicsInitializedRunnable = null;
|
||||||
mMainMenu = new Apple2MainMenu(this, mView);
|
mMainMenu = new Apple2MainMenu(this, mView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -181,14 +181,12 @@ public class Apple2CrashHandler {
|
|||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
|
|
||||||
final Button startButton = (Button) activity.findViewById(R.id.startButton);
|
final Apple2SplashScreen splashScreen = activity.getSplashScreen();
|
||||||
final Button prefsButton = (Button) activity.findViewById(R.id.prefsButton);
|
if (splashScreen != null) {
|
||||||
final Button disksButton = (Button) activity.findViewById(R.id.disksButton);
|
splashScreen.setDismissable(false);
|
||||||
|
}
|
||||||
final ProgressBar bar = (ProgressBar) activity.findViewById(R.id.crash_progressBar);
|
final ProgressBar bar = (ProgressBar) activity.findViewById(R.id.crash_progressBar);
|
||||||
try {
|
try {
|
||||||
startButton.setEnabled(false);
|
|
||||||
prefsButton.setEnabled(false);
|
|
||||||
disksButton.setEnabled(false);
|
|
||||||
bar.setVisibility(View.VISIBLE);
|
bar.setVisibility(View.VISIBLE);
|
||||||
} catch (NullPointerException npe) {
|
} catch (NullPointerException npe) {
|
||||||
/* could happen on early lifecycle crashes */
|
/* could happen on early lifecycle crashes */
|
||||||
@@ -354,9 +352,7 @@ public class Apple2CrashHandler {
|
|||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
bar.setVisibility(View.INVISIBLE);
|
bar.setVisibility(View.INVISIBLE);
|
||||||
startButton.setEnabled(true);
|
splashScreen.setDismissable(true);
|
||||||
prefsButton.setEnabled(true);
|
|
||||||
disksButton.setEnabled(true);
|
|
||||||
} catch (NullPointerException npe) {
|
} catch (NullPointerException npe) {
|
||||||
/* could happen on early lifecycle crashes */
|
/* could happen on early lifecycle crashes */
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import android.widget.CompoundButton;
|
|||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
|
import android.widget.ProgressBar;
|
||||||
import android.widget.RadioButton;
|
import android.widget.RadioButton;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
@@ -135,6 +136,14 @@ public class Apple2DisksMenu implements Apple2MenuView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void firstTime(Apple2Activity activity) {
|
public static void firstTime(Apple2Activity activity) {
|
||||||
|
final ProgressBar bar = (ProgressBar) activity.findViewById(R.id.crash_progressBar);
|
||||||
|
try {
|
||||||
|
bar.setVisibility(View.VISIBLE);
|
||||||
|
bar.setIndeterminate(true);
|
||||||
|
} catch (NullPointerException npe) {
|
||||||
|
Log.v(TAG, "Whoa, avoided NPE in first time #1");
|
||||||
|
}
|
||||||
|
|
||||||
getDataDir(activity);
|
getDataDir(activity);
|
||||||
|
|
||||||
Log.d(TAG, "First time copying stuff-n-things out of APK for ease-of-NDK access...");
|
Log.d(TAG, "First time copying stuff-n-things out of APK for ease-of-NDK access...");
|
||||||
@@ -149,6 +158,18 @@ public class Apple2DisksMenu implements Apple2MenuView {
|
|||||||
if (sExternalFilesDir != null) {
|
if (sExternalFilesDir != null) {
|
||||||
recursivelyCopyAPKAssets(activity, /*from APK directory:*/"keyboards", /*to location:*/sExternalFilesDir.getAbsolutePath());
|
recursivelyCopyAPKAssets(activity, /*from APK directory:*/"keyboards", /*to location:*/sExternalFilesDir.getAbsolutePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
activity.runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
bar.setVisibility(View.INVISIBLE);
|
||||||
|
bar.setIndeterminate(false);
|
||||||
|
} catch (NullPointerException npe) {
|
||||||
|
Log.v(TAG, "Whoa, avoided NPE in first time #2");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void exposeSymbols(Apple2Activity activity) {
|
public static void exposeSymbols(Apple2Activity activity) {
|
||||||
|
|||||||
@@ -23,11 +23,13 @@ public class Apple2SplashScreen implements Apple2MenuView {
|
|||||||
private final static String TAG = "Apple2SplashScreen";
|
private final static String TAG = "Apple2SplashScreen";
|
||||||
|
|
||||||
private Apple2Activity mActivity = null;
|
private Apple2Activity mActivity = null;
|
||||||
|
private boolean mDismissable = true;
|
||||||
private View mSettingsView = null;
|
private View mSettingsView = null;
|
||||||
|
|
||||||
public Apple2SplashScreen(Apple2Activity activity) {
|
public Apple2SplashScreen(Apple2Activity activity, boolean dismissable) {
|
||||||
mActivity = activity;
|
mActivity = activity;
|
||||||
setup();
|
setup();
|
||||||
|
setDismissable(dismissable);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setup() {
|
private void setup() {
|
||||||
@@ -61,6 +63,21 @@ public class Apple2SplashScreen implements Apple2MenuView {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setDismissable(boolean dismissable) {
|
||||||
|
mDismissable = dismissable;
|
||||||
|
mActivity.runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
Button startButton = (Button) mSettingsView.findViewById(R.id.startButton);
|
||||||
|
startButton.setEnabled(mDismissable);
|
||||||
|
Button prefsButton = (Button) mSettingsView.findViewById(R.id.prefsButton);
|
||||||
|
prefsButton.setEnabled(mDismissable);
|
||||||
|
Button disksButton = (Button) mSettingsView.findViewById(R.id.disksButton);
|
||||||
|
disksButton.setEnabled(mDismissable);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public final boolean isCalibrating() {
|
public final boolean isCalibrating() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -77,7 +94,9 @@ public class Apple2SplashScreen implements Apple2MenuView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void dismiss() {
|
public void dismiss() {
|
||||||
mActivity.popApple2View(this);
|
if (mDismissable) {
|
||||||
|
mActivity.popApple2View(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dismissAll() {
|
public void dismissAll() {
|
||||||
|
|||||||
@@ -22,8 +22,6 @@ import android.opengl.GLSurfaceView;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.ViewTreeObserver;
|
import android.view.ViewTreeObserver;
|
||||||
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
import javax.microedition.khronos.egl.EGL10;
|
import javax.microedition.khronos.egl.EGL10;
|
||||||
import javax.microedition.khronos.egl.EGLConfig;
|
import javax.microedition.khronos.egl.EGLConfig;
|
||||||
import javax.microedition.khronos.egl.EGLContext;
|
import javax.microedition.khronos.egl.EGLContext;
|
||||||
@@ -53,7 +51,7 @@ class Apple2View extends GLSurfaceView {
|
|||||||
private final static boolean DEBUG = false;
|
private final static boolean DEBUG = false;
|
||||||
|
|
||||||
private Apple2Activity mActivity = null;
|
private Apple2Activity mActivity = null;
|
||||||
private AtomicBoolean mInitialLaunch = new AtomicBoolean(true);
|
private Runnable mGraphicsInitializedRunnable = null;
|
||||||
|
|
||||||
private static native void nativeGraphicsInitialized(int width, int height);
|
private static native void nativeGraphicsInitialized(int width, int height);
|
||||||
|
|
||||||
@@ -61,9 +59,10 @@ class Apple2View extends GLSurfaceView {
|
|||||||
|
|
||||||
private static native void nativeRender();
|
private static native void nativeRender();
|
||||||
|
|
||||||
public Apple2View(Apple2Activity activity) {
|
public Apple2View(Apple2Activity activity, Runnable graphicsInitializedRunnable) {
|
||||||
super(activity.getApplication());
|
super(activity.getApplication());
|
||||||
mActivity = activity;
|
mActivity = activity;
|
||||||
|
mGraphicsInitializedRunnable = graphicsInitializedRunnable;
|
||||||
|
|
||||||
/* By default, GLSurfaceView() creates a RGB_565 opaque surface.
|
/* By default, GLSurfaceView() creates a RGB_565 opaque surface.
|
||||||
* If we want a translucent one, we should change the surface's
|
* If we want a translucent one, we should change the surface's
|
||||||
@@ -347,16 +346,9 @@ class Apple2View extends GLSurfaceView {
|
|||||||
|
|
||||||
nativeGraphicsInitialized(width, height);
|
nativeGraphicsInitialized(width, height);
|
||||||
|
|
||||||
// first-time initializations #2
|
if (Apple2View.this.mGraphicsInitializedRunnable != null) {
|
||||||
if (!Apple2Preferences.FIRST_TIME_CONFIGURED.booleanValue(Apple2View.this.mActivity)) {
|
Apple2View.this.mGraphicsInitializedRunnable.run();
|
||||||
Apple2Preferences.KeypadPreset.IJKM_SPACE.apply(Apple2View.this.mActivity);
|
Apple2View.this.mGraphicsInitializedRunnable = null;
|
||||||
Apple2Preferences.FIRST_TIME_CONFIGURED.saveBoolean(Apple2View.this.mActivity, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// load preferences on each new process creation
|
|
||||||
if (mInitialLaunch.get()) {
|
|
||||||
mInitialLaunch.set(false);
|
|
||||||
Apple2Preferences.loadPreferences(Apple2View.this.mActivity);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Apple2View.this.mActivity.maybeResumeCPU();
|
Apple2View.this.mActivity.maybeResumeCPU();
|
||||||
|
|||||||
+1
-7
@@ -24,18 +24,12 @@ uniform float aValue;
|
|||||||
uniform sampler2D texture;
|
uniform sampler2D texture;
|
||||||
|
|
||||||
#if __VERSION__ >= 140
|
#if __VERSION__ >= 140
|
||||||
#define OUTPUT_TEXTURE(TEX) \
|
#define OUTPUT_TEXTURE(TEX) vec4 tex = texture(TEX, varTexcoord.st, 0.0); fragColor = vec4(tex.r, tex.g, tex.b, tex.a*aValue)
|
||||||
vec4 tex = texture(TEX, varTexcoord.st, 0.0); \
|
|
||||||
fragColor = vec4(tex.r, tex.g, tex.b, tex.a*aValue)
|
|
||||||
#define OUTPUT_RED() \
|
|
||||||
fragColor = vec4(1.0, 0.0, 0.0, 1.0)
|
|
||||||
#else
|
#else
|
||||||
#define OUTPUT_TEXTURE(TEX) vec4 tex = texture2D(TEX, varTexcoord.st, 0.0); gl_FragColor = vec4(tex.r, tex.g, tex.b, tex.a*aValue)
|
#define OUTPUT_TEXTURE(TEX) vec4 tex = texture2D(TEX, varTexcoord.st, 0.0); gl_FragColor = vec4(tex.r, tex.g, tex.b, tex.a*aValue)
|
||||||
#define OUTPUT_RED() gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
OUTPUT_TEXTURE(texture);
|
OUTPUT_TEXTURE(texture);
|
||||||
//OUTPUT_RED(); -- WTF is this failing?
|
|
||||||
}
|
}
|
||||||
|
|||||||
+37
-22
@@ -46,6 +46,9 @@ static GLuint texcoordBufferName = UNINITIALIZED_GL;
|
|||||||
static GLuint elementBufferName = UNINITIALIZED_GL;
|
static GLuint elementBufferName = UNINITIALIZED_GL;
|
||||||
static GLModel *crtModel = NULL;
|
static GLModel *crtModel = NULL;
|
||||||
|
|
||||||
|
static GLuint vertexShader = UNINITIALIZED_GL;
|
||||||
|
static GLuint fragShader = UNINITIALIZED_GL;
|
||||||
|
|
||||||
static video_backend_s glvideo_backend = { 0 };
|
static video_backend_s glvideo_backend = { 0 };
|
||||||
|
|
||||||
#if USE_GLUT
|
#if USE_GLUT
|
||||||
@@ -323,7 +326,7 @@ static GLuint _build_program(demoSource *vertexSource, demoSource *fragmentSourc
|
|||||||
sprintf(sourceString, "%s", vertexSource->string);
|
sprintf(sourceString, "%s", vertexSource->string);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint vertexShader = glCreateShader(GL_VERTEX_SHADER);
|
vertexShader = glCreateShader(GL_VERTEX_SHADER);
|
||||||
glShaderSource(vertexShader, 1, (const GLchar **)&(sourceString), NULL);
|
glShaderSource(vertexShader, 1, (const GLchar **)&(sourceString), NULL);
|
||||||
glCompileShader(vertexShader);
|
glCompileShader(vertexShader);
|
||||||
glGetShaderiv(vertexShader, GL_INFO_LOG_LENGTH, &logLength);
|
glGetShaderiv(vertexShader, GL_INFO_LOG_LENGTH, &logLength);
|
||||||
@@ -362,7 +365,7 @@ static GLuint _build_program(demoSource *vertexSource, demoSource *fragmentSourc
|
|||||||
sprintf(sourceString, "%s", fragmentSource->string);
|
sprintf(sourceString, "%s", fragmentSource->string);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint fragShader = glCreateShader(GL_FRAGMENT_SHADER);
|
fragShader = glCreateShader(GL_FRAGMENT_SHADER);
|
||||||
glShaderSource(fragShader, 1, (const GLchar **)&(sourceString), NULL);
|
glShaderSource(fragShader, 1, (const GLchar **)&(sourceString), NULL);
|
||||||
glCompileShader(fragShader);
|
glCompileShader(fragShader);
|
||||||
glGetShaderiv(fragShader, GL_INFO_LOG_LENGTH, &logLength);
|
glGetShaderiv(fragShader, GL_INFO_LOG_LENGTH, &logLength);
|
||||||
@@ -398,17 +401,6 @@ static GLuint _build_program(demoSource *vertexSource, demoSource *fragmentSourc
|
|||||||
free(log);
|
free(log);
|
||||||
}
|
}
|
||||||
|
|
||||||
glDetachShader(prgName, vertexShader);
|
|
||||||
glDetachShader(prgName, fragShader);
|
|
||||||
|
|
||||||
// Delete the vertex shader since it is now attached and linked
|
|
||||||
// to the program, which will retain a reference to it
|
|
||||||
glDeleteShader(vertexShader);
|
|
||||||
|
|
||||||
// Delete the fragment shader since it is now attached and linked
|
|
||||||
// to the program, which will retain a reference to it
|
|
||||||
glDeleteShader(fragShader);
|
|
||||||
|
|
||||||
glGetProgramiv(prgName, GL_LINK_STATUS, &status);
|
glGetProgramiv(prgName, GL_LINK_STATUS, &status);
|
||||||
if (status == 0) {
|
if (status == 0) {
|
||||||
LOG("Failed to link program");
|
LOG("Failed to link program");
|
||||||
@@ -551,10 +543,19 @@ static void _gldriver_setup_hackarounds(void) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
regex_t twoHundredXXRegex = { 0 };
|
||||||
|
err = regcomp(&twoHundredXXRegex, "2[2-9][0-9]", REG_ICASE|REG_NOSUB|REG_EXTENDED);
|
||||||
|
if (err) {
|
||||||
|
LOG("Cannot compile regex : %d", err);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
int found200 = !regexec(&twoHundredRegex, renderer, /*nmatch:*/0, /*pmatch:*/NULL, /*eflags:*/0);
|
int found200 = !regexec(&twoHundredRegex, renderer, /*nmatch:*/0, /*pmatch:*/NULL, /*eflags:*/0);
|
||||||
int found205 = !regexec(&twoHundredFiveRegex, renderer, /*nmatch:*/0, /*pmatch:*/NULL, /*eflags:*/0);
|
int found205 = !regexec(&twoHundredFiveRegex, renderer, /*nmatch:*/0, /*pmatch:*/NULL, /*eflags:*/0);
|
||||||
|
int found2XX = !regexec(&twoHundredXXRegex, renderer, /*nmatch:*/0, /*pmatch:*/NULL, /*eflags:*/0);
|
||||||
regfree(&twoHundredRegex);
|
regfree(&twoHundredRegex);
|
||||||
regfree(&twoHundredFiveRegex);
|
regfree(&twoHundredFiveRegex);
|
||||||
|
regfree(&twoHundredXXRegex);
|
||||||
|
|
||||||
if (found200) {
|
if (found200) {
|
||||||
LOG("HACKING AROUND BROKEN ADRENO 200");
|
LOG("HACKING AROUND BROKEN ADRENO 200");
|
||||||
@@ -567,6 +568,11 @@ static void _gldriver_setup_hackarounds(void) {
|
|||||||
hackAroundBrokenAdreno205 = true;
|
hackAroundBrokenAdreno205 = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (found2XX) {
|
||||||
|
LOG("HACKING AROUND BROKEN ADRENO 2XX");
|
||||||
|
hackAroundBrokenAdreno200 = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
} while (0);
|
} while (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -627,15 +633,13 @@ static void gldriver_init_common(void) {
|
|||||||
// ----------------------------
|
// ----------------------------
|
||||||
// setup static OpenGL state
|
// setup static OpenGL state
|
||||||
|
|
||||||
// Depth test will always be enabled
|
|
||||||
glEnable(GL_DEPTH_TEST);
|
|
||||||
|
|
||||||
// We will always cull back faces for better performance
|
|
||||||
glEnable(GL_CULL_FACE);
|
|
||||||
|
|
||||||
// Always use this clear color
|
|
||||||
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
|
// Set up to do blending of texture quads. Disabling DEPTH/CULL appears to fix blended quad/texture rendering on
|
||||||
|
// finicky Tegra 2. This generally appears to be the correct way to do it accoring to NVIDIA forums and:
|
||||||
|
// http://www.learnopengles.com/android-lesson-five-an-introduction-to-blending/
|
||||||
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
glDisable(GL_CULL_FACE);
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
@@ -673,6 +677,17 @@ static void _gldriver_shutdown(void) {
|
|||||||
|
|
||||||
mdlDestroyModel(&crtModel);
|
mdlDestroyModel(&crtModel);
|
||||||
|
|
||||||
|
// detach and delete the main shaders
|
||||||
|
// 2015/11/06 NOTE : Tegra 2 for mobile has a bug whereby you cannot detach/delete shaders immediately after
|
||||||
|
// creating the program. So we delete them during the shutdown sequence instead.
|
||||||
|
// https://code.google.com/p/android/issues/detail?id=61832
|
||||||
|
glDetachShader(mainShaderProgram, vertexShader);
|
||||||
|
glDetachShader(mainShaderProgram, fragShader);
|
||||||
|
glDeleteShader(vertexShader);
|
||||||
|
glDeleteShader(fragShader);
|
||||||
|
vertexShader = UNINITIALIZED_GL;
|
||||||
|
fragShader = UNINITIALIZED_GL;
|
||||||
|
|
||||||
glUseProgram(0);
|
glUseProgram(0);
|
||||||
if (mainShaderProgram != UNINITIALIZED_GL) {
|
if (mainShaderProgram != UNINITIALIZED_GL) {
|
||||||
glDeleteProgram(mainShaderProgram);
|
glDeleteProgram(mainShaderProgram);
|
||||||
@@ -735,7 +750,7 @@ static void gldriver_render(void) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
#if MOBILE_DEVICE
|
#if MOBILE_DEVICE
|
||||||
glViewport(viewportX, viewportY, viewportWidth, viewportHeight);
|
glViewport(viewportX, viewportY, viewportWidth, viewportHeight);
|
||||||
#endif
|
#endif
|
||||||
@@ -889,7 +904,7 @@ static void gldriver_reshape(int w, int h) {
|
|||||||
#if USE_GLUT
|
#if USE_GLUT
|
||||||
static void gldriver_init_glut(GLuint fbo) {
|
static void gldriver_init_glut(GLuint fbo) {
|
||||||
glutInit(&argc, argv);
|
glutInit(&argc, argv);
|
||||||
glutInitDisplayMode(/*GLUT_DOUBLE|*/GLUT_RGBA|GLUT_DEPTH);
|
glutInitDisplayMode(/*GLUT_DOUBLE|*/GLUT_RGBA);
|
||||||
glutInitWindowSize(windowWidth, windowHeight);
|
glutInitWindowSize(windowWidth, windowHeight);
|
||||||
//glutInitContextVersion(4, 0); -- Is this needed?
|
//glutInitContextVersion(4, 0); -- Is this needed?
|
||||||
glutInitContextProfile(GLUT_CORE_PROFILE);
|
glutInitContextProfile(GLUT_CORE_PROFILE);
|
||||||
|
|||||||
Reference in New Issue
Block a user