Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/of.yml
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,33 @@ jobs:
DEVELOPER_DIR: "/Applications/Xcode.app/Contents/Developer"
SDKROOT: "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"

# Dawn / MetalANGLE are optional modules (apothecary latest-modular), not in the
# core libs package: download them and build with each renderer
build-macos-renderers:
runs-on: macos-15
strategy:
fail-fast: false
matrix:
renderer: [DAWN, ANGLE]
steps:
- uses: actions/checkout@v6
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2.23
with:
key: osx-renderer-${{ matrix.renderer }}
- name: Download libs and modules
run: ./scripts/osx/download_libs.sh -t $RELEASE --modules dawn,metalangle
- name: Build backendBenchExample with OF_USE_${{ matrix.renderer }}=1
run: |
set -e
cd examples/gl/backendBenchExample
cp ../../../scripts/templates/osx/Makefile ../../../scripts/templates/osx/config.make .
make -j3 Release OF_USE_${{ matrix.renderer }}=1
ls -d bin/backendBenchExample.app
env:
DEVELOPER_DIR: "/Applications/Xcode.app/Contents/Developer"
SDKROOT: "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
build-android:
runs-on: ubuntu-24.04
Expand Down
39 changes: 39 additions & 0 deletions addons/ofxiOS/src/app/ofAppiOSWindow.mm
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@
#endif
#include "ofxiOSGLKView.h"
#include "ofxiOSEAGLView.h"
#if OF_USE_DAWN
#include "ofWebGPURenderer.h"
#include "ofxiOSDawnView.h"
#elif OF_USE_ANGLE
#include "ofxiOSMGLView.h"
#endif

//----------------------------------------------------------------------------------- instance.
static ofAppiOSWindow * _instance = NULL;
Expand Down Expand Up @@ -106,11 +112,23 @@
settings.setupOrientation = OF_ORIENTATION_DEFAULT;
}
setOrientation(settings.setupOrientation);
#if OF_USE_DAWN
currentRenderer = std::shared_ptr<ofBaseRenderer>(new ofWebGPURenderer(this));
settings.windowControllerType = ofxiOSWindowControllerType::DAWN_KIT;
#elif OF_USE_ANGLE
if(settings.glesVersion >= ESRendererVersion_20) {
currentRenderer = std::shared_ptr<ofBaseRenderer>(new ofGLProgrammableRenderer(this));
} else {
currentRenderer = std::shared_ptr<ofBaseRenderer>(new ofGLRenderer(this));
}
settings.windowControllerType = ofxiOSWindowControllerType::ANGLE_KIT;
#else
if(settings.glesVersion >= ESRendererVersion_20) {
currentRenderer = std::shared_ptr<ofBaseRenderer>(new ofGLProgrammableRenderer(this));
} else {
currentRenderer = std::shared_ptr<ofBaseRenderer>(new ofGLRenderer(this));
}
#endif

hasExited = false;
}
Expand Down Expand Up @@ -170,20 +188,41 @@
glm::vec2 ofAppiOSWindow::getWindowPosition() {
if(settings.windowControllerType == METAL_KIT || settings.windowControllerType == GL_KIT)
return *[[ofxiOSGLKView getInstance] getWindowPosition];
#if OF_USE_DAWN
else if(settings.windowControllerType == DAWN_KIT && [ofxiOSDawnView getInstance])
return *[[ofxiOSDawnView getInstance] getWindowPosition];
#elif OF_USE_ANGLE
else if(settings.windowControllerType == ANGLE_KIT && [ofxiOSMGLViewController getInstance])
return *[[ofxiOSMGLViewController getInstance] getWindowPosition];
#endif
else
return *[[ofxiOSEAGLView getInstance] getWindowPosition];
}

glm::vec2 ofAppiOSWindow::getWindowSize() {
if(settings.windowControllerType == METAL_KIT || settings.windowControllerType == GL_KIT)
return *[[ofxiOSGLKView getInstance] getWindowSize];
#if OF_USE_DAWN
else if(settings.windowControllerType == DAWN_KIT && [ofxiOSDawnView getInstance])
return *[[ofxiOSDawnView getInstance] getWindowSize];
#elif OF_USE_ANGLE
else if(settings.windowControllerType == ANGLE_KIT && [ofxiOSMGLViewController getInstance])
return *[[ofxiOSMGLViewController getInstance] getWindowSize];
#endif
else
return *[[ofxiOSEAGLView getInstance] getWindowSize];
}

