diff --git a/JavaApp/src/main/java/net/kdt/pojavlaunch/PLaunchApp.java b/JavaApp/src/main/java/net/kdt/pojavlaunch/PLaunchApp.java index bf0205e0..74943791 100644 --- a/JavaApp/src/main/java/net/kdt/pojavlaunch/PLaunchApp.java +++ b/JavaApp/src/main/java/net/kdt/pojavlaunch/PLaunchApp.java @@ -14,6 +14,7 @@ import net.kdt.pojavlaunch.value.*; public class PLaunchApp { public static JMinecraftVersionList mVersionList; public static void main(String[] args) throws Throwable { + System.setProperty("os.name", "iOS"); System.setProperty("javafx.verbose", "true"); System.setProperty("javafx.platform", "ios"); System.setProperty("glass.platform", "ios"); diff --git a/JavaApp/src/main/java/net/kdt/pojavlaunch/PLaunchJFXApp.java b/JavaApp/src/main/java/net/kdt/pojavlaunch/PLaunchJFXApp.java index e28e4d2a..24df27a8 100644 --- a/JavaApp/src/main/java/net/kdt/pojavlaunch/PLaunchJFXApp.java +++ b/JavaApp/src/main/java/net/kdt/pojavlaunch/PLaunchJFXApp.java @@ -10,11 +10,16 @@ import javafx.stage.Stage; public class PLaunchJFXApp extends Application { public void start(Stage stage) { +/* Circle circ = new Circle(40, 40, 30); Group root = new Group(circ); Scene scene = new Scene(root, 400, 300); stage.setTitle("My JavaFX Application"); stage.setScene(scene); stage.show(); +*/ + System.setProperty("os.name", "Mac OS X"); + + PLaunchApp.launchMinecraft(); } } diff --git a/JavaApp/src/main/java/net/kdt/pojavlaunch/Tools.java b/JavaApp/src/main/java/net/kdt/pojavlaunch/Tools.java index f43c70df..5c8ae782 100644 --- a/JavaApp/src/main/java/net/kdt/pojavlaunch/Tools.java +++ b/JavaApp/src/main/java/net/kdt/pojavlaunch/Tools.java @@ -89,7 +89,7 @@ public final class Tools Class clazz = loader.loadClass(versionInfo.mainClass); Method method = clazz.getMethod("main", String[].class); method.invoke(null, new Object[]{launchArgs}); - + } catch (Throwable th) { throw new RuntimeException(th); } diff --git a/Natives/AppDelegate.h b/Natives/AppDelegate.h index 95d6308c..32f132df 100644 --- a/Natives/AppDelegate.h +++ b/Natives/AppDelegate.h @@ -5,10 +5,12 @@ #import #import +int width_c, height_c; + @interface AppDelegate : UIResponder @property (strong, nonatomic) UIWindow *window; -GLKView* obtainGLKView(); +// GLKView* obtainGLKView(); @end diff --git a/Natives/AppDelegate.m b/Natives/AppDelegate.m index 43d6b50d..944e53b6 100644 --- a/Natives/AppDelegate.m +++ b/Natives/AppDelegate.m @@ -10,7 +10,7 @@ #include "utils.h" -GLKView* mGLKView; +// GLKView* mGLKView; @interface AppDelegate () @@ -19,7 +19,7 @@ GLKView* mGLKView; @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - +/* NSLog(@"Hello from app launch!"); // self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; @@ -38,18 +38,20 @@ GLKView* mGLKView; [self.window makeKeyAndVisible]; [EAGLContext setCurrentContext:context]; - - int width_c = (int) roundf([[UIScreen mainScreen] bounds].size.width); - int height_c = (int) roundf([[UIScreen mainScreen] bounds].size.height); - + mGLKView = view; +*/ + width_c = (int) roundf([[UIScreen mainScreen] bounds].size.width); + height_c = (int) roundf([[UIScreen mainScreen] bounds].size.height); + callback_AppDelegate_didFinishLaunching(width_c, height_c); return YES; } @end - +/* GLKView* obtainGLKView() { return mGLKView; } +*/ \ No newline at end of file diff --git a/Natives/JavaLauncher.c b/Natives/JavaLauncher.c index 2c531b8a..41708ea3 100644 --- a/Natives/JavaLauncher.c +++ b/Natives/JavaLauncher.c @@ -5,7 +5,6 @@ #include #include #include -#include #include #include diff --git a/Natives/egl_bridge.c b/Natives/egl_bridge.c index 2ba02c44..19ab7e9e 100644 --- a/Natives/egl_bridge.c +++ b/Natives/egl_bridge.c @@ -63,11 +63,10 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_GLFW_nativeEglInit(JNIEnv* env, j JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_GLFW_nativeEglMakeCurrent(JNIEnv* env, jclass clazz, jlong window) { debug("ES2Bridge: making current\n"); - jboolean ret = makeCurrentContextShared(CURR_GL_CONTEXT); + jboolean ret = makeCurrentContext(CURR_GL_CONTEXT); if (!ret) { return ret; } - initCurrentContext(); void *libGL = dlopen("libGL.dylib", RTLD_GLOBAL); debug("libGL = %p", libGL); diff --git a/Natives/egl_bridge_ios.h b/Natives/egl_bridge_ios.h index 4c25292c..438d8b7b 100644 --- a/Natives/egl_bridge_ios.h +++ b/Natives/egl_bridge_ios.h @@ -4,8 +4,6 @@ void *createContext(); void *getCurrentContext(); -void *initCurrentContext(); jboolean makeCurrentContext(void *context); -jboolean makeCurrentContextShared(void *context); jboolean clearCurrentContext(); void flushBuffer(); diff --git a/Natives/egl_bridge_ios.m b/Natives/egl_bridge_ios.m index 52d4398d..3db00571 100644 --- a/Natives/egl_bridge_ios.m +++ b/Natives/egl_bridge_ios.m @@ -53,85 +53,9 @@ void *getCurrentContext() { return ptr_to_jlong(ctx); } -GLuint RenderBuffer; -GLuint FrameBuffer; -GLuint DepthBuffer; -int Width, Height; -void *initCurrentContext() { - NSLog(@"Obtaining GLKView"); - GLKView* glkView = obtainGLKView(); - - EAGLContext *ctx = [EAGLContext currentContext]; -/* - NSLog(@"Initializing framebuffer"); - glGenFramebuffers(1, &FrameBuffer); - glGenRenderbuffers(1, &RenderBuffer); - glGenRenderbuffers(1, &DepthBuffer); - - glBindFramebuffer(GL_FRAMEBUFFER, FrameBuffer); - glBindRenderbuffer(GL_RENDERBUFFER, RenderBuffer); - - NSLog(@"Initializing renderbuffer"); - if ([ctx renderbufferStorage:GL_RENDERBUFFER fromDrawable:(CAEAGLLayer*)glkView.layer] == NO) { - NSLog(@"error calling MainContext renderbufferStorage"); - return nil; - } - - glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, RenderBuffer); - - glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &Width); - glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT, &Height); - - glBindRenderbuffer(GL_RENDERBUFFER, DepthBuffer); - glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, Width, Height); - glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, DepthBuffer); - - glFlush(); - - NSLog(@"Checking framebuffer status"); - if(glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) { - NSLog(@"failed to make complete framebuffer object %x", glCheckFramebufferStatus(GL_FRAMEBUFFER)); - return nil; - } - - NSLog(@"Binding framebuffer"); - glBindFramebuffer(GL_FRAMEBUFFER, FrameBuffer); -*/ - return ptr_to_jlong(ctx); -} - -jboolean makeCurrentContextShared(void *context) { - EAGLSharegroup *group = ((__bridge EAGLContext *) context).sharegroup; - if (group == nil) { - NSLog(@"Could not get sharegroup from the main context"); - return JNI_FALSE; - } - - EAGLContext *sharedContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3 sharegroup:group]; - if (sharedContext == nil) { - sharedContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2 sharegroup:group]; - if (sharedContext == nil) { - NSLog(@"Could not create sharedContext"); - return JNI_FALSE; - } - } - - if (makeCurrentContext((__bridge void *) sharedContext) == JNI_FALSE){ - NSLog(@"Could not make current sharedContext"); - return JNI_FALSE; - } - - NSLog(@"Testing"); - glClearColor(0.0f, 0.0f, 0.0f, 0.0f); - glClear(GL_COLOR_BUFFER_BIT); - flushBuffer(); - NSLog(@"glGetError() returns %d", glGetError()); - - return JNI_TRUE; -} - jboolean makeCurrentContext(void *context) { if ([EAGLContext setCurrentContext:(__bridge EAGLContext *)jlong_to_ptr(context)] == YES) { + glViewport(0, 0, width_c, height_c); return JNI_TRUE; }