Skip to content

Commit

Permalink
macos try
Browse files Browse the repository at this point in the history
  • Loading branch information
wasabia committed Jan 2, 2022
1 parent 4664ee2 commit 7870fda
Show file tree
Hide file tree
Showing 44 changed files with 22,637 additions and 22 deletions.
19 changes: 13 additions & 6 deletions flutter_gl/example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.8.1"
version: "2.8.2"
boolean_selector:
dependency: transitive
description:
Expand All @@ -21,7 +21,7 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.2.0"
charcode:
dependency: transitive
description:
Expand Down Expand Up @@ -155,7 +155,14 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.10"
version: "0.12.11"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.2"
meta:
dependency: transitive
description:
Expand Down Expand Up @@ -279,7 +286,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.2"
version: "0.4.8"
typed_data:
dependency: transitive
description:
Expand Down Expand Up @@ -307,7 +314,7 @@ packages:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
version: "2.1.1"
win32:
dependency: transitive
description:
Expand All @@ -323,5 +330,5 @@ packages:
source: hosted
version: "0.2.0"
sdks:
dart: ">=2.13.0 <3.0.0"
dart: ">=2.14.0 <3.0.0"
flutter: ">=1.20.0"
39 changes: 23 additions & 16 deletions flutter_gl/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.6.1"
version: "2.8.2"
boolean_selector:
dependency: transitive
description:
Expand All @@ -21,14 +21,14 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.2.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.3.1"
clock:
dependency: transitive
description:
Expand Down Expand Up @@ -79,17 +79,17 @@ packages:
flutter_gl_platform_interface:
dependency: "direct main"
description:
path: "../flutter_gl_platform_interface"
relative: true
source: path
version: "0.0.1"
name: flutter_gl_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.2"
flutter_gl_web:
dependency: "direct main"
description:
path: "../flutter_gl_web"
relative: true
source: path
version: "0.0.1"
name: flutter_gl_web
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.2"
flutter_test:
dependency: "direct dev"
description: flutter
Expand Down Expand Up @@ -134,14 +134,21 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.10"
version: "0.12.11"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.2"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.7.0"
path:
dependency: transitive
description:
Expand Down Expand Up @@ -209,7 +216,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.0"
version: "0.4.8"
typed_data:
dependency: transitive
description:
Expand Down Expand Up @@ -237,7 +244,7 @@ packages:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
version: "2.1.1"
sdks:
dart: ">=2.12.0 <3.0.0"
dart: ">=2.14.0 <3.0.0"
flutter: ">=1.20.0"
29 changes: 29 additions & 0 deletions flutter_gl_macos/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
/pubspec.lock
**/doc/api/
.dart_tool/
.packages
build/
10 changes: 10 additions & 0 deletions flutter_gl_macos/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: 8f1f9c10f04b8f106d78275e93ceead8ea837d8b
channel: beta

project_type: plugin
3 changes: 3 additions & 0 deletions flutter_gl_macos/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.0.1

* TODO: Describe initial release.
1 change: 1 addition & 0 deletions flutter_gl_macos/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO: Add your license here.
15 changes: 15 additions & 0 deletions flutter_gl_macos/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# flutter_gl_macos

A new flutter plugin project.

## Getting Started

This project is a starting point for a Flutter
[plug-in package](https://flutter.dev/developing-packages/),
a specialized package that includes platform-specific implementation code for
Android and/or iOS.

For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.

4 changes: 4 additions & 0 deletions flutter_gl_macos/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include: package:flutter_lints/flutter.yaml

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
69 changes: 69 additions & 0 deletions flutter_gl_macos/lib/flutter_gl_macos.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@

// class FlutterGlMacos {
// static const MethodChannel _channel = MethodChannel('flutter_gl_macos');

// static Future<String?> get platformVersion async {
// final String? version = await _channel.invokeMethod('getPlatformVersion');
// return version;
// }
// }


import 'dart:async';


import 'package:flutter_gl_macos/openGL/OpenGL.dart';
import 'package:flutter_gl_platform_interface/flutter_gl_platform_interface.dart';



class FlutterGlMacos extends FlutterGlPlatform {
late dynamic openGL;

late List<int> egls;

dynamic get gl => openGL.gl;

// for web
dynamic get element => openGL.element;

FlutterGlMacos() {

}

Future<Map<String, dynamic>> initialize({Map<String, dynamic>? options}) async {
Map<String, dynamic> _options = {};

_options.addAll(options ?? {});

final resp = await FlutterGlPlatform.instance.initialize(options: _options);
textureId = resp["textureId"];

// used for web
_options["divId"] = textureId.toString();
openGL = OpenGL().init(_options);

return resp;
}

prepareContext() async {
egls = await FlutterGlPlatform.instance.getEgl(this.textureId!);

openGL.makeCurrent(egls);
}

Future<List<int>> getEgl(int textureId) async {
var result = List<int>.from(await FlutterGlPlatform.instance.getEgl(textureId));
return result;
}

Future<bool> updateTexture(sourceTexture) {
return FlutterGlPlatform.instance.updateTexture(sourceTexture);
}

dispose() {
return FlutterGlPlatform.instance.dispose();
}


}
23 changes: 23 additions & 0 deletions flutter_gl_macos/lib/openGL/OpenGL-Base.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

class OpenGLBase {


int get defaultFrameBuffer => 0;
int get defaultTexture => 0;
dynamic _gl;

dynamic element;

dynamic get gl => _gl;

OpenGLBase(Map<String, dynamic> options) {}

void initOpenGL(int width, int height, bool bool, List<int> egls) {}

void glFlush() {}

void dispose(){}

void makeCurrent(List<int> egls) {}

}
Loading

0 comments on commit 7870fda

Please sign in to comment.