glm::vec2 ofAppiOSWindow::getScreenSize() {
if(settings.windowControllerType == METAL_KIT || settings.windowControllerType == GL_KIT)
return *[[ofxiOSGLKView getInstance] getScreenSize];
#if OF_USE_DAWN
else if(settings.windowControllerType == DAWN_KIT && [ofxiOSDawnView getInstance])
return *[[ofxiOSDawnView getInstance] getScreenSize];
#elif OF_USE_ANGLE
else if(settings.windowControllerType == ANGLE_KIT && [ofxiOSMGLViewController getInstance])
return *[[ofxiOSMGLViewController getInstance] getScreenSize];
#endif
else
return *[[ofxiOSEAGLView getInstance] getScreenSize];
}
Expand Down
18 changes: 18 additions & 0 deletions addons/ofxiOS/src/core/ofxiOSAppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@
#include "ofxiOSExtras.h"
#include "ofxiOSAlerts.h"
#include "ofxiOSEAGLView.h"
#if OF_USE_DAWN
#include "ofxiOSDawnView.h"
#elif OF_USE_ANGLE
#include "ofxiOSMGLView.h"
#endif
#include "ofAppiOSWindow.h"
#include "ofAppRunner.h"
#include "ofUtils.h"
Expand Down Expand Up @@ -137,6 +142,15 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application {
if ([appDelegateClassName isEqualToString:@"ofxiOSAppDelegate"]) { // app delegate is not being extended.

switch(ofxiOSGetOFWindow()->getWindowControllerType()) {
#if OF_USE_DAWN
case DAWN_KIT:
self.uiViewController = [[ofxiOSDawnViewController alloc] initWithFrame:frame app:(ofxiOSApp *)ofGetAppPtr()];
break;
#elif OF_USE_ANGLE
case ANGLE_KIT:
self.uiViewController = [[ofxiOSMGLViewController alloc] initWithFrame:frame app:(ofxiOSApp *)ofGetAppPtr()];
break;
#endif
case METAL_KIT:
NSLog(@"No MetalKit yet supported for openFrameworks: Falling back to GLKit");
case GL_KIT:
Expand Down Expand Up @@ -194,11 +208,15 @@ - (void)applicationWillResignActive:(UIApplication *)application {
if(ofxiOSGetOFWindow()->getWindowControllerType() == CORE_ANIMATION)
[ofxiOSGetGLView() stopAnimation];
ofxiOSAlerts.lostFocus();
#if !OF_USE_DAWN
glFinish();
#endif
}

- (void)applicationDidEnterBackground:(UIApplication *)application {
#if !OF_USE_DAWN
glFinish();
#endif
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
Expand Down
28 changes: 28 additions & 0 deletions addons/ofxiOS/src/core/ofxiOSDawnView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#pragma once
#include "ofxiOSConstants.h"
#if defined(TARGET_OF_IOS) && OF_USE_DAWN

#import <UIKit/UIKit.h>
#include "ofConstants.h"
#include <glm/vec2.hpp>

class ofxiOSApp;
class ofAppiOSWindow;

@interface ofxiOSDawnView : UIView
+ (ofxiOSDawnView *)getInstance;
- (instancetype)initWithFrame:(CGRect)frame andApp:(ofxiOSApp *)app;
- (void *)metalLayer;
- (glm::vec2 *)getWindowPosition;
- (glm::vec2 *)getWindowSize;
- (glm::vec2 *)getScreenSize;
- (void)startRender;
- (void)finishRender;
@end

@interface ofxiOSDawnViewController : UIViewController
- (instancetype)initWithFrame:(CGRect)frame app:(ofxiOSApp *)app;
@property (nonatomic, strong) ofxiOSDawnView * dawnView;
@end

#endif
Loading
Loading