mirror of
https://github.com/mauiaaron/apple2.git
synced 2025-01-18 13:32:39 +00:00
Fixes to get Android tests rendering
This commit is contained in:
parent
fadb806c92
commit
c3969f9d1d
@ -64,7 +64,6 @@ void Java_org_deadc0de_apple2_Apple2Activity_nativeOnPause(JNIEnv *env, jobject
|
|||||||
void Java_org_deadc0de_apple2_Apple2Activity_nativeRender(JNIEnv *env, jobject obj) {
|
void Java_org_deadc0de_apple2_Apple2Activity_nativeRender(JNIEnv *env, jobject obj) {
|
||||||
c_keys_handle_input(-1, 0, 0);
|
c_keys_handle_input(-1, 0, 0);
|
||||||
|
|
||||||
#define FPS_LOG 1
|
|
||||||
#if FPS_LOG
|
#if FPS_LOG
|
||||||
static uint32_t prevCount = 0;
|
static uint32_t prevCount = 0;
|
||||||
static uint32_t idleCount = 0;
|
static uint32_t idleCount = 0;
|
||||||
@ -82,8 +81,6 @@ void Java_org_deadc0de_apple2_Apple2Activity_nativeRender(JNIEnv *env, jobject o
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (_vid_dirty) {
|
video_driver_render();
|
||||||
video_driver_render();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,18 +68,14 @@ public class Apple2Activity extends 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...");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
_copyFile(dataDir, "shaders", "Basic.vsh");
|
String[] shaders = getAssets().list("shaders");
|
||||||
_copyFile(dataDir, "shaders", "Basic.fsh");
|
for (String shader : shaders) {
|
||||||
_copyFile(dataDir, "disks", "blank.dsk");
|
_copyFile(dataDir, "shaders", shader);
|
||||||
_copyFile(dataDir, "disks", "blank.nib");
|
}
|
||||||
_copyFile(dataDir, "disks", "blank.po");
|
String[] disks = getAssets().list("disks");
|
||||||
_copyFile(dataDir, "disks", "etc.dsk");
|
for (String disk : disks) {
|
||||||
_copyFile(dataDir, "disks", "flapple140.po");
|
_copyFile(dataDir, "disks", disk);
|
||||||
_copyFile(dataDir, "disks", "mystery.dsk");
|
}
|
||||||
_copyFile(dataDir, "disks", "ProDOS.dsk");
|
|
||||||
_copyFile(dataDir, "disks", "speedtest.dsk");
|
|
||||||
_copyFile(dataDir, "disks", "testdisplay1.dsk");
|
|
||||||
_copyFile(dataDir, "disks", "testvm1.dsk");
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(TAG, "problem copying resources : "+e);
|
Log.e(TAG, "problem copying resources : "+e);
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
|
@ -49,7 +49,7 @@ import javax.microedition.khronos.opengles.GL10;
|
|||||||
*/
|
*/
|
||||||
class Apple2View extends GLSurfaceView {
|
class Apple2View extends GLSurfaceView {
|
||||||
private final static String TAG = "Apple2View";
|
private final static String TAG = "Apple2View";
|
||||||
private final static boolean DEBUG = true;
|
private final static boolean DEBUG = false;
|
||||||
|
|
||||||
private Apple2Activity mActivity = null;
|
private Apple2Activity mActivity = null;
|
||||||
|
|
||||||
@ -165,10 +165,8 @@ class Apple2View extends GLSurfaceView {
|
|||||||
|
|
||||||
// Now return the "best" one
|
// Now return the "best" one
|
||||||
EGLConfig best = chooseConfig(egl, display, configs);
|
EGLConfig best = chooseConfig(egl, display, configs);
|
||||||
if (DEBUG) {
|
Log.w(TAG, "Using EGL CONFIG : ");
|
||||||
Log.w(TAG, "BEST CONFIG : ");
|
printConfig(egl, display, best);
|
||||||
printConfig(egl, display, best);
|
|
||||||
}
|
|
||||||
return best;
|
return best;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,12 +324,16 @@ static GLuint _build_program(demoSource *vertexSource, demoSource *fragmentSourc
|
|||||||
// Determine if GLSL version 140 is supported by this context.
|
// Determine if GLSL version 140 is supported by this context.
|
||||||
// We'll use this info to generate a GLSL shader source string
|
// We'll use this info to generate a GLSL shader source string
|
||||||
// with the proper version preprocessor string prepended
|
// with the proper version preprocessor string prepended
|
||||||
float glLanguageVersion;
|
float glLanguageVersion = 0.f;
|
||||||
|
|
||||||
|
char *shaderLangVersion = (char *)glGetString(GL_SHADING_LANGUAGE_VERSION);
|
||||||
|
if (shaderLangVersion == NULL) {
|
||||||
|
ERRQUIT("shader toolchain unavailable");
|
||||||
|
}
|
||||||
#if TARGET_OS_IPHONE
|
#if TARGET_OS_IPHONE
|
||||||
sscanf((char *)glGetString(GL_SHADING_LANGUAGE_VERSION), "OpenGL ES GLSL ES %f", &glLanguageVersion);
|
sscanf(shaderLangVersion, "OpenGL ES GLSL ES %f", &glLanguageVersion);
|
||||||
#else
|
#else
|
||||||
sscanf((char *)glGetString(GL_SHADING_LANGUAGE_VERSION), "%f", &glLanguageVersion);
|
sscanf(shaderLangVersion, "%f", &glLanguageVersion);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// GL_SHADING_LANGUAGE_VERSION returns the version standard version form
|
// GL_SHADING_LANGUAGE_VERSION returns the version standard version form
|
||||||
@ -620,9 +624,7 @@ static void gldriver_update(int unused) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
c_keys_handle_input(-1, 0, 0);
|
c_keys_handle_input(-1, 0, 0);
|
||||||
if (_vid_dirty) {
|
glutPostRedisplay();
|
||||||
glutPostRedisplay();
|
|
||||||
}
|
|
||||||
glutTimerFunc(17, gldriver_update, 0);
|
glutTimerFunc(17, gldriver_update, 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -660,22 +662,25 @@ static void gldriver_render(void) {
|
|||||||
// that we calculated above
|
// that we calculated above
|
||||||
glUniformMatrix4fv(uniformMVPIdx, 1, GL_FALSE, mvp);
|
glUniformMatrix4fv(uniformMVPIdx, 1, GL_FALSE, mvp);
|
||||||
|
|
||||||
// Update texture from indexed-color Apple //e internal framebuffer
|
|
||||||
unsigned int count = SCANWIDTH * SCANHEIGHT;
|
|
||||||
char pixels[SCANWIDTH * SCANHEIGHT * 4];
|
char pixels[SCANWIDTH * SCANHEIGHT * 4];
|
||||||
for (unsigned int i=0, j=0; i<count; i++, j+=4) {
|
if (_vid_dirty) {
|
||||||
uint8_t index = *(fb + i);
|
// Update texture from indexed-color Apple //e internal framebuffer
|
||||||
*( (uint32_t*)(pixels + j) ) = (uint32_t)(
|
unsigned int count = SCANWIDTH * SCANHEIGHT;
|
||||||
((uint32_t)(colormap[index].red) << 0 ) |
|
for (unsigned int i=0, j=0; i<count; i++, j+=4) {
|
||||||
((uint32_t)(colormap[index].green) << 8 ) |
|
uint8_t index = *(fb + i);
|
||||||
((uint32_t)(colormap[index].blue) << 16) |
|
*( (uint32_t*)(pixels + j) ) = (uint32_t)(
|
||||||
((uint32_t)0xff << 24)
|
((uint32_t)(colormap[index].red) << 0 ) |
|
||||||
);
|
((uint32_t)(colormap[index].green) << 8 ) |
|
||||||
|
((uint32_t)(colormap[index].blue) << 16) |
|
||||||
|
((uint32_t)0xff << 24)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, a2TextureName);
|
glBindTexture(GL_TEXTURE_2D, a2TextureName);
|
||||||
glTexImage2D(GL_TEXTURE_2D, /*level*/0, /*internal format*/GL_RGBA, SCANWIDTH, SCANHEIGHT, /*border*/0, /*format*/GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid *)&pixels[0]);
|
if (_vid_dirty) {
|
||||||
glGetError();
|
glTexImage2D(GL_TEXTURE_2D, /*level*/0, /*internal format*/GL_RGBA, SCANWIDTH, SCANHEIGHT, /*border*/0, /*format*/GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid *)&pixels[0]);
|
||||||
|
}
|
||||||
|
|
||||||
// Bind our vertex array object
|
// Bind our vertex array object
|
||||||
#if USE_VAO
|
#if USE_VAO
|
||||||
|
Loading…
x
Reference in New Issue
Block a user