├── .gitignore
├── .metadata
├── .vscode
├── launch.json
└── settings.json
├── CHANGELOG.md
├── LICENSE
├── README.md
├── android
├── .gitignore
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── settings.gradle
└── src
│ └── main
│ ├── AndroidManifest.xml
│ └── java
│ └── org
│ └── fluttergl
│ └── flutter_web_gl
│ ├── FlutterWebGlPlugin.java
│ └── OpenGLManager.java
├── example
├── .gitignore
├── .metadata
├── README.md
├── android
│ ├── .gitignore
│ ├── app
│ │ ├── build.gradle
│ │ └── src
│ │ │ ├── debug
│ │ │ └── AndroidManifest.xml
│ │ │ ├── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── kotlin
│ │ │ │ └── org
│ │ │ │ │ └── fluttergl
│ │ │ │ │ └── flutter_web_gl_example
│ │ │ │ │ └── MainActivity.kt
│ │ │ └── res
│ │ │ │ ├── drawable-v21
│ │ │ │ └── launch_background.xml
│ │ │ │ ├── drawable
│ │ │ │ └── launch_background.xml
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── values-night
│ │ │ │ └── styles.xml
│ │ │ │ └── values
│ │ │ │ └── styles.xml
│ │ │ └── profile
│ │ │ └── AndroidManifest.xml
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ │ └── wrapper
│ │ │ └── gradle-wrapper.properties
│ ├── settings.gradle
│ └── settings_aar.gradle
├── assets
│ ├── Automatisch beibehalten von Corel
│ │ └── crate.png
│ ├── crate.gif
│ ├── crate.png
│ ├── crate.raw
│ ├── dash.png
│ ├── earth-specular.gif
│ ├── earth.jpg
│ ├── fromImage.raw
│ ├── galvanizedTexture.jpg
│ ├── glass.gif
│ ├── macbook.json
│ ├── mcdole.gif
│ ├── moon.bmp
│ ├── nehe.gif
│ ├── star.gif
│ └── world.json
├── error.txt
├── ios
│ ├── .gitignore
│ ├── Flutter
│ │ ├── AppFrameworkInfo.plist
│ │ ├── Debug.xcconfig
│ │ └── Release.xcconfig
│ ├── Podfile
│ ├── Podfile.lock
│ ├── Runner.xcodeproj
│ │ ├── project.pbxproj
│ │ ├── project.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ └── xcshareddata
│ │ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ │ └── WorkspaceSettings.xcsettings
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ └── Runner.xcscheme
│ ├── Runner.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ └── WorkspaceSettings.xcsettings
│ └── Runner
│ │ ├── AppDelegate.h
│ │ ├── AppDelegate.m
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ ├── Contents.json
│ │ │ ├── Icon-App-1024x1024@1x.png
│ │ │ ├── Icon-App-20x20@1x.png
│ │ │ ├── Icon-App-20x20@2x.png
│ │ │ ├── Icon-App-20x20@3x.png
│ │ │ ├── Icon-App-29x29@1x.png
│ │ │ ├── Icon-App-29x29@2x.png
│ │ │ ├── Icon-App-29x29@3x.png
│ │ │ ├── Icon-App-40x40@1x.png
│ │ │ ├── Icon-App-40x40@2x.png
│ │ │ ├── Icon-App-40x40@3x.png
│ │ │ ├── Icon-App-60x60@2x.png
│ │ │ ├── Icon-App-60x60@3x.png
│ │ │ ├── Icon-App-76x76@1x.png
│ │ │ ├── Icon-App-76x76@2x.png
│ │ │ └── Icon-App-83.5x83.5@2x.png
│ │ └── LaunchImage.imageset
│ │ │ ├── Contents.json
│ │ │ ├── LaunchImage.png
│ │ │ ├── LaunchImage@2x.png
│ │ │ ├── LaunchImage@3x.png
│ │ │ └── README.md
│ │ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ ├── Runner-Bridging-Header.h
│ │ └── main.m
├── lib
│ ├── cube.dart
│ ├── gl_program.dart
│ ├── learn_gl.dart
│ ├── lesson1.dart
│ ├── lesson2.dart
│ ├── lesson3.dart
│ ├── lesson4.dart
│ ├── lesson5.dart
│ ├── lesson6.dart
│ ├── lesson7.dart
│ ├── main.dart
│ ├── main_raw_GLES.dart
│ ├── matrix4.dart
│ ├── pyramid.dart
│ └── renderable.dart
├── log.txt
├── macos
│ ├── .gitignore
│ ├── Classes
│ │ └── FlutterWebGlPlugin.h
│ ├── Flutter
│ │ ├── Flutter-Debug.xcconfig
│ │ ├── Flutter-Release.xcconfig
│ │ └── GeneratedPluginRegistrant.swift
│ ├── Podfile
│ ├── Podfile.lock
│ ├── Runner.xcodeproj
│ │ ├── project.pbxproj
│ │ ├── project.xcworkspace
│ │ │ └── xcshareddata
│ │ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ └── Runner.xcscheme
│ ├── Runner.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ └── WorkspaceSettings.xcsettings
│ └── Runner
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets
│ │ └── AppIcon.appiconset
│ │ │ ├── Contents.json
│ │ │ ├── app_icon_1024.png
│ │ │ ├── app_icon_128.png
│ │ │ ├── app_icon_16.png
│ │ │ ├── app_icon_256.png
│ │ │ ├── app_icon_32.png
│ │ │ ├── app_icon_512.png
│ │ │ └── app_icon_64.png
│ │ ├── Base.lproj
│ │ └── MainMenu.xib
│ │ ├── Configs
│ │ ├── AppInfo.xcconfig
│ │ ├── Debug.xcconfig
│ │ ├── Release.xcconfig
│ │ └── Warnings.xcconfig
│ │ ├── DebugProfile.entitlements
│ │ ├── Info.plist
│ │ ├── MainFlutterWindow.swift
│ │ └── Release.entitlements
├── pubspec.lock
├── pubspec.yaml
├── test
│ └── widget_test.dart
└── windows
│ ├── .gitignore
│ ├── CMakeLists.txt
│ ├── flutter
│ ├── CMakeLists.txt
│ ├── generated_plugin_registrant.cc
│ ├── generated_plugin_registrant.h
│ └── generated_plugins.cmake
│ └── runner
│ ├── CMakeLists.txt
│ ├── Runner.rc
│ ├── flutter_window.cpp
│ ├── flutter_window.h
│ ├── main.cpp
│ ├── resource.h
│ ├── resources
│ └── app_icon.ico
│ ├── run_loop.cpp
│ ├── run_loop.h
│ ├── runner.exe.manifest
│ ├── utils.cpp
│ ├── utils.h
│ ├── win32_window.cpp
│ └── win32_window.h
├── flutter_web_gl.iml
├── ios
├── .gitignore
├── Assets
│ └── .gitkeep
├── Classes
│ ├── FlutterWebGlPlugin.h
│ ├── FlutterWebGlPlugin.m
│ └── SwiftFlutterWebGlPlugin.swift
├── MetalANGLE.framework
│ ├── Headers
│ │ ├── EGL
│ │ │ ├── .clang-format
│ │ │ ├── egl.h
│ │ │ ├── eglext.h
│ │ │ ├── eglext_angle.h
│ │ │ └── eglplatform.h
│ │ ├── GLES
│ │ │ ├── .clang-format
│ │ │ ├── README.md
│ │ │ ├── egl.h
│ │ │ ├── gl.h
│ │ │ ├── glext.h
│ │ │ ├── glext_angle.h
│ │ │ ├── glext_explicit_context_autogen.inc
│ │ │ └── glplatform.h
│ │ ├── GLES2
│ │ │ ├── .clang-format
│ │ │ ├── gl2.h
│ │ │ ├── gl2ext.h
│ │ │ ├── gl2ext_angle.h
│ │ │ ├── gl2ext_explicit_context_autogen.inc
│ │ │ └── gl2platform.h
│ │ ├── GLES3
│ │ │ ├── .clang-format
│ │ │ ├── gl3.h
│ │ │ ├── gl31.h
│ │ │ ├── gl31ext_explicit_context_autogen.inc
│ │ │ ├── gl32.h
│ │ │ ├── gl3ext_explicit_context_autogen.inc
│ │ │ └── gl3platform.h
│ │ ├── KHR
│ │ │ ├── .clang-format
│ │ │ └── khrplatform.h
│ │ ├── MGLContext.h
│ │ ├── MGLKView.h
│ │ ├── MGLKViewController.h
│ │ ├── MGLKit.h
│ │ ├── MGLKitPlatform.h
│ │ ├── MGLLayer.h
│ │ ├── angle_gl.h
│ │ └── export.h
│ ├── Info.plist
│ └── MetalANGLE
└── flutter_web_gl.podspec
├── lib
├── flutter_web_gl.dart
├── lib_egl.dart
└── web_gl.dart
├── macos
├── Classes
│ ├── FlutterWebGlPlugin.h
│ ├── FlutterWebGlPlugin.m
│ └── FlutterWebGlPlugin.swift
├── MetalANGLE.framework
│ ├── Headers
│ ├── MetalANGLE
│ ├── Resources
│ └── Versions
│ │ ├── A
│ │ ├── Headers
│ │ │ ├── EGL
│ │ │ │ ├── .clang-format
│ │ │ │ ├── egl.h
│ │ │ │ ├── eglext.h
│ │ │ │ ├── eglext_angle.h
│ │ │ │ └── eglplatform.h
│ │ │ ├── GLES
│ │ │ │ ├── .clang-format
│ │ │ │ ├── README.md
│ │ │ │ ├── egl.h
│ │ │ │ ├── gl.h
│ │ │ │ ├── glext.h
│ │ │ │ ├── glext_angle.h
│ │ │ │ ├── glext_explicit_context_autogen.inc
│ │ │ │ └── glplatform.h
│ │ │ ├── GLES2
│ │ │ │ ├── .clang-format
│ │ │ │ ├── gl2.h
│ │ │ │ ├── gl2ext.h
│ │ │ │ ├── gl2ext_angle.h
│ │ │ │ ├── gl2ext_explicit_context_autogen.inc
│ │ │ │ └── gl2platform.h
│ │ │ ├── GLES3
│ │ │ │ ├── .clang-format
│ │ │ │ ├── gl3.h
│ │ │ │ ├── gl31.h
│ │ │ │ ├── gl31ext_explicit_context_autogen.inc
│ │ │ │ ├── gl32.h
│ │ │ │ ├── gl3ext_explicit_context_autogen.inc
│ │ │ │ └── gl3platform.h
│ │ │ ├── KHR
│ │ │ │ ├── .clang-format
│ │ │ │ └── khrplatform.h
│ │ │ ├── MGLContext.h
│ │ │ ├── MGLKView.h
│ │ │ ├── MGLKViewController.h
│ │ │ ├── MGLKit.h
│ │ │ ├── MGLKitPlatform.h
│ │ │ ├── MGLLayer.h
│ │ │ ├── angle_gl.h
│ │ │ └── export.h
│ │ ├── MetalANGLE
│ │ └── Resources
│ │ │ └── Info.plist
│ │ └── Current
└── flutter_web_gl.podspec
├── pubspec.lock
├── pubspec.yaml
├── test
└── flutter_web_gl_test.dart
└── windows
├── .gitignore
├── CMakeLists.txt
├── angle
└── x64
│ └── debug
│ ├── libEGL.dll
│ ├── libEGL.dll.lib
│ ├── libGLESv2.dll
│ ├── libGLESv2.dll.lib
│ └── zlib.dll
├── flutter_web_gl_plugin.cpp
└── include
├── Platform.h
├── egl.h
├── eglext.h
├── eglext_angle.h
├── eglplatform.h
├── flutter_web_gl
└── flutter_web_gl_plugin.h
├── gl2ext.h
├── gl32.h
├── gl3platform.h
└── khrplatform.h
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .dart_tool/
3 |
4 | .packages
5 | .pub/
6 | .vs/
7 |
8 | build/
9 | flutter_webgl.code-workspace
10 | .idea/workspace.xml
11 | .idea
12 | macos/Classes/libangle_base_mac.a
13 | macos/Classes/libangle_common_mac.a
14 | macos/Classes/libangle_gl_backend_mac.a
15 | macos/Classes/libangle_image_util_mac.a
16 | macos/Classes/libangle_metal_backend_mac.a
17 | macos/Classes/libangle_util_mac.a
18 | macos/Classes/libglslang_mac.a
19 | macos/Classes/libspirv-cross_mac.a
20 |
--------------------------------------------------------------------------------
/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled and should not be manually edited.
5 |
6 | version:
7 | revision: 29e604e2418c71e6784e15ba4132c200d92be9e9
8 | channel: master
9 |
10 | project_type: plugin
11 |
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // Use IntelliSense to learn about possible attributes.
3 | // Hover to view descriptions of existing attributes.
4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 | "version": "0.2.0",
6 | "configurations": [
7 | {
8 | "name": "flutter_web_gl",
9 | "request": "launch",
10 | "type": "dart"
11 | },
12 | {
13 | "name": "example",
14 | "cwd": "example",
15 | "request": "launch",
16 | "type": "dart"
17 | }
18 | ]
19 | }
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "spellright.language": [
3 | "en"
4 | ],
5 | "spellright.documentTypes": [
6 | "markdown",
7 | "latex"
8 | ],
9 | "files.associations": {
10 | "memory": "cpp"
11 | }
12 | }
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## [0.0.1-nullsafety.0] - 11.02.2021
2 |
3 | * Initial release.
4 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT.
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # FlutterWebGL [][Pub]
2 |
3 | So far there is no way to render 3D objects efficiently in Flutter. Also directly accessing and programming the GPU from Dart isn't supported yet. This plugin shall close this gap.
4 |
5 | Originally @kentcb and I were working on a wrapper for OpenGL for a project for the company Aaronia. Although we got pretty far with that one looking at the fact the Apple deprecated OpenGL I wondered if this still is the right approach.
6 |
7 | Luckily Simon made me aware that there is the *Angle* project from Google that implements an OpenGL ES API for all platforms that don't support them
8 |
9 | This project will solve two goals:
10 |
11 | * Offer a low-level Dart FFI layer to render into a Flutter Texture Widget with the OpenGL ES 3.0 API
12 | * Realise a Dart Version of the WebGL interface which covers most of the functionality of OpenGL ES, but without the hassle to deal with FFI NativeTypes and proper error handling.
13 |
14 | On top of that other packages can build easier to use 3D APIs, e.g. there is a Dart port of the JS 3D framework *three.js*
15 |
16 | ## How does this work:
17 |
18 | Flutter has a `Texture` widget which is a placeholder for graphic content that is rendered onto a native Texture object. This works by creating a Texture object in the native part of this plugin and registering this texture with the Flutter Engine. The Engine returns an id which can then be used in Texture widgets in Flutter.
19 | Flutter will then display the current content of that texture. If the content of this texture was changed by native code we have to inform the Flutter Engine, so that it can update the linked Texture Widgets.
20 |
21 | This plugin uses OpenGL ES to render to that native textures. Because of the way OpenGL works we can access the OpenGL "render buffer object" (RBO) from the native part of the plugin as well over the Dart-FFI bindings to the OpenGL ES API so that we can write all rendering code (with the exception of Shaders) in Dart.
22 |
23 | To use this you have to do:
24 |
25 | 1. Call `FlutterWebGL.initOpenGL()` which will setup all the needed infrastructure on the Dart and native side of the plugin
26 | 2. Create a Texture with `FlutterWebGL.createTexture` which will return you the textureID to use it in the TextureWidget
27 | 3. Activate the Texture to access it with OpenGL commands (this part isn't done yet, so far only one texture is supported).
28 | 4. Render to this texture with OpenGL ES low level or WebGL commands
29 | 5. Inform the Flutter Engine that new content is available on that texture by calling `FlutterWebGL.updateTexture`.
30 |
31 | Check out the example to see how it works.
32 |
33 | So far the handling of rendering is intentionally not connected to any special widget, but kept separate. This will make it possible to update the texture content even from a separate Isolate which opens a lot of possibilities.
34 |
35 | ## Roadmap
36 |
37 | Luckily [Aaronia](https://aaronia.de) supports this project by that I can work part of the time I do for them on this project.
38 |
39 | As there is a lot to do, and it needs knowledge of the tool chains for the different platforms it would be amazing if you could join this project.
40 |
41 | Currently, I see the following tasks that need to be solved.
42 |
43 | - [ ] Build the Angle Framework for
44 | - [x] Windows
45 | - [ ] Linux,(not necessary until the Flutter Engine supports native Textures on Linux, see [this stale PR](https://github.com/flutter/engine/pull/20714) )
46 | - [ ] MacOS
47 | - [ ] iOS (it seems that the main Angle project hasn't caught up with its fork [metalangle](https://github.com/kakashidinho/metalangle) so we probably should use this one)
48 | - [x] Create a Dart-FFI layer for OpenGL ES 3.0 API and EGL 1.5
49 | - [ ] Implement native plugin parts that register and update the textures
50 | - [x] Windows
51 | - [ ] Android
52 | - [ ] iOS
53 | - [ ] macOS
54 | - [ ] Linux (see above)
55 | - [ ] Web??? I have no idea how, but maybe someone else does :-)
56 | - [ ] Implement WebGL in Dart
57 | - [ ] add a way to render text. My current idea would be to render text using Flutter onto a canvas and pass that down to OpenGL so that it can be used as a texture on Polygons.
58 |
59 | - [ ] design widgets that let you use WebGL without needing to care about Texture allocation and notifying
60 | - [ ] write examples and documentation
61 |
62 |
63 | ## resources
64 | https://chromium.googlesource.com/angle/angle
65 | https://github.com/kakashidinho/metalangle
66 | https://www.khronos.org/registry/OpenGL/specs/es/3.2/es_spec_3.2.pdf
67 | https://www.khronos.org/registry/EGL/specs/eglspec.1.5.pdf
68 |
69 | https://learnopengl.com/Getting-started/Hello-Triangle
70 |
71 | [Pub]: https://pub.dev/packages/flutter_web_gl
72 |
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | group 'org.fluttergl.flutter_web_gl'
2 | version '1.0'
3 |
4 | buildscript {
5 | repositories {
6 | google()
7 | jcenter()
8 | }
9 |
10 | dependencies {
11 | classpath 'com.android.tools.build:gradle:4.1.0'
12 | }
13 | }
14 |
15 | rootProject.allprojects {
16 | repositories {
17 | google()
18 | jcenter()
19 | }
20 | }
21 |
22 | apply plugin: 'com.android.library'
23 |
24 | android {
25 | compileSdkVersion 30
26 |
27 | defaultConfig {
28 | minSdkVersion 27
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
6 |
--------------------------------------------------------------------------------
/android/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'flutter_web_gl'
2 |
--------------------------------------------------------------------------------
/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/example/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 |
12 | # IntelliJ related
13 | *.iml
14 | *.ipr
15 | *.iws
16 | .idea/
17 |
18 | # The .vscode folder contains launch configuration and tasks you configure in
19 | # VS Code which you may wish to be included in version control, so this line
20 | # is commented out by default.
21 | #.vscode/
22 |
23 | # Flutter/Dart/Pub related
24 | **/doc/api/
25 | **/ios/Flutter/.last_build_id
26 | .dart_tool/
27 | .flutter-plugins
28 | .flutter-plugins-dependencies
29 | .packages
30 | .pub-cache/
31 | .pub/
32 | /build/
33 | /.idea/
34 |
35 | # Web related
36 | lib/generated_plugin_registrant.dart
37 |
38 | # Symbolication related
39 | app.*.symbols
40 |
41 | # Obfuscation related
42 | app.*.map.json
43 |
44 | # Android Studio will place build artifacts here
45 | /android/app/debug
46 | /android/app/profile
47 | /android/app/release
48 |
--------------------------------------------------------------------------------
/example/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled and should not be manually edited.
5 |
6 | version:
7 | revision: 29e604e2418c71e6784e15ba4132c200d92be9e9
8 | channel: master
9 |
10 | project_type: app
11 |
--------------------------------------------------------------------------------
/example/README.md:
--------------------------------------------------------------------------------
1 | # flutter_web_gl_example
2 |
3 | Demonstrates how to use the flutter_web_gl plugin.
4 |
5 | ## Getting Started
6 |
7 | This project is a starting point for a Flutter application.
8 |
9 | A few resources to get you started if this is your first Flutter project:
10 |
11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
13 |
14 | For help getting started with Flutter, view our
15 | [online documentation](https://flutter.dev/docs), which offers tutorials,
16 | samples, guidance on mobile development, and a full API reference.
17 |
--------------------------------------------------------------------------------
/example/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
9 | # Remember to never publicly share your keystore.
10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11 | key.properties
12 |
--------------------------------------------------------------------------------
/example/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | def localProperties = new Properties()
2 | def localPropertiesFile = rootProject.file('local.properties')
3 | if (localPropertiesFile.exists()) {
4 | localPropertiesFile.withReader('UTF-8') { reader ->
5 | localProperties.load(reader)
6 | }
7 | }
8 |
9 | def flutterRoot = localProperties.getProperty('flutter.sdk')
10 | if (flutterRoot == null) {
11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 | }
13 |
14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15 | if (flutterVersionCode == null) {
16 | flutterVersionCode = '1'
17 | }
18 |
19 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
20 | if (flutterVersionName == null) {
21 | flutterVersionName = '1.0'
22 | }
23 |
24 | apply plugin: 'com.android.application'
25 | apply plugin: 'kotlin-android'
26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27 |
28 | android {
29 | compileSdkVersion 30
30 |
31 | sourceSets {
32 | main.java.srcDirs += 'src/main/kotlin'
33 | }
34 |
35 | defaultConfig {
36 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
37 | applicationId "org.fluttergl.flutter_web_gl_example"
38 | minSdkVersion 27
39 | targetSdkVersion 30
40 | versionCode flutterVersionCode.toInteger()
41 | versionName flutterVersionName
42 | }
43 |
44 | buildTypes {
45 | release {
46 | // TODO: Add your own signing config for the release build.
47 | // Signing with the debug keys for now, so `flutter run --release` works.
48 | signingConfig signingConfigs.debug
49 | }
50 | }
51 | }
52 |
53 | flutter {
54 | source '../..'
55 | }
56 |
57 | dependencies {
58 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
59 | }
60 |
--------------------------------------------------------------------------------
/example/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
7 |
8 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/example/android/app/src/main/kotlin/org/fluttergl/flutter_web_gl_example/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package org.fluttergl.flutter_web_gl_example
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-v21/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values-night/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/example/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.3.50'
3 | repositories {
4 | google()
5 | jcenter()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:4.1.0'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | google()
17 | jcenter()
18 | }
19 | }
20 |
21 | rootProject.buildDir = '../build'
22 | subprojects {
23 | project.buildDir = "${rootProject.buildDir}/${project.name}"
24 | }
25 | subprojects {
26 | project.evaluationDependsOn(':app')
27 | }
28 |
29 | task clean(type: Delete) {
30 | delete rootProject.buildDir
31 | }
32 |
--------------------------------------------------------------------------------
/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jun 23 08:50:38 CEST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
7 |
--------------------------------------------------------------------------------
/example/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4 | def properties = new Properties()
5 |
6 | assert localPropertiesFile.exists()
7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
8 |
9 | def flutterSdkPath = properties.getProperty("flutter.sdk")
10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
12 |
--------------------------------------------------------------------------------
/example/android/settings_aar.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/example/assets/Automatisch beibehalten von Corel/crate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/assets/Automatisch beibehalten von Corel/crate.png
--------------------------------------------------------------------------------
/example/assets/crate.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/assets/crate.gif
--------------------------------------------------------------------------------
/example/assets/crate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/assets/crate.png
--------------------------------------------------------------------------------
/example/assets/crate.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/assets/crate.raw
--------------------------------------------------------------------------------
/example/assets/dash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/assets/dash.png
--------------------------------------------------------------------------------
/example/assets/earth-specular.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/assets/earth-specular.gif
--------------------------------------------------------------------------------
/example/assets/earth.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/assets/earth.jpg
--------------------------------------------------------------------------------
/example/assets/fromImage.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/assets/fromImage.raw
--------------------------------------------------------------------------------
/example/assets/galvanizedTexture.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/assets/galvanizedTexture.jpg
--------------------------------------------------------------------------------
/example/assets/glass.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/assets/glass.gif
--------------------------------------------------------------------------------
/example/assets/mcdole.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/assets/mcdole.gif
--------------------------------------------------------------------------------
/example/assets/moon.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/assets/moon.bmp
--------------------------------------------------------------------------------
/example/assets/nehe.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/assets/nehe.gif
--------------------------------------------------------------------------------
/example/assets/star.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/assets/star.gif
--------------------------------------------------------------------------------
/example/assets/world.json:
--------------------------------------------------------------------------------
1 | {
2 | "vertexPositions": [-3.0, 0.0, -3.0, -3.0, 0.0, 3.0, 3.0, 0.0, 3.0, -3.0, 0.0, -3.0, 3.0, 0.0, -3.0, 3.0, 0.0, 3.0, -3.0, 1.0, -3.0, -3.0, 1.0, 3.0, 3.0, 1.0, 3.0, -3.0, 1.0, -3.0, 3.0, 1.0, -3.0, 3.0, 1.0, 3.0, -2.0, 1.0, -2.0, -2.0, 0.0, -2.0, -0.5, 0.0, -2.0, -2.0, 1.0, -2.0, -0.5, 1.0, -2.0, -0.5, 0.0, -2.0, 2.0, 1.0, -2.0, 2.0, 0.0, -2.0, 0.5, 0.0, -2.0, 2.0, 1.0, -2.0, 0.5, 1.0, -2.0, 0.5, 0.0, -2.0, -2.0, 1.0, 2.0, -2.0, 0.0, 2.0, -0.5, 0.0, 2.0, -2.0, 1.0, 2.0, -0.5, 1.0, 2.0, -0.5, 0.0, 2.0, 2.0, 1.0, 2.0, 2.0, 0.0, 2.0, 0.5, 0.0, 2.0, 2.0, 1.0, 2.0, 0.5, 1.0, 2.0, 0.5, 0.0, 2.0, -2.0, 1.0, -2.0, -2.0, 0.0, -2.0, -2.0, 0.0, -0.5, -2.0, 1.0, -2.0, -2.0, 1.0, -0.5, -2.0, 0.0, -0.5, -2.0, 1.0, 2.0, -2.0, 0.0, 2.0, -2.0, 0.0, 0.5, -2.0, 1.0, 2.0, -2.0, 1.0, 0.5, -2.0, 0.0, 0.5, 2.0, 1.0, -2.0, 2.0, 0.0, -2.0, 2.0, 0.0, -0.5, 2.0, 1.0, -2.0, 2.0, 1.0, -0.5, 2.0, 0.0, -0.5, 2.0, 1.0, 2.0, 2.0, 0.0, 2.0, 2.0, 0.0, 0.5, 2.0, 1.0, 2.0, 2.0, 1.0, 0.5, 2.0, 0.0, 0.5, -0.5, 1.0, -3.0, -0.5, 0.0, -3.0, -0.5, 0.0, -2.0, -0.5, 1.0, -3.0, -0.5, 1.0, -2.0, -0.5, 0.0, -2.0, 0.5, 1.0, -3.0, 0.5, 0.0, -3.0, 0.5, 0.0, -2.0, 0.5, 1.0, -3.0, 0.5, 1.0, -2.0, 0.5, 0.0, -2.0, -0.5, 1.0, 3.0, -0.5, 0.0, 3.0, -0.5, 0.0, 2.0, -0.5, 1.0, 3.0, -0.5, 1.0, 2.0, -0.5, 0.0, 2.0, 0.5, 1.0, 3.0, 0.5, 0.0, 3.0, 0.5, 0.0, 2.0, 0.5, 1.0, 3.0, 0.5, 1.0, 2.0, 0.5, 0.0, 2.0, -3.0, 1.0, 0.5, -3.0, 0.0, 0.5, -2.0, 0.0, 0.5, -3.0, 1.0, 0.5, -2.0, 1.0, 0.5, -2.0, 0.0, 0.5, -3.0, 1.0, -0.5, -3.0, 0.0, -0.5, -2.0, 0.0, -0.5, -3.0, 1.0, -0.5, -2.0, 1.0, -0.5, -2.0, 0.0, -0.5, 3.0, 1.0, 0.5, 3.0, 0.0, 0.5, 2.0, 0.0, 0.5, 3.0, 1.0, 0.5, 2.0, 1.0, 0.5, 2.0, 0.0, 0.5, 3.0, 1.0, -0.5, 3.0, 0.0, -0.5, 2.0, 0.0, -0.5, 3.0, 1.0, -0.5, 2.0, 1.0, -0.5, 2.0, 0.0, -0.5],
3 | "vertexTextureCoords": [0.0, 6.0, 0.0, 0.0, 6.0, 0.0, 0.0, 6.0, 6.0, 6.0, 6.0, 0.0, 0.0, 6.0, 0.0, 0.0, 6.0, 0.0, 0.0, 6.0, 6.0, 6.0, 6.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.5, 0.0, 0.0, 1.0, 1.5, 1.0, 1.5, 0.0, 2.0, 1.0, 2.0, 0.0, 0.5, 0.0, 2.0, 1.0, 0.5, 1.0, 0.5, 0.0, 2.0, 1.0, 2.0, 0.0, 0.5, 0.0, 2.0, 1.0, 0.5, 1.0, 0.5, 0.0, 2.0, 1.0, 2.0, 0.0, 0.5, 0.0, 2.0, 1.0, 0.5, 1.0, 0.5, 0.0, 0.0, 1.0, 0.0, 0.0, 1.5, 0.0, 0.0, 1.0, 1.5, 1.0, 1.5, 0.0, 2.0, 1.0, 2.0, 0.0, 0.5, 0.0, 2.0, 1.0, 0.5, 1.0, 0.5, 0.0, 0.0, 1.0, 0.0, 0.0, 1.5, 0.0, 0.0, 1.0, 1.5, 1.0, 1.5, 0.0, 2.0, 1.0, 2.0, 0.0, 0.5, 0.0, 2.0, 1.0, 0.5, 1.0, 0.5, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0]
4 | }
5 |
--------------------------------------------------------------------------------
/example/ios/.gitignore:
--------------------------------------------------------------------------------
1 | *.mode1v3
2 | *.mode2v3
3 | *.moved-aside
4 | *.pbxuser
5 | *.perspectivev3
6 | **/*sync/
7 | .sconsign.dblite
8 | .tags*
9 | **/.vagrant/
10 | **/DerivedData/
11 | Icon?
12 | **/Pods/
13 | **/.symlinks/
14 | profile
15 | xcuserdata
16 | **/.generated/
17 | Flutter/App.framework
18 | Flutter/Flutter.framework
19 | Flutter/Flutter.podspec
20 | Flutter/Generated.xcconfig
21 | Flutter/app.flx
22 | Flutter/app.zip
23 | Flutter/flutter_assets/
24 | Flutter/flutter_export_environment.sh
25 | ServiceDefinitions.json
26 | Runner/GeneratedPluginRegistrant.*
27 |
28 | # Exceptions to above rules.
29 | !default.mode1v3
30 | !default.mode2v3
31 | !default.pbxuser
32 | !default.perspectivev3
33 |
--------------------------------------------------------------------------------
/example/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 8.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/ios/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment this line to define a global platform for your project
2 | platform :ios, '11.0'
3 |
4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6 |
7 | project 'Runner', {
8 | 'Debug' => :debug,
9 | 'Profile' => :release,
10 | 'Release' => :release,
11 | }
12 |
13 | def flutter_root
14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15 | unless File.exist?(generated_xcode_build_settings_path)
16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
17 | end
18 |
19 | File.foreach(generated_xcode_build_settings_path) do |line|
20 | matches = line.match(/FLUTTER_ROOT\=(.*)/)
21 | return matches[1].strip if matches
22 | end
23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
24 | end
25 |
26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
27 |
28 | flutter_ios_podfile_setup
29 |
30 | target 'Runner' do
31 | use_frameworks!
32 | use_modular_headers!
33 |
34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
35 | end
36 |
37 | post_install do |installer|
38 | installer.pods_project.targets.each do |target|
39 | flutter_additional_ios_build_settings(target)
40 | end
41 | end
42 |
--------------------------------------------------------------------------------
/example/ios/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - Flutter (1.0.0)
3 | - flutter_web_gl (0.0.1):
4 | - Flutter
5 |
6 | DEPENDENCIES:
7 | - Flutter (from `Flutter`)
8 | - flutter_web_gl (from `.symlinks/plugins/flutter_web_gl/ios`)
9 |
10 | EXTERNAL SOURCES:
11 | Flutter:
12 | :path: Flutter
13 | flutter_web_gl:
14 | :path: ".symlinks/plugins/flutter_web_gl/ios"
15 |
16 | SPEC CHECKSUMS:
17 | Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c
18 | flutter_web_gl: b27dfa00abe22ebc814a74424196d2fbd5490bfc
19 |
20 | PODFILE CHECKSUM: 21b64fbb12492d731c9be90cbe0f2d328bef4b49
21 |
22 | COCOAPODS: 1.10.0
23 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
43 |
44 |
54 |
56 |
62 |
63 |
64 |
65 |
66 |
67 |
73 |
75 |
81 |
82 |
83 |
84 |
86 |
87 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner/AppDelegate.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | @interface AppDelegate : FlutterAppDelegate
5 |
6 | @end
7 |
--------------------------------------------------------------------------------
/example/ios/Runner/AppDelegate.m:
--------------------------------------------------------------------------------
1 | #import "AppDelegate.h"
2 | #import "GeneratedPluginRegistrant.h"
3 |
4 | @implementation AppDelegate
5 |
6 | - (BOOL)application:(UIApplication *)application
7 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
8 | [GeneratedPluginRegistrant registerWithRegistry:self];
9 | // Override point for customization after application launch.
10 | return [super application:application didFinishLaunchingWithOptions:launchOptions];
11 | }
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/example/ios/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import Flutter
3 |
4 | @UIApplicationMain
5 | @objc class AppDelegate: FlutterAppDelegate {
6 | override func application(
7 | _ application: UIApplication,
8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
9 | ) -> Bool {
10 | GeneratedPluginRegistrant.register(with: self)
11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-App-20x20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-App-20x20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-App-29x29@1x.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "Icon-App-29x29@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "29x29",
29 | "idiom" : "iphone",
30 | "filename" : "Icon-App-29x29@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-App-40x40@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "40x40",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-App-40x40@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "Icon-App-60x60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "Icon-App-60x60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "Icon-App-20x20@1x.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "20x20",
65 | "idiom" : "ipad",
66 | "filename" : "Icon-App-20x20@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "Icon-App-29x29@1x.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "29x29",
77 | "idiom" : "ipad",
78 | "filename" : "Icon-App-29x29@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "Icon-App-40x40@1x.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "40x40",
89 | "idiom" : "ipad",
90 | "filename" : "Icon-App-40x40@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "Icon-App-76x76@1x.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "76x76",
101 | "idiom" : "ipad",
102 | "filename" : "Icon-App-76x76@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "83.5x83.5",
107 | "idiom" : "ipad",
108 | "filename" : "Icon-App-83.5x83.5@2x.png",
109 | "scale" : "2x"
110 | },
111 | {
112 | "size" : "1024x1024",
113 | "idiom" : "ios-marketing",
114 | "filename" : "Icon-App-1024x1024@1x.png",
115 | "scale" : "1x"
116 | }
117 | ],
118 | "info" : {
119 | "version" : 1,
120 | "author" : "xcode"
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchImage.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchImage@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "filename" : "LaunchImage@3x.png",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md:
--------------------------------------------------------------------------------
1 | # Launch Screen Assets
2 |
3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory.
4 |
5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
--------------------------------------------------------------------------------
/example/ios/Runner/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/example/ios/Runner/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/example/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | flutter_web_gl_example
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | $(FLUTTER_BUILD_NAME)
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(FLUTTER_BUILD_NUMBER)
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UISupportedInterfaceOrientations
30 |
31 | UIInterfaceOrientationPortrait
32 | UIInterfaceOrientationLandscapeLeft
33 | UIInterfaceOrientationLandscapeRight
34 |
35 | UISupportedInterfaceOrientations~ipad
36 |
37 | UIInterfaceOrientationPortrait
38 | UIInterfaceOrientationPortraitUpsideDown
39 | UIInterfaceOrientationLandscapeLeft
40 | UIInterfaceOrientationLandscapeRight
41 |
42 | UIViewControllerBasedStatusBarAppearance
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/example/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/example/ios/Runner/main.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 | #import "AppDelegate.h"
4 |
5 | int main(int argc, char* argv[]) {
6 | @autoreleasepool {
7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/example/lib/gl_program.dart:
--------------------------------------------------------------------------------
1 | part of 'learn_gl.dart';
2 | // Copyright (c) 2013, John Thomas McDole.
3 | /*
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | /// Create a WebGL [Program], compiling [Shader]s from passed in sources and
18 | /// cache [UniformLocation]s and AttribLocations.
19 | class GlProgram {
20 | Map attributes = new Map();
21 | Map uniforms = new Map();
22 | late Program program;
23 |
24 | late Shader fragShader, vertShader;
25 |
26 | GlProgram(String fragSrc, String vertSrc, List attributeNames, List uniformNames) {
27 | fragShader = gl.createShader(WebGL.FRAGMENT_SHADER);
28 | gl.shaderSource(fragShader, fragSrc);
29 | gl.compileShader(fragShader);
30 |
31 | vertShader = gl.createShader(WebGL.VERTEX_SHADER);
32 | gl.shaderSource(vertShader, vertSrc);
33 | gl.compileShader(vertShader);
34 |
35 | program = gl.createProgram();
36 | gl.attachShader(program, vertShader);
37 | gl.attachShader(program, fragShader);
38 | gl.linkProgram(program);
39 |
40 | for (String attrib in attributeNames) {
41 | int attributeLocation = gl.getAttribLocation(program, attrib);
42 | gl.enableVertexAttribArray(attributeLocation);
43 | gl.checkError(attrib);
44 | attributes[attrib] = attributeLocation;
45 | }
46 | for (String uniform in uniformNames) {
47 | var uniformLocation = gl.getUniformLocation(program, uniform);
48 | gl.checkError(uniform);
49 | uniforms[uniform] = uniformLocation;
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/example/lib/lesson1.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2013, John Thomas McDole.
2 | /*
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 | part of 'learn_gl.dart';
16 |
17 | /// Staticly draw a triangle and a square!
18 | class Lesson1 extends Lesson {
19 | late GlProgram program;
20 |
21 | late Buffer triangleVertexPositionBuffer, squareVertexPositionBuffer;
22 |
23 | Lesson1() {
24 | program = new GlProgram(
25 | '''
26 | #version 300 es
27 | precision mediump float;
28 | out vec4 FragColor;
29 |
30 | void main(void) {
31 | FragColor = vec4(1.0, 1.0, 1.0, 1.0);
32 | }
33 | ''',
34 | '''#version 300 es
35 | in vec3 aVertexPosition;
36 |
37 | uniform mat4 uMVMatrix;
38 | uniform mat4 uPMatrix;
39 |
40 | void main(void) {
41 | gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);
42 | }
43 | ''',
44 | ['aVertexPosition'],
45 | ['uMVMatrix', 'uPMatrix'],
46 | );
47 | gl.useProgram(program.program);
48 |
49 | // calloc and build the two buffers we need to draw a triangle and box.
50 | // createBuffer() asks the WebGL system to calloc some data for us
51 | triangleVertexPositionBuffer = gl.createBuffer();
52 |
53 | // bindBuffer() tells the WebGL system the target of future calls
54 | gl.bindBuffer(WebGL.ARRAY_BUFFER, triangleVertexPositionBuffer);
55 | gl.bufferData(WebGL.ARRAY_BUFFER, new Float32List.fromList([0.0, 1.0, 0.0, -1.0, -1.0, 0.0, 1.0, -1.0, 0.0]),
56 | WebGL.STATIC_DRAW);
57 |
58 | squareVertexPositionBuffer = gl.createBuffer();
59 | gl.bindBuffer(WebGL.ARRAY_BUFFER, squareVertexPositionBuffer);
60 | gl.bufferData(WebGL.ARRAY_BUFFER,
61 | new Float32List.fromList([1.0, 1.0, 0.0, -1.0, 1.0, 0.0, 1.0, -1.0, 0.0, -1.0, -1.0, 0.0]), WebGL.STATIC_DRAW);
62 |
63 | // Specify the color to clear with (black with 100% alpha) and then enable
64 | // depth testing.
65 | gl.clearColor(0.0, 0.0, 0.0, 1.0);
66 | }
67 |
68 | void drawScene(int viewWidth, int viewHeight, double aspect) {
69 | // Basic viewport setup and clearing of the screen
70 | // gl.viewport(0, 0, viewWidth, viewHeight);
71 | gl.clear(WebGL.COLOR_BUFFER_BIT | WebGL.DEPTH_BUFFER_BIT);
72 | gl.enable(WebGL.DEPTH_TEST);
73 | gl.disable(WebGL.BLEND);
74 |
75 | // Setup the perspective - you might be wondering why we do this every
76 | // time, and that will become clear in much later lessons. Just know, you
77 | // are not crazy for thinking of caching this.
78 | pMatrix = Matrix4.perspective(45.0, aspect, 0.1, 100.0);
79 |
80 | // First stash the current model view matrix before we start moving around.
81 | mvPushMatrix();
82 |
83 | mvMatrix.translate([-1.5, 0.0, -7.0]);
84 |
85 | // Here's that bindBuffer() again, as seen in the constructor
86 | gl.bindBuffer(WebGL.ARRAY_BUFFER, triangleVertexPositionBuffer);
87 | // Set the vertex attribute to the size of each individual element (x,y,z)
88 | gl.vertexAttribPointer(program.attributes['aVertexPosition']!, 3, WebGL.FLOAT, false, 0, 0);
89 | setMatrixUniforms();
90 | // Now draw 3 vertices
91 | gl.drawArrays(WebGL.TRIANGLES, 0, 3);
92 |
93 | // Move 3 units to the right
94 | mvMatrix.translate([3.0, 0.0, 0.0]);
95 |
96 | // And get ready to draw the square just like we did the triangle...
97 | gl.bindBuffer(WebGL.ARRAY_BUFFER, squareVertexPositionBuffer);
98 | gl.vertexAttribPointer(program.attributes['aVertexPosition']!, 3, WebGL.FLOAT, false, 0, 0);
99 | setMatrixUniforms();
100 | // Except now draw 2 triangles, re-using the vertices found in the buffer.
101 | gl.drawArrays(WebGL.TRIANGLE_STRIP, 0, 4);
102 |
103 | // Finally, reset the matrix back to what it was before we moved around.
104 | mvPopMatrix();
105 | }
106 |
107 | /// Write the matrix uniforms (model view matrix and perspective matrix) so
108 | /// WebGL knows what to do with them.
109 | setMatrixUniforms() {
110 | gl.uniformMatrix4fv(program.uniforms['uPMatrix']!, false, pMatrix.buf);
111 | gl.uniformMatrix4fv(program.uniforms['uMVMatrix']!, false, mvMatrix.buf);
112 | }
113 |
114 | void animate(num now) {
115 | // We're not animating the scene, but if you want to experiment, here's
116 | // where you get to play around.
117 | }
118 |
119 | void handleKeys() {
120 | // We're not handling keys right now, but if you want to experiment, here's
121 | // where you'd get to play around.
122 | }
123 | }
124 |
--------------------------------------------------------------------------------
/example/lib/lesson4.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2013, John Thomas McDole.
2 | /*
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 | part of 'learn_gl.dart';
16 |
17 | /// Draw a colored triangle and a square, and have them rotate on axis.
18 | /// This lesson is nearly identical to Lesson 2, and we could clean it up...
19 | /// however that's a future lesson.
20 | class Lesson4 extends Lesson {
21 | late GlProgram program;
22 |
23 | Pyramid pyramid = new Pyramid();
24 | Cube cube = new Cube();
25 |
26 | double rPyramid = 0.0, rCube = 0.0;
27 |
28 | Lesson4() {
29 | program = new GlProgram(
30 | '''
31 | #version 300 es
32 | precision mediump float;
33 | out vec4 FragColor;
34 |
35 | in vec4 vColor;
36 |
37 | void main(void) {
38 | FragColor = vColor;
39 | }
40 | ''',
41 | '''
42 | #version 300 es
43 | in vec3 aVertexPosition;
44 | in vec4 aVertexColor;
45 |
46 | uniform mat4 uMVMatrix;
47 | uniform mat4 uPMatrix;
48 |
49 | out vec4 vColor;
50 |
51 | void main(void) {
52 | gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);
53 | vColor = aVertexColor;
54 | }
55 | // ''',
56 | ['aVertexPosition', 'aVertexColor'],
57 | ['uMVMatrix', 'uPMatrix'],
58 | );
59 | gl.useProgram(program.program);
60 |
61 | // Currently this is hardcoded, because well... everything else is textures
62 | // from here out.
63 | cube.addColor(new CubeColor());
64 |
65 | // Specify the color to clear with (black with 100% alpha) and then enable
66 | // depth testing.
67 | gl.clearColor(0.0, 0.0, 0.0, 1.0);
68 | }
69 |
70 | void drawScene(num viewWidth, num viewHeight, double aspect) {
71 | // Basic viewport setup and clearing of the screen
72 | gl.clear(WebGL.COLOR_BUFFER_BIT | WebGL.DEPTH_BUFFER_BIT);
73 |
74 | gl.enable(WebGL.DEPTH_TEST);
75 | gl.disable(WebGL.BLEND);
76 |
77 | // Setup the perspective - you might be wondering why we do this every
78 | // time, and that will become clear in much later lessons. Just know, you
79 | // are not crazy for thinking of caching this.
80 | pMatrix = Matrix4.perspective(45.0, aspect, 0.1, 100.0);
81 |
82 | // First stash the current model view matrix before we start moving around.
83 | mvPushMatrix();
84 |
85 | mvMatrix.translate([-1.5, 0.0, -8.0]);
86 |
87 | // Let the user play around with some directional changes.
88 | mvMatrix.rotateX(radians(x))..rotateY(radians(y));
89 |
90 | mvPushMatrix();
91 | mvMatrix.rotate(radians(rPyramid), [0, 1, 0]);
92 | pyramid.draw(
93 | setUniforms: setMatrixUniforms,
94 | vertex: program.attributes['aVertexPosition'],
95 | color: program.attributes['aVertexColor']);
96 | mvPopMatrix();
97 |
98 | // Move 3 units to the right
99 | mvMatrix.translate([3.0, 0.0, 0.0]);
100 | mvMatrix.rotate(radians(rCube), [1, 1, 1]);
101 | cube.draw(
102 | setUniforms: setMatrixUniforms,
103 | vertex: program.attributes['aVertexPosition'],
104 | color: program.attributes['aVertexColor']);
105 |
106 | // Finally, reset the matrix back to what it was before we moved around.
107 | mvPopMatrix();
108 | }
109 |
110 | /// Write the matrix uniforms (model view matrix and perspective matrix) so
111 | /// WebGL knows what to do with them.
112 | setMatrixUniforms() {
113 | gl.uniformMatrix4fv(program.uniforms['uPMatrix']!, false, pMatrix.buf);
114 | gl.uniformMatrix4fv(program.uniforms['uMVMatrix']!, false, mvMatrix.buf);
115 | }
116 |
117 | /// Every time the browser tells us to draw the scene, animate is called.
118 | /// If there's something being movied, this is where that movement i
119 | /// calculated.
120 | void animate(num now) {
121 | if (lastTime != 0) {
122 | var elapsed = now - lastTime;
123 | rPyramid += (90 * elapsed) / 100.0;
124 | rCube -= (75 * elapsed) / 100.0;
125 | }
126 | lastTime = now;
127 | }
128 |
129 | double x = 0.0, y = 0.0, z = 0.0;
130 | void handleKeys() {
131 | handleDirection(up: () => y -= 1.0, down: () => y += 1.0, left: () => x -= 1.0, right: () => x += 1.0);
132 | }
133 | }
134 |
--------------------------------------------------------------------------------
/example/lib/lesson5.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2013, John Thomas McDole.
2 | /*
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 | part of 'learn_gl.dart';
16 |
17 | /// Introducing Textures!
18 | class Lesson5 extends Lesson {
19 | late GlProgram program;
20 | WebGLTexture? neheTexture;
21 | late Cube cube;
22 |
23 | bool get isLoaded => neheTexture != null;
24 |
25 | Lesson5() {
26 | cube = new Cube();
27 | loadTexture("dash.png", (WebGLTexture texture, Image data) async {
28 | gl.pixelStorei(WebGL.UNPACK_ALIGNMENT, 1);
29 | gl.bindTexture(WebGL.TEXTURE_2D, texture);
30 | await gl.texImage2DfromImage(
31 | WebGL.TEXTURE_2D,
32 | data,
33 | type: WebGL.UNSIGNED_BYTE,
34 | );
35 | gl.texParameteri(
36 | WebGL.TEXTURE_2D,
37 | WebGL.TEXTURE_MAG_FILTER,
38 | WebGL.NEAREST,
39 | );
40 | gl.texParameteri(
41 | WebGL.TEXTURE_2D,
42 | WebGL.TEXTURE_MIN_FILTER,
43 | WebGL.NEAREST,
44 | );
45 | gl.bindTexture(WebGL.TEXTURE_2D, null);
46 | neheTexture = texture;
47 | });
48 |
49 | var attributes = ['aVertexPosition', 'aTextureCoord'];
50 | var uniforms = ['uPMatrix', 'uMVMatrix', 'uSampler'];
51 |
52 | program = new GlProgram(
53 | '''
54 | #version 300 es
55 | precision mediump float;
56 | out vec4 FragColor;
57 |
58 | in vec2 vTextureCoord;
59 |
60 | uniform sampler2D uSampler;
61 |
62 | void main(void) {
63 | FragColor = texture(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));
64 | }
65 | ''',
66 | '''
67 | #version 300 es
68 | in vec3 aVertexPosition;
69 | in vec2 aTextureCoord;
70 |
71 | uniform mat4 uMVMatrix;
72 | uniform mat4 uPMatrix;
73 |
74 | out vec2 vTextureCoord;
75 |
76 | void main(void) {
77 | gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);
78 | vTextureCoord = aTextureCoord;
79 | }
80 | ''',
81 | attributes,
82 | uniforms,
83 | );
84 |
85 | gl.useProgram(program.program);
86 | }
87 |
88 | void drawScene(int viewWidth, int viewHeight, double aspect) {
89 | if (!isLoaded) return;
90 | gl.useProgram(program.program);
91 |
92 | // Basic viewport setup and clearing of the screen
93 | gl.clear(WebGL.COLOR_BUFFER_BIT | WebGL.DEPTH_BUFFER_BIT);
94 | gl.enable(WebGL.DEPTH_TEST);
95 | gl.disable(WebGL.BLEND);
96 |
97 | // Setup the perspective - you might be wondering why we do this every
98 | // time, and that will become clear in much later lessons. Just know, you
99 | // are not crazy for thinking of caching this.
100 | pMatrix = Matrix4.perspective(45.0, aspect, 0.1, 100.0);
101 |
102 | // First stash the current model view matrix before we start moving around.
103 | mvPushMatrix();
104 |
105 | mvMatrix
106 | ..translate([0.0, 0.0, -5.0])
107 | ..rotateX(radians(xRot))
108 | ..rotateY(radians(yRot))
109 | ..rotateZ(radians(zRot));
110 |
111 | gl.activeTexture(WebGL.TEXTURE0);
112 | gl.bindTexture(WebGL.TEXTURE_2D, neheTexture);
113 | gl.uniform1i(uSampler, 0);
114 | cube.draw(
115 | setUniforms: setMatrixUniforms,
116 | vertex: program.attributes['aVertexPosition'],
117 | coord: program.attributes['aTextureCoord']);
118 |
119 | // Finally, reset the matrix back to what it was before we moved around.
120 | mvPopMatrix();
121 | }
122 |
123 | get uPMatrix => program.uniforms["uPMatrix"];
124 | get uMVMatrix => program.uniforms["uMVMatrix"];
125 | get uSampler => program.uniforms["uSampler"];
126 |
127 | void setMatrixUniforms() {
128 | gl.uniformMatrix4fv(uPMatrix, false, pMatrix.buf);
129 | gl.uniformMatrix4fv(uMVMatrix, false, mvMatrix.buf);
130 | }
131 |
132 | double xRot = 0.0, yRot = 0.0, zRot = 0.0;
133 |
134 | void animate(int now) {
135 | if (lastTime != 0) {
136 | var elapsed = now - lastTime;
137 |
138 | xRot += (90 * elapsed) / 100.0;
139 | yRot += (90 * elapsed) / 100.0;
140 | zRot += (90 * elapsed) / 100.0;
141 | }
142 | lastTime = now;
143 | }
144 |
145 | void handleKeys() {
146 | handleDirection(
147 | up: () => yRot -= 0.5,
148 | down: () => yRot += 0.5,
149 | left: () => xRot -= 0.5,
150 | right: () => xRot += 0.5);
151 | }
152 | }
153 |
--------------------------------------------------------------------------------
/example/lib/pyramid.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2013, John Thomas McDole.
2 | /*
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | part of 'learn_gl.dart';
17 |
18 | class Pyramid implements Renderable {
19 | late Buffer positionBuffer, normalBuffer, textureCoordBuffer;
20 | late Buffer colorBuffer;
21 |
22 | Pyramid() {
23 | positionBuffer = gl.createBuffer();
24 | normalBuffer = gl.createBuffer();
25 | textureCoordBuffer = gl.createBuffer();
26 |
27 | gl.bindBuffer(WebGL.ARRAY_BUFFER, positionBuffer);
28 | var vertices = [
29 | // Front face
30 | 0.0, 1.0, 0.0,
31 | -1.0, -1.0, 1.0,
32 | 1.0, -1.0, 1.0,
33 |
34 | // Right face
35 | 0.0, 1.0, 0.0,
36 | 1.0, -1.0, 1.0,
37 | 1.0, -1.0, -1.0,
38 |
39 | // Back face
40 | 0.0, 1.0, 0.0,
41 | 1.0, -1.0, -1.0,
42 | -1.0, -1.0, -1.0,
43 |
44 | // Left face
45 | 0.0, 1.0, 0.0,
46 | -1.0, -1.0, -1.0,
47 | -1.0, -1.0, 1.0,
48 |
49 | // NOTE: Missing the bottom triangles :)
50 | -1.0, -1.0, -1.0,
51 | 1.0, -1.0, -1.0,
52 | 1.0, -1.0, 1.0,
53 | -1.0, -1.0, -1.0,
54 | 1.0, -1.0, 1.0,
55 | -1.0, -1.0, 1.0,
56 | ];
57 | gl.bufferData(
58 | WebGL.ARRAY_BUFFER,
59 | new Float32List.fromList(vertices),
60 | WebGL.STATIC_DRAW,
61 | );
62 |
63 | normalBuffer = gl.createBuffer();
64 | gl.bindBuffer(WebGL.ARRAY_BUFFER, normalBuffer);
65 | var vertexNormals = [
66 | // Front face
67 | 0.0, 0.4472135901451111, 0.8944271802902222,
68 | 0.0, 0.4472135901451111, 0.8944271802902222,
69 | 0.0, 0.4472135901451111, 0.8944271802902222,
70 |
71 | // Right face
72 | 0.8944271802902222, 0.4472135901451111, 0.0,
73 | 0.8944271802902222, 0.4472135901451111, 0.0,
74 | 0.8944271802902222, 0.4472135901451111, 0.0,
75 |
76 | // Back face
77 | 0.0, 0.4472135901451111, -0.8944271802902222,
78 | 0.0, 0.4472135901451111, -0.8944271802902222,
79 | 0.0, 0.4472135901451111, -0.8944271802902222,
80 |
81 | // Left face
82 | -0.8944271802902222, 0.4472135901451111, 0.0,
83 | -0.8944271802902222, 0.4472135901451111, 0.0,
84 | -0.8944271802902222, 0.4472135901451111, 0.0,
85 |
86 | // Bottom face - non-triangle strip
87 | 0.0, -1.0, 0.0,
88 | 0.0, -1.0, 0.0,
89 | 0.0, -1.0, 0.0,
90 | 0.0, -1.0, 0.0,
91 | 0.0, -1.0, 0.0,
92 | 0.0, -1.0, 0.0
93 | ];
94 | gl.bufferData(
95 | WebGL.ARRAY_BUFFER,
96 | new Float32List.fromList(vertexNormals),
97 | WebGL.STATIC_DRAW,
98 | );
99 |
100 | // TODO: Come up with a better way to store color buffer vs texture buffer :)
101 | colorBuffer = gl.createBuffer();
102 | gl.bindBuffer(WebGL.ARRAY_BUFFER, colorBuffer);
103 | var colors = [
104 | // Front face
105 | 1.0, 0.0, 0.0, 1.0,
106 | 0.0, 1.0, 0.0, 1.0,
107 | 0.0, 0.0, 1.0, 1.0,
108 |
109 | // Right face
110 | 1.0, 0.0, 0.0, 1.0,
111 | 0.0, 0.0, 1.0, 1.0,
112 | 0.0, 1.0, 0.0, 1.0,
113 |
114 | // Back face
115 | 1.0, 0.0, 0.0, 1.0,
116 | 0.0, 1.0, 0.0, 1.0,
117 | 0.0, 0.0, 1.0, 1.0,
118 |
119 | // Left face
120 | 1.0, 0.0, 0.0, 1.0,
121 | 0.0, 0.0, 1.0, 1.0,
122 | 0.0, 1.0, 0.0, 1.0,
123 |
124 | // Bottom face
125 | 0.0, 1.0, 0.0, 1.0,
126 | 0.0, 1.0, 0.0, 1.0,
127 | 0.0, 1.0, 0.0, 1.0,
128 | 0.0, 1.0, 0.0, 1.0,
129 | 0.0, 1.0, 0.0, 1.0,
130 | 0.0, 1.0, 0.0, 1.0
131 | ];
132 | gl.bufferData(
133 | WebGL.ARRAY_BUFFER,
134 | new Float32List.fromList(colors),
135 | WebGL.STATIC_DRAW,
136 | );
137 |
138 | // Normal discovery from a list triangles
139 | // for (int i = 0; i < vertices.length; i += 9 ) {
140 | // Vector3 p0 = new Vector3(vertices[i], vertices[i+1], vertices[i+2]),
141 | // p1 = new Vector3(vertices[i+3], vertices[i+4], vertices[i+5]),
142 | // p2 = new Vector3(vertices[i+6], vertices[i+7], vertices[i+8]);
143 | //
144 | // Vector3 v0 = p1 - p0, v1 = p2 - p0;
145 | // Vector3 normal = v0.cross(v1).normalize();
146 | // print("normal = $normal");
147 | // }
148 | }
149 |
150 | void draw({int? vertex, int? normal, int? coord, int? color, void Function()? setUniforms}) {
151 | if (vertex != null) {
152 | gl.bindBuffer(WebGL.ARRAY_BUFFER, positionBuffer);
153 | gl.vertexAttribPointer(vertex, 3, WebGL.FLOAT, false, 0, 0);
154 | }
155 |
156 | if (normal != null) {
157 | gl.bindBuffer(WebGL.ARRAY_BUFFER, normalBuffer);
158 | gl.vertexAttribPointer(normal, 3, WebGL.FLOAT, false, 0, 0);
159 | }
160 |
161 | if (coord != null) {
162 | gl.bindBuffer(WebGL.ARRAY_BUFFER, textureCoordBuffer);
163 | gl.vertexAttribPointer(coord, 2, WebGL.FLOAT, false, 0, 0);
164 | }
165 |
166 | if (color != null) {
167 | gl.bindBuffer(WebGL.ARRAY_BUFFER, colorBuffer);
168 | gl.vertexAttribPointer(color, 4, WebGL.FLOAT, false, 0, 0);
169 | }
170 |
171 | if (setUniforms != null) setUniforms();
172 | gl.drawArrays(WebGL.TRIANGLES, 0, 18);
173 | }
174 | }
175 |
--------------------------------------------------------------------------------
/example/lib/renderable.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2013, John Thomas McDole.
2 | /*
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 | part of 'learn_gl.dart';
16 |
17 | abstract class Renderable {
18 | void draw({int vertex, int normal, int coord, setUniforms()});
19 | }
20 |
--------------------------------------------------------------------------------
/example/log.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/log.txt
--------------------------------------------------------------------------------
/example/macos/.gitignore:
--------------------------------------------------------------------------------
1 | # Flutter-related
2 | **/Flutter/ephemeral/
3 | **/Pods/
4 |
5 | # Xcode-related
6 | **/xcuserdata/
7 |
--------------------------------------------------------------------------------
/example/macos/Classes/FlutterWebGlPlugin.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @interface FlutterWebGlPlugin : NSObject
4 | @end
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/macos/Flutter/Flutter-Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "ephemeral/Flutter-Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/macos/Flutter/Flutter-Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "ephemeral/Flutter-Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/macos/Flutter/GeneratedPluginRegistrant.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | import FlutterMacOS
6 | import Foundation
7 |
8 | import flutter_web_gl
9 |
10 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
11 | FlutterWebGlPlugin.register(with: registry.registrar(forPlugin: "FlutterWebGlPlugin"))
12 | }
13 |
--------------------------------------------------------------------------------
/example/macos/Podfile:
--------------------------------------------------------------------------------
1 | platform :osx, '10.13'
2 |
3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true'
5 |
6 | project 'Runner', {
7 | 'Debug' => :debug,
8 | 'Profile' => :release,
9 | 'Release' => :release,
10 | }
11 |
12 | def flutter_root
13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
14 | unless File.exist?(generated_xcode_build_settings_path)
15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
16 | end
17 |
18 | File.foreach(generated_xcode_build_settings_path) do |line|
19 | matches = line.match(/FLUTTER_ROOT\=(.*)/)
20 | return matches[1].strip if matches
21 | end
22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
23 | end
24 |
25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
26 |
27 | flutter_macos_podfile_setup
28 |
29 | target 'Runner' do
30 | use_frameworks!
31 | use_modular_headers!
32 |
33 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
34 | end
35 |
36 | post_install do |installer|
37 | installer.pods_project.targets.each do |target|
38 | flutter_additional_macos_build_settings(target)
39 | end
40 | end
41 |
--------------------------------------------------------------------------------
/example/macos/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - flutter_web_gl (0.0.1):
3 | - FlutterMacOS
4 | - FlutterMacOS (1.0.0)
5 |
6 | DEPENDENCIES:
7 | - flutter_web_gl (from `Flutter/ephemeral/.symlinks/plugins/flutter_web_gl/macos`)
8 | - FlutterMacOS (from `Flutter/ephemeral`)
9 |
10 | EXTERNAL SOURCES:
11 | flutter_web_gl:
12 | :path: Flutter/ephemeral/.symlinks/plugins/flutter_web_gl/macos
13 | FlutterMacOS:
14 | :path: Flutter/ephemeral
15 |
16 | SPEC CHECKSUMS:
17 | flutter_web_gl: 4d96ed629943403a1e17d118b3f1ca9d3d033821
18 | FlutterMacOS: 57701585bf7de1b3fc2bb61f6378d73bbdea8424
19 |
20 | PODFILE CHECKSUM: a884f6dd3f7494f3892ee6c81feea3a3abbf9153
21 |
22 | COCOAPODS: 1.10.0
23 |
--------------------------------------------------------------------------------
/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
37 |
38 |
39 |
40 |
41 |
42 |
54 |
56 |
62 |
63 |
64 |
65 |
71 |
73 |
79 |
80 |
81 |
82 |
84 |
85 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/example/macos/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/macos/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/macos/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import Cocoa
2 | import FlutterMacOS
3 |
4 | @NSApplicationMain
5 | class AppDelegate: FlutterAppDelegate {
6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
7 | return true
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "16x16",
5 | "idiom" : "mac",
6 | "filename" : "app_icon_16.png",
7 | "scale" : "1x"
8 | },
9 | {
10 | "size" : "16x16",
11 | "idiom" : "mac",
12 | "filename" : "app_icon_32.png",
13 | "scale" : "2x"
14 | },
15 | {
16 | "size" : "32x32",
17 | "idiom" : "mac",
18 | "filename" : "app_icon_32.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "32x32",
23 | "idiom" : "mac",
24 | "filename" : "app_icon_64.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "128x128",
29 | "idiom" : "mac",
30 | "filename" : "app_icon_128.png",
31 | "scale" : "1x"
32 | },
33 | {
34 | "size" : "128x128",
35 | "idiom" : "mac",
36 | "filename" : "app_icon_256.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "256x256",
41 | "idiom" : "mac",
42 | "filename" : "app_icon_256.png",
43 | "scale" : "1x"
44 | },
45 | {
46 | "size" : "256x256",
47 | "idiom" : "mac",
48 | "filename" : "app_icon_512.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "512x512",
53 | "idiom" : "mac",
54 | "filename" : "app_icon_512.png",
55 | "scale" : "1x"
56 | },
57 | {
58 | "size" : "512x512",
59 | "idiom" : "mac",
60 | "filename" : "app_icon_1024.png",
61 | "scale" : "2x"
62 | }
63 | ],
64 | "info" : {
65 | "version" : 1,
66 | "author" : "xcode"
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png
--------------------------------------------------------------------------------
/example/macos/Runner/Configs/AppInfo.xcconfig:
--------------------------------------------------------------------------------
1 | // Application-level settings for the Runner target.
2 | //
3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the
4 | // future. If not, the values below would default to using the project name when this becomes a
5 | // 'flutter create' template.
6 |
7 | // The application's name. By default this is also the title of the Flutter window.
8 | PRODUCT_NAME = example
9 |
10 | // The application's bundle identifier
11 | PRODUCT_BUNDLE_IDENTIFIER = org.fluttergl.example
12 |
13 | // The copyright displayed in application information
14 | PRODUCT_COPYRIGHT = Copyright © 2021 org.fluttergl. All rights reserved.
15 |
--------------------------------------------------------------------------------
/example/macos/Runner/Configs/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "../../Flutter/Flutter-Debug.xcconfig"
2 | #include "Warnings.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/macos/Runner/Configs/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "../../Flutter/Flutter-Release.xcconfig"
2 | #include "Warnings.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/macos/Runner/Configs/Warnings.xcconfig:
--------------------------------------------------------------------------------
1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings
2 | GCC_WARN_UNDECLARED_SELECTOR = YES
3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES
4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE
5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES
6 | CLANG_WARN_PRAGMA_PACK = YES
7 | CLANG_WARN_STRICT_PROTOTYPES = YES
8 | CLANG_WARN_COMMA = YES
9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES
10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES
11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES
12 | GCC_WARN_SHADOW = YES
13 | CLANG_WARN_UNREACHABLE_CODE = YES
14 |
--------------------------------------------------------------------------------
/example/macos/Runner/DebugProfile.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 | com.apple.security.cs.allow-jit
8 |
9 | com.apple.security.network.server
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/example/macos/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIconFile
10 |
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(FLUTTER_BUILD_NAME)
21 | CFBundleVersion
22 | $(FLUTTER_BUILD_NUMBER)
23 | LSMinimumSystemVersion
24 | $(MACOSX_DEPLOYMENT_TARGET)
25 | NSHumanReadableCopyright
26 | $(PRODUCT_COPYRIGHT)
27 | NSMainNibFile
28 | MainMenu
29 | NSPrincipalClass
30 | NSApplication
31 |
32 |
33 |
--------------------------------------------------------------------------------
/example/macos/Runner/MainFlutterWindow.swift:
--------------------------------------------------------------------------------
1 | import Cocoa
2 | import FlutterMacOS
3 |
4 | class MainFlutterWindow: NSWindow {
5 | override func awakeFromNib() {
6 | let flutterViewController = FlutterViewController.init()
7 | let windowFrame = self.frame
8 | self.contentViewController = flutterViewController
9 | self.setFrame(windowFrame, display: true)
10 |
11 | RegisterGeneratedPlugins(registry: flutterViewController)
12 |
13 | super.awakeFromNib()
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/example/macos/Runner/Release.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/pubspec.lock:
--------------------------------------------------------------------------------
1 | # Generated by pub
2 | # See https://dart.dev/tools/pub/glossary#lockfile
3 | packages:
4 | async:
5 | dependency: transitive
6 | description:
7 | name: async
8 | url: "https://pub.dartlang.org"
9 | source: hosted
10 | version: "2.8.2"
11 | boolean_selector:
12 | dependency: transitive
13 | description:
14 | name: boolean_selector
15 | url: "https://pub.dartlang.org"
16 | source: hosted
17 | version: "2.1.0"
18 | characters:
19 | dependency: transitive
20 | description:
21 | name: characters
22 | url: "https://pub.dartlang.org"
23 | source: hosted
24 | version: "1.1.0"
25 | charcode:
26 | dependency: transitive
27 | description:
28 | name: charcode
29 | url: "https://pub.dartlang.org"
30 | source: hosted
31 | version: "1.3.1"
32 | clock:
33 | dependency: transitive
34 | description:
35 | name: clock
36 | url: "https://pub.dartlang.org"
37 | source: hosted
38 | version: "1.1.0"
39 | collection:
40 | dependency: transitive
41 | description:
42 | name: collection
43 | url: "https://pub.dartlang.org"
44 | source: hosted
45 | version: "1.15.0"
46 | cupertino_icons:
47 | dependency: "direct main"
48 | description:
49 | name: cupertino_icons
50 | url: "https://pub.dartlang.org"
51 | source: hosted
52 | version: "1.0.2"
53 | dylib:
54 | dependency: transitive
55 | description:
56 | name: dylib
57 | url: "https://pub.dartlang.org"
58 | source: hosted
59 | version: "0.2.1-nullsafety.0"
60 | fake_async:
61 | dependency: transitive
62 | description:
63 | name: fake_async
64 | url: "https://pub.dartlang.org"
65 | source: hosted
66 | version: "1.2.0"
67 | ffi:
68 | dependency: "direct main"
69 | description:
70 | name: ffi
71 | url: "https://pub.dartlang.org"
72 | source: hosted
73 | version: "1.0.0"
74 | flutter:
75 | dependency: "direct main"
76 | description: flutter
77 | source: sdk
78 | version: "0.0.0"
79 | flutter_test:
80 | dependency: "direct dev"
81 | description: flutter
82 | source: sdk
83 | version: "0.0.0"
84 | flutter_web_gl:
85 | dependency: "direct main"
86 | description:
87 | path: ".."
88 | relative: true
89 | source: path
90 | version: "0.0.1-nullsafety.0"
91 | matcher:
92 | dependency: transitive
93 | description:
94 | name: matcher
95 | url: "https://pub.dartlang.org"
96 | source: hosted
97 | version: "0.12.11"
98 | meta:
99 | dependency: transitive
100 | description:
101 | name: meta
102 | url: "https://pub.dartlang.org"
103 | source: hosted
104 | version: "1.7.0"
105 | opengl_es_bindings:
106 | dependency: transitive
107 | description:
108 | name: opengl_es_bindings
109 | url: "https://pub.dartlang.org"
110 | source: hosted
111 | version: "1.0.0-pre.1"
112 | path:
113 | dependency: transitive
114 | description:
115 | name: path
116 | url: "https://pub.dartlang.org"
117 | source: hosted
118 | version: "1.8.0"
119 | random_color:
120 | dependency: "direct main"
121 | description:
122 | path: "."
123 | ref: HEAD
124 | resolved-ref: "21e84e829a4e1be36c5ef4bd2392ec899c3235e0"
125 | url: "https://github.com/knezzz/RandomColor"
126 | source: git
127 | version: "1.0.6-nullsafety"
128 | sky_engine:
129 | dependency: transitive
130 | description: flutter
131 | source: sdk
132 | version: "0.0.99"
133 | source_span:
134 | dependency: transitive
135 | description:
136 | name: source_span
137 | url: "https://pub.dartlang.org"
138 | source: hosted
139 | version: "1.8.1"
140 | stack_trace:
141 | dependency: transitive
142 | description:
143 | name: stack_trace
144 | url: "https://pub.dartlang.org"
145 | source: hosted
146 | version: "1.10.0"
147 | stream_channel:
148 | dependency: transitive
149 | description:
150 | name: stream_channel
151 | url: "https://pub.dartlang.org"
152 | source: hosted
153 | version: "2.1.0"
154 | string_scanner:
155 | dependency: transitive
156 | description:
157 | name: string_scanner
158 | url: "https://pub.dartlang.org"
159 | source: hosted
160 | version: "1.1.0"
161 | term_glyph:
162 | dependency: transitive
163 | description:
164 | name: term_glyph
165 | url: "https://pub.dartlang.org"
166 | source: hosted
167 | version: "1.2.0"
168 | test_api:
169 | dependency: transitive
170 | description:
171 | name: test_api
172 | url: "https://pub.dartlang.org"
173 | source: hosted
174 | version: "0.4.3"
175 | typed_data:
176 | dependency: transitive
177 | description:
178 | name: typed_data
179 | url: "https://pub.dartlang.org"
180 | source: hosted
181 | version: "1.3.0"
182 | vector_math:
183 | dependency: transitive
184 | description:
185 | name: vector_math
186 | url: "https://pub.dartlang.org"
187 | source: hosted
188 | version: "2.1.0"
189 | sdks:
190 | dart: ">=2.12.0 <3.0.0"
191 | flutter: ">=1.20.0"
192 |
--------------------------------------------------------------------------------
/example/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: flutter_web_gl_example
2 | description: Demonstrates how to use the flutter_web_gl plugin.
3 |
4 | # The following line prevents the package from being accidentally published to
5 | # pub.dev using `pub publish`. This is preferred for private packages.
6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev
7 |
8 | environment:
9 | sdk: ">=2.12.0 <3.0.0"
10 |
11 | dependencies:
12 | ffi: ^1.0.0
13 | random_color:
14 | git: https://github.com/knezzz/RandomColor
15 | flutter:
16 | sdk: flutter
17 |
18 | flutter_web_gl:
19 | # When depending on this package from a real application you should use:
20 | # flutter_web_gl: ^x.y.z
21 | # See https://dart.dev/tools/pub/dependencies#version-constraints
22 | # The example app is bundled with the plugin so we use a path dependency on
23 | # the parent directory to use the current plugin's version.
24 | path: ../
25 |
26 | # The following adds the Cupertino Icons font to your application.
27 | # Use with the CupertinoIcons class for iOS style icons.
28 | cupertino_icons: ^1.0.2
29 |
30 | dev_dependencies:
31 | flutter_test:
32 | sdk: flutter
33 |
34 | # For information on the generic Dart part of this file, see the
35 | # following page: https://dart.dev/tools/pub/pubspec
36 |
37 | # The following section is specific to Flutter.
38 | flutter:
39 |
40 | # The following line ensures that the Material Icons font is
41 | # included with your application, so that you can use the icons in
42 | # the material Icons class.
43 | uses-material-design: true
44 |
45 | # To add assets to your application, add an assets section, like this:
46 | assets:
47 | - assets/
48 |
49 | # An image asset can refer to one or more resolution-specific "variants", see
50 | # https://flutter.dev/assets-and-images/#resolution-aware.
51 |
52 | # For details regarding adding assets from package dependencies, see
53 | # https://flutter.dev/assets-and-images/#from-packages
54 |
55 | # To add custom fonts to your application, add a fonts section here,
56 | # in this "flutter" section. Each entry in this list should have a
57 | # "family" key with the font family name, and a "fonts" key with a
58 | # list giving the asset and other descriptors for the font. For
59 | # example:
60 | # fonts:
61 | # - family: Schyler
62 | # fonts:
63 | # - asset: fonts/Schyler-Regular.ttf
64 | # - asset: fonts/Schyler-Italic.ttf
65 | # style: italic
66 | # - family: Trajan Pro
67 | # fonts:
68 | # - asset: fonts/TrajanPro.ttf
69 | # - asset: fonts/TrajanPro_Bold.ttf
70 | # weight: 700
71 | #
72 | # For details regarding fonts from package dependencies,
73 | # see https://flutter.dev/custom-fonts/#from-packages
74 |
--------------------------------------------------------------------------------
/example/test/widget_test.dart:
--------------------------------------------------------------------------------
1 | // This is a basic Flutter widget test.
2 | //
3 | // To perform an interaction with a widget in your test, use the WidgetTester
4 | // utility that Flutter provides. For example, you can send tap and scroll
5 | // gestures. You can also use WidgetTester to find child widgets in the widget
6 | // tree, read text, and verify that the values of widget properties are correct.
7 |
8 | import 'package:flutter/material.dart';
9 | import 'package:flutter_test/flutter_test.dart';
10 |
11 | import 'package:flutter_web_gl_example/main.dart';
12 |
13 | void main() {
14 | testWidgets('Verify Platform version', (WidgetTester tester) async {
15 | // Build our app and trigger a frame.
16 | await tester.pumpWidget(MyApp());
17 |
18 | // Verify that platform version is retrieved.
19 | // expect(
20 | // find.byWidgetPredicate(
21 | // (Widget widget) => widget is Text &&
22 | // widget.data.startsWith('Running on:'),
23 | // ),
24 | // findsOneWidget,
25 | // );
26 | });
27 | }
28 |
--------------------------------------------------------------------------------
/example/windows/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/ephemeral/
2 |
3 | # Visual Studio user-specific files.
4 | *.suo
5 | *.user
6 | *.userosscache
7 | *.sln.docstates
8 |
9 | # Visual Studio build-related files.
10 | x64/
11 | x86/
12 |
13 | # Visual Studio cache files
14 | # files ending in .cache can be ignored
15 | *.[Cc]ache
16 | # but keep track of directories ending in .cache
17 | !*.[Cc]ache/
18 |
--------------------------------------------------------------------------------
/example/windows/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.15)
2 | project(flutter_web_gl_example LANGUAGES CXX)
3 |
4 | set(BINARY_NAME "flutter_web_gl_example")
5 |
6 | cmake_policy(SET CMP0063 NEW)
7 |
8 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
9 |
10 | # Configure build options.
11 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
12 | if(IS_MULTICONFIG)
13 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release"
14 | CACHE STRING "" FORCE)
15 | else()
16 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
17 | set(CMAKE_BUILD_TYPE "Debug" CACHE
18 | STRING "Flutter build mode" FORCE)
19 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
20 | "Debug" "Profile" "Release")
21 | endif()
22 | endif()
23 |
24 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
25 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
26 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}")
27 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}")
28 |
29 | # Use Unicode for all projects.
30 | add_definitions(-DUNICODE -D_UNICODE)
31 |
32 | # Compilation settings that should be applied to most targets.
33 | function(APPLY_STANDARD_SETTINGS TARGET)
34 | target_compile_features(${TARGET} PUBLIC cxx_std_17)
35 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100")
36 | target_compile_options(${TARGET} PRIVATE /EHsc)
37 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0")
38 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>")
39 | endfunction()
40 |
41 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
42 |
43 | # Flutter library and tool build rules.
44 | add_subdirectory(${FLUTTER_MANAGED_DIR})
45 |
46 | # Application build
47 | add_subdirectory("runner")
48 |
49 | # Generated plugin build rules, which manage building the plugins and adding
50 | # them to the application.
51 | include(flutter/generated_plugins.cmake)
52 |
53 |
54 | # === Installation ===
55 | # Support files are copied into place next to the executable, so that it can
56 | # run in place. This is done instead of making a separate bundle (as on Linux)
57 | # so that building and running from within Visual Studio will work.
58 | set(BUILD_BUNDLE_DIR "$")
59 | # Make the "install" step default, as it's required to run.
60 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1)
61 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
62 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
63 | endif()
64 |
65 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
66 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}")
67 |
68 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
69 | COMPONENT Runtime)
70 |
71 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
72 | COMPONENT Runtime)
73 |
74 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
75 | COMPONENT Runtime)
76 |
77 | if(PLUGIN_BUNDLED_LIBRARIES)
78 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}"
79 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
80 | COMPONENT Runtime)
81 | endif()
82 |
83 | # Fully re-copy the assets directory on each build to avoid having stale files
84 | # from a previous install.
85 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
86 | install(CODE "
87 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
88 | " COMPONENT Runtime)
89 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
90 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
91 |
92 | # Install the AOT library on non-Debug builds only.
93 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
94 | CONFIGURATIONS Profile;Release
95 | COMPONENT Runtime)
96 |
--------------------------------------------------------------------------------
/example/windows/flutter/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.15)
2 |
3 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
4 |
5 | # Configuration provided via flutter tool.
6 | include(${EPHEMERAL_DIR}/generated_config.cmake)
7 |
8 | # TODO: Move the rest of this into files in ephemeral. See
9 | # https://github.com/flutter/flutter/issues/57146.
10 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")
11 |
12 | # === Flutter Library ===
13 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")
14 |
15 | # Published to parent scope for install step.
16 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
17 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
18 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
19 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE)
20 |
21 | list(APPEND FLUTTER_LIBRARY_HEADERS
22 | "flutter_export.h"
23 | "flutter_windows.h"
24 | "flutter_messenger.h"
25 | "flutter_plugin_registrar.h"
26 | "flutter_texture_registrar.h"
27 | )
28 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/")
29 | add_library(flutter INTERFACE)
30 | target_include_directories(flutter INTERFACE
31 | "${EPHEMERAL_DIR}"
32 | )
33 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib")
34 | add_dependencies(flutter flutter_assemble)
35 |
36 | # === Wrapper ===
37 | list(APPEND CPP_WRAPPER_SOURCES_CORE
38 | "core_implementations.cc"
39 | "standard_codec.cc"
40 | )
41 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/")
42 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN
43 | "plugin_registrar.cc"
44 | )
45 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/")
46 | list(APPEND CPP_WRAPPER_SOURCES_APP
47 | "flutter_engine.cc"
48 | "flutter_view_controller.cc"
49 | )
50 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/")
51 |
52 | # Wrapper sources needed for a plugin.
53 | add_library(flutter_wrapper_plugin STATIC
54 | ${CPP_WRAPPER_SOURCES_CORE}
55 | ${CPP_WRAPPER_SOURCES_PLUGIN}
56 | )
57 | apply_standard_settings(flutter_wrapper_plugin)
58 | set_target_properties(flutter_wrapper_plugin PROPERTIES
59 | POSITION_INDEPENDENT_CODE ON)
60 | set_target_properties(flutter_wrapper_plugin PROPERTIES
61 | CXX_VISIBILITY_PRESET hidden)
62 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter)
63 | target_include_directories(flutter_wrapper_plugin PUBLIC
64 | "${WRAPPER_ROOT}/include"
65 | )
66 | add_dependencies(flutter_wrapper_plugin flutter_assemble)
67 |
68 | # Wrapper sources needed for the runner.
69 | add_library(flutter_wrapper_app STATIC
70 | ${CPP_WRAPPER_SOURCES_CORE}
71 | ${CPP_WRAPPER_SOURCES_APP}
72 | )
73 | apply_standard_settings(flutter_wrapper_app)
74 | target_link_libraries(flutter_wrapper_app PUBLIC flutter)
75 | target_include_directories(flutter_wrapper_app PUBLIC
76 | "${WRAPPER_ROOT}/include"
77 | )
78 | add_dependencies(flutter_wrapper_app flutter_assemble)
79 |
80 | # === Flutter tool backend ===
81 | # _phony_ is a non-existent file to force this command to run every time,
82 | # since currently there's no way to get a full input/output list from the
83 | # flutter tool.
84 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_")
85 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE)
86 | add_custom_command(
87 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
88 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN}
89 | ${CPP_WRAPPER_SOURCES_APP}
90 | ${PHONY_OUTPUT}
91 | COMMAND ${CMAKE_COMMAND} -E env
92 | ${FLUTTER_TOOL_ENVIRONMENT}
93 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
94 | windows-x64 $
95 | VERBATIM
96 | )
97 | add_custom_target(flutter_assemble DEPENDS
98 | "${FLUTTER_LIBRARY}"
99 | ${FLUTTER_LIBRARY_HEADERS}
100 | ${CPP_WRAPPER_SOURCES_CORE}
101 | ${CPP_WRAPPER_SOURCES_PLUGIN}
102 | ${CPP_WRAPPER_SOURCES_APP}
103 | )
104 |
--------------------------------------------------------------------------------
/example/windows/flutter/generated_plugin_registrant.cc:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | #include "generated_plugin_registrant.h"
6 |
7 | #include
8 |
9 | void RegisterPlugins(flutter::PluginRegistry* registry) {
10 | FlutterWebGlPluginRegisterWithRegistrar(
11 | registry->GetRegistrarForPlugin("FlutterWebGlPlugin"));
12 | }
13 |
--------------------------------------------------------------------------------
/example/windows/flutter/generated_plugin_registrant.h:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | #ifndef GENERATED_PLUGIN_REGISTRANT_
6 | #define GENERATED_PLUGIN_REGISTRANT_
7 |
8 | #include
9 |
10 | // Registers Flutter plugins.
11 | void RegisterPlugins(flutter::PluginRegistry* registry);
12 |
13 | #endif // GENERATED_PLUGIN_REGISTRANT_
14 |
--------------------------------------------------------------------------------
/example/windows/flutter/generated_plugins.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # Generated file, do not edit.
3 | #
4 |
5 | list(APPEND FLUTTER_PLUGIN_LIST
6 | flutter_web_gl
7 | )
8 |
9 | set(PLUGIN_BUNDLED_LIBRARIES)
10 |
11 | foreach(plugin ${FLUTTER_PLUGIN_LIST})
12 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin})
13 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
14 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $)
15 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
16 | endforeach(plugin)
17 |
--------------------------------------------------------------------------------
/example/windows/runner/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.15)
2 | project(runner LANGUAGES CXX)
3 |
4 | add_executable(${BINARY_NAME} WIN32
5 | "flutter_window.cpp"
6 | "main.cpp"
7 | "run_loop.cpp"
8 | "utils.cpp"
9 | "win32_window.cpp"
10 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
11 | "Runner.rc"
12 | "runner.exe.manifest"
13 | )
14 | apply_standard_settings(${BINARY_NAME})
15 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
16 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)
17 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
18 | add_dependencies(${BINARY_NAME} flutter_assemble)
19 |
--------------------------------------------------------------------------------
/example/windows/runner/Runner.rc:
--------------------------------------------------------------------------------
1 | // Microsoft Visual C++ generated resource script.
2 | //
3 | #pragma code_page(65001)
4 | #include "resource.h"
5 |
6 | #define APSTUDIO_READONLY_SYMBOLS
7 | /////////////////////////////////////////////////////////////////////////////
8 | //
9 | // Generated from the TEXTINCLUDE 2 resource.
10 | //
11 | #include "winres.h"
12 |
13 | /////////////////////////////////////////////////////////////////////////////
14 | #undef APSTUDIO_READONLY_SYMBOLS
15 |
16 | /////////////////////////////////////////////////////////////////////////////
17 | // English (United States) resources
18 |
19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
21 |
22 | #ifdef APSTUDIO_INVOKED
23 | /////////////////////////////////////////////////////////////////////////////
24 | //
25 | // TEXTINCLUDE
26 | //
27 |
28 | 1 TEXTINCLUDE
29 | BEGIN
30 | "resource.h\0"
31 | END
32 |
33 | 2 TEXTINCLUDE
34 | BEGIN
35 | "#include ""winres.h""\r\n"
36 | "\0"
37 | END
38 |
39 | 3 TEXTINCLUDE
40 | BEGIN
41 | "\r\n"
42 | "\0"
43 | END
44 |
45 | #endif // APSTUDIO_INVOKED
46 |
47 |
48 | /////////////////////////////////////////////////////////////////////////////
49 | //
50 | // Icon
51 | //
52 |
53 | // Icon with lowest ID value placed first to ensure application icon
54 | // remains consistent on all systems.
55 | IDI_APP_ICON ICON "resources\\app_icon.ico"
56 |
57 |
58 | /////////////////////////////////////////////////////////////////////////////
59 | //
60 | // Version
61 | //
62 |
63 | #ifdef FLUTTER_BUILD_NUMBER
64 | #define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER
65 | #else
66 | #define VERSION_AS_NUMBER 1,0,0
67 | #endif
68 |
69 | #ifdef FLUTTER_BUILD_NAME
70 | #define VERSION_AS_STRING #FLUTTER_BUILD_NAME
71 | #else
72 | #define VERSION_AS_STRING "1.0.0"
73 | #endif
74 |
75 | VS_VERSION_INFO VERSIONINFO
76 | FILEVERSION VERSION_AS_NUMBER
77 | PRODUCTVERSION VERSION_AS_NUMBER
78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
79 | #ifdef _DEBUG
80 | FILEFLAGS VS_FF_DEBUG
81 | #else
82 | FILEFLAGS 0x0L
83 | #endif
84 | FILEOS VOS__WINDOWS32
85 | FILETYPE VFT_APP
86 | FILESUBTYPE 0x0L
87 | BEGIN
88 | BLOCK "StringFileInfo"
89 | BEGIN
90 | BLOCK "040904e4"
91 | BEGIN
92 | VALUE "CompanyName", "org.fluttergl" "\0"
93 | VALUE "FileDescription", "Demonstrates how to use the flutter_web_gl plugin." "\0"
94 | VALUE "FileVersion", VERSION_AS_STRING "\0"
95 | VALUE "InternalName", "flutter_web_gl_example" "\0"
96 | VALUE "LegalCopyright", "Copyright (C) 2021 org.fluttergl. All rights reserved." "\0"
97 | VALUE "OriginalFilename", "flutter_web_gl_example.exe" "\0"
98 | VALUE "ProductName", "flutter_web_gl_example" "\0"
99 | VALUE "ProductVersion", VERSION_AS_STRING "\0"
100 | END
101 | END
102 | BLOCK "VarFileInfo"
103 | BEGIN
104 | VALUE "Translation", 0x409, 1252
105 | END
106 | END
107 |
108 | #endif // English (United States) resources
109 | /////////////////////////////////////////////////////////////////////////////
110 |
111 |
112 |
113 | #ifndef APSTUDIO_INVOKED
114 | /////////////////////////////////////////////////////////////////////////////
115 | //
116 | // Generated from the TEXTINCLUDE 3 resource.
117 | //
118 |
119 |
120 | /////////////////////////////////////////////////////////////////////////////
121 | #endif // not APSTUDIO_INVOKED
122 |
--------------------------------------------------------------------------------
/example/windows/runner/flutter_window.cpp:
--------------------------------------------------------------------------------
1 | #include "flutter_window.h"
2 |
3 | #include
4 |
5 | #include "flutter/generated_plugin_registrant.h"
6 |
7 | FlutterWindow::FlutterWindow(RunLoop* run_loop,
8 | const flutter::DartProject& project)
9 | : run_loop_(run_loop), project_(project) {}
10 |
11 | FlutterWindow::~FlutterWindow() {}
12 |
13 | bool FlutterWindow::OnCreate() {
14 | if (!Win32Window::OnCreate()) {
15 | return false;
16 | }
17 |
18 | RECT frame = GetClientArea();
19 |
20 | // The size here must match the window dimensions to avoid unnecessary surface
21 | // creation / destruction in the startup path.
22 | flutter_controller_ = std::make_unique(
23 | frame.right - frame.left, frame.bottom - frame.top, project_);
24 | // Ensure that basic setup of the controller was successful.
25 | if (!flutter_controller_->engine() || !flutter_controller_->view()) {
26 | return false;
27 | }
28 | RegisterPlugins(flutter_controller_->engine());
29 | run_loop_->RegisterFlutterInstance(flutter_controller_->engine());
30 | SetChildContent(flutter_controller_->view()->GetNativeWindow());
31 | return true;
32 | }
33 |
34 | void FlutterWindow::OnDestroy() {
35 | if (flutter_controller_) {
36 | run_loop_->UnregisterFlutterInstance(flutter_controller_->engine());
37 | flutter_controller_ = nullptr;
38 | }
39 |
40 | Win32Window::OnDestroy();
41 | }
42 |
43 | LRESULT
44 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message,
45 | WPARAM const wparam,
46 | LPARAM const lparam) noexcept {
47 | // Give Flutter, including plugins, an opporutunity to handle window messages.
48 | if (flutter_controller_) {
49 | std::optional result =
50 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam,
51 | lparam);
52 | if (result) {
53 | return *result;
54 | }
55 | }
56 |
57 | switch (message) {
58 | case WM_FONTCHANGE:
59 | flutter_controller_->engine()->ReloadSystemFonts();
60 | break;
61 | }
62 |
63 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam);
64 | }
65 |
--------------------------------------------------------------------------------
/example/windows/runner/flutter_window.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_FLUTTER_WINDOW_H_
2 | #define RUNNER_FLUTTER_WINDOW_H_
3 |
4 | #include
5 | #include
6 |
7 | #include
8 |
9 | #include "run_loop.h"
10 | #include "win32_window.h"
11 |
12 | // A window that does nothing but host a Flutter view.
13 | class FlutterWindow : public Win32Window {
14 | public:
15 | // Creates a new FlutterWindow driven by the |run_loop|, hosting a
16 | // Flutter view running |project|.
17 | explicit FlutterWindow(RunLoop* run_loop,
18 | const flutter::DartProject& project);
19 | virtual ~FlutterWindow();
20 |
21 | protected:
22 | // Win32Window:
23 | bool OnCreate() override;
24 | void OnDestroy() override;
25 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam,
26 | LPARAM const lparam) noexcept override;
27 |
28 | private:
29 | // The run loop driving events for this window.
30 | RunLoop* run_loop_;
31 |
32 | // The project to run.
33 | flutter::DartProject project_;
34 |
35 | // The Flutter instance hosted by this window.
36 | std::unique_ptr flutter_controller_;
37 | };
38 |
39 | #endif // RUNNER_FLUTTER_WINDOW_H_
40 |
--------------------------------------------------------------------------------
/example/windows/runner/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #include "flutter_window.h"
6 | #include "run_loop.h"
7 | #include "utils.h"
8 |
9 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
10 | _In_ wchar_t *command_line, _In_ int show_command) {
11 | // Attach to console when present (e.g., 'flutter run') or create a
12 | // new console when running with a debugger.
13 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) {
14 | CreateAndAttachConsole();
15 | }
16 |
17 | // Initialize COM, so that it is available for use in the library and/or
18 | // plugins.
19 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
20 |
21 | RunLoop run_loop;
22 |
23 | flutter::DartProject project(L"data");
24 |
25 | std::vector command_line_arguments =
26 | GetCommandLineArguments();
27 |
28 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments));
29 |
30 | FlutterWindow window(&run_loop, project);
31 | Win32Window::Point origin(10, 10);
32 | Win32Window::Size size(1280, 720);
33 | if (!window.CreateAndShow(L"flutter_web_gl_example", origin, size)) {
34 | return EXIT_FAILURE;
35 | }
36 | window.SetQuitOnClose(true);
37 |
38 | run_loop.Run();
39 |
40 | ::CoUninitialize();
41 | return EXIT_SUCCESS;
42 | }
43 |
--------------------------------------------------------------------------------
/example/windows/runner/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by Runner.rc
4 | //
5 | #define IDI_APP_ICON 101
6 |
7 | // Next default values for new objects
8 | //
9 | #ifdef APSTUDIO_INVOKED
10 | #ifndef APSTUDIO_READONLY_SYMBOLS
11 | #define _APS_NEXT_RESOURCE_VALUE 102
12 | #define _APS_NEXT_COMMAND_VALUE 40001
13 | #define _APS_NEXT_CONTROL_VALUE 1001
14 | #define _APS_NEXT_SYMED_VALUE 101
15 | #endif
16 | #endif
17 |
--------------------------------------------------------------------------------
/example/windows/runner/resources/app_icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/example/windows/runner/resources/app_icon.ico
--------------------------------------------------------------------------------
/example/windows/runner/run_loop.cpp:
--------------------------------------------------------------------------------
1 | #include "run_loop.h"
2 |
3 | #include
4 |
5 | #include
6 |
7 | RunLoop::RunLoop() {}
8 |
9 | RunLoop::~RunLoop() {}
10 |
11 | void RunLoop::Run() {
12 | bool keep_running = true;
13 | TimePoint next_flutter_event_time = TimePoint::clock::now();
14 | while (keep_running) {
15 | std::chrono::nanoseconds wait_duration =
16 | std::max(std::chrono::nanoseconds(0),
17 | next_flutter_event_time - TimePoint::clock::now());
18 | ::MsgWaitForMultipleObjects(
19 | 0, nullptr, FALSE, static_cast(wait_duration.count() / 1000),
20 | QS_ALLINPUT);
21 | bool processed_events = false;
22 | MSG message;
23 | // All pending Windows messages must be processed; MsgWaitForMultipleObjects
24 | // won't return again for items left in the queue after PeekMessage.
25 | while (::PeekMessage(&message, nullptr, 0, 0, PM_REMOVE)) {
26 | processed_events = true;
27 | if (message.message == WM_QUIT) {
28 | keep_running = false;
29 | break;
30 | }
31 | ::TranslateMessage(&message);
32 | ::DispatchMessage(&message);
33 | // Allow Flutter to process messages each time a Windows message is
34 | // processed, to prevent starvation.
35 | next_flutter_event_time =
36 | std::min(next_flutter_event_time, ProcessFlutterMessages());
37 | }
38 | // If the PeekMessage loop didn't run, process Flutter messages.
39 | if (!processed_events) {
40 | next_flutter_event_time =
41 | std::min(next_flutter_event_time, ProcessFlutterMessages());
42 | }
43 | }
44 | }
45 |
46 | void RunLoop::RegisterFlutterInstance(
47 | flutter::FlutterEngine* flutter_instance) {
48 | flutter_instances_.insert(flutter_instance);
49 | }
50 |
51 | void RunLoop::UnregisterFlutterInstance(
52 | flutter::FlutterEngine* flutter_instance) {
53 | flutter_instances_.erase(flutter_instance);
54 | }
55 |
56 | RunLoop::TimePoint RunLoop::ProcessFlutterMessages() {
57 | TimePoint next_event_time = TimePoint::max();
58 | for (auto instance : flutter_instances_) {
59 | std::chrono::nanoseconds wait_duration = instance->ProcessMessages();
60 | if (wait_duration != std::chrono::nanoseconds::max()) {
61 | next_event_time =
62 | std::min(next_event_time, TimePoint::clock::now() + wait_duration);
63 | }
64 | }
65 | return next_event_time;
66 | }
67 |
--------------------------------------------------------------------------------
/example/windows/runner/run_loop.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_RUN_LOOP_H_
2 | #define RUNNER_RUN_LOOP_H_
3 |
4 | #include
5 |
6 | #include
7 | #include
8 |
9 | // A runloop that will service events for Flutter instances as well
10 | // as native messages.
11 | class RunLoop {
12 | public:
13 | RunLoop();
14 | ~RunLoop();
15 |
16 | // Prevent copying
17 | RunLoop(RunLoop const&) = delete;
18 | RunLoop& operator=(RunLoop const&) = delete;
19 |
20 | // Runs the run loop until the application quits.
21 | void Run();
22 |
23 | // Registers the given Flutter instance for event servicing.
24 | void RegisterFlutterInstance(
25 | flutter::FlutterEngine* flutter_instance);
26 |
27 | // Unregisters the given Flutter instance from event servicing.
28 | void UnregisterFlutterInstance(
29 | flutter::FlutterEngine* flutter_instance);
30 |
31 | private:
32 | using TimePoint = std::chrono::steady_clock::time_point;
33 |
34 | // Processes all currently pending messages for registered Flutter instances.
35 | TimePoint ProcessFlutterMessages();
36 |
37 | std::set flutter_instances_;
38 | };
39 |
40 | #endif // RUNNER_RUN_LOOP_H_
41 |
--------------------------------------------------------------------------------
/example/windows/runner/runner.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PerMonitorV2
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/example/windows/runner/utils.cpp:
--------------------------------------------------------------------------------
1 | #include "utils.h"
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | #include
9 |
10 | void CreateAndAttachConsole() {
11 | if (::AllocConsole()) {
12 | FILE *unused;
13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
14 | _dup2(_fileno(stdout), 1);
15 | }
16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) {
17 | _dup2(_fileno(stdout), 2);
18 | }
19 | std::ios::sync_with_stdio();
20 | FlutterDesktopResyncOutputStreams();
21 | }
22 | }
23 |
24 | std::vector GetCommandLineArguments() {
25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use.
26 | int argc;
27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc);
28 | if (argv == nullptr) {
29 | return std::vector();
30 | }
31 |
32 | std::vector command_line_arguments;
33 |
34 | // Skip the first argument as it's the binary name.
35 | for (int i = 1; i < argc; i++) {
36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i]));
37 | }
38 |
39 | ::LocalFree(argv);
40 |
41 | return command_line_arguments;
42 | }
43 |
44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) {
45 | if (utf16_string == nullptr) {
46 | return std::string();
47 | }
48 | int target_length = ::WideCharToMultiByte(
49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
50 | -1, nullptr, 0, nullptr, nullptr);
51 | if (target_length == 0) {
52 | return std::string();
53 | }
54 | std::string utf8_string;
55 | utf8_string.resize(target_length);
56 | int converted_length = ::WideCharToMultiByte(
57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
58 | -1, utf8_string.data(),
59 | target_length, nullptr, nullptr);
60 | if (converted_length == 0) {
61 | return std::string();
62 | }
63 | return utf8_string;
64 | }
65 |
--------------------------------------------------------------------------------
/example/windows/runner/utils.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_UTILS_H_
2 | #define RUNNER_UTILS_H_
3 |
4 | #include
5 | #include
6 |
7 | // Creates a console for the process, and redirects stdout and stderr to
8 | // it for both the runner and the Flutter library.
9 | void CreateAndAttachConsole();
10 |
11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string
12 | // encoded in UTF-8. Returns an empty std::string on failure.
13 | std::string Utf8FromUtf16(const wchar_t* utf16_string);
14 |
15 | // Gets the command line arguments passed in as a std::vector,
16 | // encoded in UTF-8. Returns an empty std::vector on failure.
17 | std::vector GetCommandLineArguments();
18 |
19 | #endif // RUNNER_UTILS_H_
20 |
--------------------------------------------------------------------------------
/example/windows/runner/win32_window.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_WIN32_WINDOW_H_
2 | #define RUNNER_WIN32_WINDOW_H_
3 |
4 | #include
5 |
6 | #include
7 | #include
8 | #include
9 |
10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be
11 | // inherited from by classes that wish to specialize with custom
12 | // rendering and input handling
13 | class Win32Window {
14 | public:
15 | struct Point {
16 | unsigned int x;
17 | unsigned int y;
18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {}
19 | };
20 |
21 | struct Size {
22 | unsigned int width;
23 | unsigned int height;
24 | Size(unsigned int width, unsigned int height)
25 | : width(width), height(height) {}
26 | };
27 |
28 | Win32Window();
29 | virtual ~Win32Window();
30 |
31 | // Creates and shows a win32 window with |title| and position and size using
32 | // |origin| and |size|. New windows are created on the default monitor. Window
33 | // sizes are specified to the OS in physical pixels, hence to ensure a
34 | // consistent size to will treat the width height passed in to this function
35 | // as logical pixels and scale to appropriate for the default monitor. Returns
36 | // true if the window was created successfully.
37 | bool CreateAndShow(const std::wstring& title,
38 | const Point& origin,
39 | const Size& size);
40 |
41 | // Release OS resources associated with window.
42 | void Destroy();
43 |
44 | // Inserts |content| into the window tree.
45 | void SetChildContent(HWND content);
46 |
47 | // Returns the backing Window handle to enable clients to set icon and other
48 | // window properties. Returns nullptr if the window has been destroyed.
49 | HWND GetHandle();
50 |
51 | // If true, closing this window will quit the application.
52 | void SetQuitOnClose(bool quit_on_close);
53 |
54 | // Return a RECT representing the bounds of the current client area.
55 | RECT GetClientArea();
56 |
57 | protected:
58 | // Processes and route salient window messages for mouse handling,
59 | // size change and DPI. Delegates handling of these to member overloads that
60 | // inheriting classes can handle.
61 | virtual LRESULT MessageHandler(HWND window,
62 | UINT const message,
63 | WPARAM const wparam,
64 | LPARAM const lparam) noexcept;
65 |
66 | // Called when CreateAndShow is called, allowing subclass window-related
67 | // setup. Subclasses should return false if setup fails.
68 | virtual bool OnCreate();
69 |
70 | // Called when Destroy is called.
71 | virtual void OnDestroy();
72 |
73 | private:
74 | friend class WindowClassRegistrar;
75 |
76 | // OS callback called by message pump. Handles the WM_NCCREATE message which
77 | // is passed when the non-client area is being created and enables automatic
78 | // non-client DPI scaling so that the non-client area automatically
79 | // responsponds to changes in DPI. All other messages are handled by
80 | // MessageHandler.
81 | static LRESULT CALLBACK WndProc(HWND const window,
82 | UINT const message,
83 | WPARAM const wparam,
84 | LPARAM const lparam) noexcept;
85 |
86 | // Retrieves a class instance pointer for |window|
87 | static Win32Window* GetThisFromHandle(HWND const window) noexcept;
88 |
89 | bool quit_on_close_ = false;
90 |
91 | // window handle for top level window.
92 | HWND window_handle_ = nullptr;
93 |
94 | // window handle for hosted content.
95 | HWND child_content_ = nullptr;
96 | };
97 |
98 | #endif // RUNNER_WIN32_WINDOW_H_
99 |
--------------------------------------------------------------------------------
/flutter_web_gl.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/ios/.gitignore:
--------------------------------------------------------------------------------
1 | .idea/
2 | .vagrant/
3 | .sconsign.dblite
4 | .svn/
5 |
6 | .DS_Store
7 | *.swp
8 | profile
9 |
10 | DerivedData/
11 | build/
12 | GeneratedPluginRegistrant.h
13 | GeneratedPluginRegistrant.m
14 |
15 | .generated/
16 |
17 | *.pbxuser
18 | *.mode1v3
19 | *.mode2v3
20 | *.perspectivev3
21 |
22 | !default.pbxuser
23 | !default.mode1v3
24 | !default.mode2v3
25 | !default.perspectivev3
26 |
27 | xcuserdata
28 |
29 | *.moved-aside
30 |
31 | *.pyc
32 | *sync/
33 | Icon?
34 | .tags*
35 |
36 | /Flutter/Generated.xcconfig
37 | /Flutter/flutter_export_environment.sh
--------------------------------------------------------------------------------
/ios/Assets/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/ios/Assets/.gitkeep
--------------------------------------------------------------------------------
/ios/Classes/FlutterWebGlPlugin.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @interface FlutterWebGlPlugin : NSObject
4 | @end
5 |
6 |
7 |
8 | @interface OpenGLException: NSException
9 | - (instancetype) initWithMessage: (NSString*) message andError: (int) error;
10 | @property (nonatomic,assign) GLint errorCode;
11 | @property (nonatomic,assign) NSString* message;
12 | @end
13 |
14 | @interface FlutterGlTexture : NSObject
15 | - (instancetype)initWithWidth:(int) width andHeight:(int)height registerWidth:(NSObject*) registry;
16 | @property (nonatomic,assign) int width;
17 | @property (nonatomic,assign) int height;
18 | @property (nonatomic,assign) GLuint fbo;
19 | @property (nonatomic,assign) GLuint rbo;
20 | @property (nonatomic,assign) int64_t flutterTextureId;
21 | @property (nonatomic) CVPixelBufferRef pixelData;
22 | // Metal -> GL interop texture
23 | @property (nonatomic, readonly) GLuint metalAsGLTexture;
24 |
25 |
26 | @end
27 |
28 |
--------------------------------------------------------------------------------
/ios/Classes/SwiftFlutterWebGlPlugin.swift:
--------------------------------------------------------------------------------
1 | import Flutter
2 | import UIKit
3 |
4 | public class SwiftFlutterWebGlPlugin: NSObject, FlutterPlugin {
5 | public static func register(with registrar: FlutterPluginRegistrar) {
6 | let channel = FlutterMethodChannel(name: "flutter_web_gl", binaryMessenger: registrar.messenger())
7 | let instance = SwiftFlutterWebGlPlugin()
8 | registrar.addMethodCallDelegate(instance, channel: channel)
9 | }
10 |
11 | public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
12 | result("iOS " + UIDevice.current.systemVersion)
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/ios/MetalANGLE.framework/Headers/EGL/.clang-format:
--------------------------------------------------------------------------------
1 |
2 |
3 | DisableFormat: true
4 |
--------------------------------------------------------------------------------
/ios/MetalANGLE.framework/Headers/GLES/.clang-format:
--------------------------------------------------------------------------------
1 |
2 |
3 | DisableFormat: true
4 |
--------------------------------------------------------------------------------
/ios/MetalANGLE.framework/Headers/GLES/README.md:
--------------------------------------------------------------------------------
1 | # ANGLE GLES 1.0 Headers
2 |
3 | The GLES 1.0 headers ANGLE uses are generated using the Khronos tools but modified to include function pointer types and function prototype guards.
4 |
5 | ### Regenerating gl.h
6 |
7 | 1. Install **Python 3** (not 2) with the **lxml** addon. You can do this using `pip install lxml` from your Python's Scripts folder.
8 | 1. Clone [https://github.com/KhronosGroup/OpenGL-Registry.git](https://github.com/KhronosGroup/OpenGL-Registry.git).
9 | 1. Edit `OpenGL-Registry/xml/genheaders.py`:
10 |
11 | 1. Look for the section titled `# GLES 1.x API + mandatory extensions - GLES/gl.h (no function pointers)`
12 | 1. Change `prefixText = prefixStrings + gles1PlatformStrings + genDateCommentString,` to `prefixText = prefixStrings + gles1PlatformStrings + apiEntryPrefixStrings + genDateCommentString,`
13 | 1. Change `genFuncPointers = False,` to `genFuncPointers = True,`
14 | 1. Change `protectProto = False,` to `protectProto = 'nonzero',`
15 | 1. Change `protectProtoStr = 'GL_GLEXT_PROTOTYPES',` to `protectProtoStr = 'GL_GLES_PROTOTYPES',`
16 |
17 | 1. Set your working directory to `OpenGL-Registry/xml/`.
18 | 1. Run `python genheaders.py ../api/GLES/gl.h`
19 | 1. The generated header will now be in `OpenGL-Registry/api/GLES/gl.h`. You can copy the header over to this folder.
20 | 1. Also update `scripts/gl.xml` with the latest version from `OpenGL-Registry/xml/`.
21 |
--------------------------------------------------------------------------------
/ios/MetalANGLE.framework/Headers/GLES/egl.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Copyright (c) 2008-2017 The Khronos Group Inc.
3 | **
4 | ** Licensed under the Apache License, Version 2.0 (the "License");
5 | ** you may not use this file except in compliance with the License.
6 | ** You may obtain a copy of the License at
7 | **
8 | ** http://www.apache.org/licenses/LICENSE-2.0
9 | **
10 | ** Unless required by applicable law or agreed to in writing, software
11 | ** distributed under the License is distributed on an "AS IS" BASIS,
12 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | ** See the License for the specific language governing permissions and
14 | ** limitations under the License.
15 | */
16 |
17 | /*
18 | * Skeleton egl.h to provide compatibility for early GLES 1.0
19 | * applications. Several early implementations included gl.h
20 | * in egl.h leading applications to include only egl.h
21 | */
22 |
23 | #ifndef __legacy_egl_h_
24 | #define __legacy_egl_h_
25 |
26 | #include "../EGL/egl.h"
27 | #include "gl.h"
28 |
29 | #endif /* __legacy_egl_h_ */
30 |
--------------------------------------------------------------------------------
/ios/MetalANGLE.framework/Headers/GLES/glext_angle.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2018 The ANGLE Project Authors. All rights reserved.
3 | // Use of this source code is governed by a BSD-style license that can be
4 | // found in the LICENSE file.
5 | //
6 | // glext_angle.h: ANGLE modifications to the glext.h header file.
7 | // Currently we don't include this file directly, we patch glext.h
8 | // to include it implicitly so it is visible throughout our code.
9 |
10 | #ifndef INCLUDE_GLES_GLEXT_ANGLE_H_
11 | #define INCLUDE_GLES_GLEXT_ANGLE_H_
12 |
13 | // clang-format off
14 |
15 | #ifndef GL_ANGLE_explicit_context_gles1
16 | #define GL_ANGLE_explicit_context_gles1
17 | typedef void *GLeglContext;
18 | #include "glext_explicit_context_autogen.inc"
19 | #endif /* GL_ANGLE_explicit_context_gles1 */
20 |
21 | // clang-format on
22 |
23 | #endif // INCLUDE_GLES_GLEXT_ANGLE_H_
24 |
--------------------------------------------------------------------------------
/ios/MetalANGLE.framework/Headers/GLES/glplatform.h:
--------------------------------------------------------------------------------
1 | #ifndef __glplatform_h_
2 | #define __glplatform_h_
3 |
4 | /*
5 | ** Copyright (c) 2017 The Khronos Group Inc.
6 | **
7 | ** Licensed under the Apache License, Version 2.0 (the "License");
8 | ** you may not use this file except in compliance with the License.
9 | ** You may obtain a copy of the License at
10 | **
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | **
13 | ** Unless required by applicable law or agreed to in writing, software
14 | ** distributed under the License is distributed on an "AS IS" BASIS,
15 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | ** See the License for the specific language governing permissions and
17 | ** limitations under the License.
18 | */
19 |
20 | /* Platform-specific types and definitions for OpenGL ES 1.X gl.h
21 | *
22 | * Adopters may modify khrplatform.h and this file to suit their platform.
23 | * Please contribute modifications back to Khronos as pull requests on the
24 | * public github repository:
25 | * https://github.com/KhronosGroup/OpenGL-Registry
26 | */
27 |
28 | #include "../KHR/khrplatform.h"
29 |
30 | #ifndef GL_API
31 | #define GL_API KHRONOS_APICALL
32 | #endif
33 |
34 | #ifndef GL_APIENTRY
35 | #define GL_APIENTRY KHRONOS_APIENTRY
36 | #endif
37 |
38 | #endif /* __glplatform_h_ */
39 |
--------------------------------------------------------------------------------
/ios/MetalANGLE.framework/Headers/GLES2/.clang-format:
--------------------------------------------------------------------------------
1 |
2 |
3 | DisableFormat: true
4 |
--------------------------------------------------------------------------------
/ios/MetalANGLE.framework/Headers/GLES2/gl2platform.h:
--------------------------------------------------------------------------------
1 | #ifndef __gl2platform_h_
2 | #define __gl2platform_h_
3 |
4 | /* $Revision: 23328 $ on $Date:: 2013-10-02 02:28:28 -0700 #$ */
5 |
6 | /*
7 | * This document is licensed under the SGI Free Software B License Version
8 | * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
9 | */
10 |
11 | /* Platform-specific types and definitions for OpenGL ES 2.X gl2.h
12 | *
13 | * Adopters may modify khrplatform.h and this file to suit their platform.
14 | * You are encouraged to submit all modifications to the Khronos group so that
15 | * they can be included in future versions of this file. Please submit changes
16 | * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
17 | * by filing a bug against product "OpenGL-ES" component "Registry".
18 | */
19 |
20 | #include "../KHR/khrplatform.h"
21 |
22 | #ifndef GL_APICALL
23 | #define GL_APICALL KHRONOS_APICALL
24 | #endif
25 |
26 | #ifndef GL_APIENTRY
27 | #define GL_APIENTRY KHRONOS_APIENTRY
28 | #endif
29 |
30 | #endif /* __gl2platform_h_ */
31 |
--------------------------------------------------------------------------------
/ios/MetalANGLE.framework/Headers/GLES3/.clang-format:
--------------------------------------------------------------------------------
1 |
2 |
3 | DisableFormat: true
4 |
--------------------------------------------------------------------------------
/ios/MetalANGLE.framework/Headers/GLES3/gl3platform.h:
--------------------------------------------------------------------------------
1 | #ifndef __gl3platform_h_
2 | #define __gl3platform_h_
3 |
4 | /* $Revision: 23328 $ on $Date:: 2013-10-02 02:28:28 -0700 #$ */
5 |
6 | /*
7 | * This document is licensed under the SGI Free Software B License Version
8 | * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
9 | */
10 |
11 | /* Platform-specific types and definitions for OpenGL ES 3.X gl3.h
12 | *
13 | * Adopters may modify khrplatform.h and this file to suit their platform.
14 | * You are encouraged to submit all modifications to the Khronos group so that
15 | * they can be included in future versions of this file. Please submit changes
16 | * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
17 | * by filing a bug against product "OpenGL-ES" component "Registry".
18 | */
19 |
20 | #include "../KHR/khrplatform.h"
21 |
22 | #ifndef GL_APICALL
23 | #define GL_APICALL KHRONOS_APICALL
24 | #endif
25 |
26 | #ifndef GL_APIENTRY
27 | #define GL_APIENTRY KHRONOS_APIENTRY
28 | #endif
29 |
30 | #endif /* __gl3platform_h_ */
31 |
--------------------------------------------------------------------------------
/ios/MetalANGLE.framework/Headers/KHR/.clang-format:
--------------------------------------------------------------------------------
1 |
2 |
3 | DisableFormat: true
4 |
--------------------------------------------------------------------------------
/ios/MetalANGLE.framework/Headers/MGLContext.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2019 Le Hoang Quyen. All rights reserved.
3 | // Use of this source code is governed by a BSD-style license that can be
4 | // found in the LICENSE file.
5 | //
6 |
7 | #import "MGLLayer.h"
8 |
9 | NS_ASSUME_NONNULL_BEGIN
10 |
11 | typedef enum MGLRenderingAPI : int
12 | {
13 | kMGLRenderingAPIOpenGLES1 = 1,
14 | kMGLRenderingAPIOpenGLES2 = 2,
15 | kMGLRenderingAPIOpenGLES3 = 3,
16 | } MGLRenderingAPI;
17 |
18 | @interface MGLSharegroup : NSObject
19 | @end
20 |
21 | @interface MGLContext : NSObject
22 |
23 | - (id)initWithAPI:(MGLRenderingAPI)api;
24 |
25 | // NOTE: If you use sharegroup to share resources between contexts, make sure to call glFlush()
26 | // when you finish the works of one context on a thread to make the changes visible to other
27 | // contexts.
28 | - (id)initWithAPI:(MGLRenderingAPI)api sharegroup:(MGLSharegroup *_Nullable)sharegroup;
29 |
30 | - (MGLRenderingAPI)API;
31 |
32 | @property(readonly) MGLSharegroup *sharegroup;
33 |
34 | // Present the content of layer on screen as soon as possible.
35 | - (BOOL)present:(MGLLayer *)layer;
36 |
37 | + (MGLContext *)currentContext;
38 | + (MGLLayer *)currentLayer;
39 |
40 | // Set current context without layer. NOTE: this function is only useful if you want to
41 | // create OpenGL resources such as textures/buffers before creating the presentation layer.
42 | // Before drawing to a layer, use [MGLContext setCurrentContext: forLayer:] function instead.
43 | + (BOOL)setCurrentContext:(MGLContext *_Nullable)context;
44 |
45 | // Set current context to render to the given layer.
46 | + (BOOL)setCurrentContext:(MGLContext *_Nullable)context forLayer:(MGLLayer *_Nullable)layer;
47 |
48 | @end
49 |
50 | NS_ASSUME_NONNULL_END
51 |
--------------------------------------------------------------------------------
/ios/MetalANGLE.framework/Headers/MGLKView.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2019 Le Hoang Quyen. All rights reserved.
3 | // Use of this source code is governed by a BSD-style license that can be
4 | // found in the LICENSE file.
5 | //
6 |
7 | #ifndef MGLKView_h
8 | #define MGLKView_h
9 |
10 | #import "MGLContext.h"
11 |
12 | @class MGLKView;
13 |
14 | @protocol MGLKViewDelegate
15 |
16 | // Implement this method to draw to the view using current OpenGL
17 | // context associated with the view.
18 | - (void)mglkView:(MGLKView *)view drawInRect:(CGRect)rect;
19 |
20 | @end
21 |
22 | // NOTE: do not subclass this class, use delegate if needed to override
23 | // the drawing method.
24 | @interface MGLKView : MGLKNativeView
25 |
26 | @property(nonatomic) MGLContext *context;
27 | @property(nonatomic, assign) IBOutlet id delegate;
28 |
29 | // Default value is NO. Setting to YES will keep the framebuffer data after presenting.
30 | // Doing so will reduce performance and increase memory usage.
31 | @property(nonatomic) BOOL retainedBacking;
32 | @property(nonatomic) MGLDrawableColorFormat drawableColorFormat; // Default is RGBA8888
33 | @property(nonatomic) MGLDrawableDepthFormat drawableDepthFormat; // Default is DepthNone
34 | @property(nonatomic) MGLDrawableStencilFormat drawableStencilFormat; // Default is StencilNone
35 | @property(nonatomic)
36 | MGLDrawableMultisample drawableMultisample; // Default is MGLDrawableMultisampleNone
37 |
38 | @property(nonatomic, weak, readonly) MGLLayer *glLayer;
39 |
40 | // Return the size of the OpenGL default framebuffer.
41 | @property(readonly) CGSize drawableSize;
42 | @property(nonatomic, readonly) NSInteger drawableWidth;
43 | @property(nonatomic, readonly) NSInteger drawableHeight;
44 |
45 | // OpenGL id of the underlying default framebuffer object.
46 | // Might not necessary be zero.
47 | @property(readonly) uint32_t defaultOpenGLFrameBufferID;
48 |
49 | #if TARGET_OS_IOS || TARGET_OS_TV
50 | // Enable setNeedsDisplay method.
51 | @property(nonatomic) BOOL enableSetNeedsDisplay;
52 | @property(readonly, strong) UIImage *snapshot;
53 | #endif
54 |
55 | - (id)initWithFrame:(CGRect)frame context:(MGLContext *)context;
56 |
57 | // Redraw the view's contents immediately.
58 | - (void)display;
59 |
60 | // Binds the underlying default framebuffer object to OpenGL ES.
61 | // Use this after drawing to offscreen FBO.
62 | - (void)bindDrawable;
63 |
64 | @end
65 |
66 | #endif /* MLKView_h */
67 |
--------------------------------------------------------------------------------
/ios/MetalANGLE.framework/Headers/MGLKViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2019 Le Hoang Quyen. All rights reserved.
3 | // Use of this source code is governed by a BSD-style license that can be
4 | // found in the LICENSE file.
5 | //
6 |
7 | #import "MGLKView.h"
8 |
9 | NS_ASSUME_NONNULL_BEGIN
10 |
11 | @class MGLKViewController;
12 |
13 | @protocol MGLKViewControllerDelegate
14 |
15 | - (void)mglkViewControllerUpdate:(MGLKViewController *)controller;
16 |
17 | @end
18 |
19 | @interface MGLKViewController : MGLKNativeViewController
20 |
21 | @property(nonatomic, assign) IBOutlet id delegate;
22 |
23 | // The default value is 30.
24 | // On iOS:
25 | // - Setting to 0 or 1 will sync the framerate with display's refresh rate
26 | // On macOS:
27 | // - Setting to 1 will sync the framerate with display's refresh rate
28 | // - Setting to 0 will display the frames as fast as possible.
29 | @property(nonatomic) NSInteger preferredFramesPerSecond;
30 |
31 | @property(nonatomic, readonly) NSInteger framesDisplayed;
32 | @property(nonatomic, readonly) NSTimeInterval timeSinceLastUpdate;
33 |
34 | @property(nonatomic) BOOL isPaused;
35 | @property(nonatomic, setter=setIsPaused:) BOOL paused;
36 | @property(nonatomic) BOOL pauseOnWillResignActive;
37 | @property(nonatomic) BOOL resumeOnDidBecomeActive;
38 |
39 | @property(weak, nonatomic, readonly) MGLKView *glView;
40 |
41 | @end
42 |
43 | NS_ASSUME_NONNULL_END
44 |
--------------------------------------------------------------------------------
/ios/MetalANGLE.framework/Headers/MGLKit.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2019 Le Hoang Quyen. All rights reserved.
3 | // Use of this source code is governed by a BSD-style license that can be
4 | // found in the LICENSE file.
5 | //
6 |
7 | #ifndef MGLKit_h
8 | #define MGLKit_h
9 |
10 | #import "MGLContext.h"
11 | #import "MGLKView.h"
12 | #import "MGLKViewController.h"
13 |
14 | #endif /* MGLKit_h */
15 |
--------------------------------------------------------------------------------
/ios/MetalANGLE.framework/Headers/MGLKitPlatform.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2020 Le Hoang Quyen. All rights reserved.
3 | // Use of this source code is governed by a BSD-style license that can be
4 | // found in the LICENSE file.
5 | //
6 |
7 | #ifndef MGLKitPlatform_h
8 | #define MGLKitPlatform_h
9 |
10 | #include
11 |
12 | #if TARGET_OS_IOS || TARGET_OS_MACCATALYST || TARGET_OS_TV
13 | # include
14 |
15 | @compatibility_alias MGLKNativeView UIView;
16 | @compatibility_alias MGLKNativeViewController UIViewController;
17 |
18 | # define MGLKApplicationWillResignActiveNotification UIApplicationWillResignActiveNotification
19 | # define MGLKApplicationDidBecomeActiveNotification UIApplicationDidBecomeActiveNotification
20 |
21 | #elif TARGET_OS_OSX
22 | # include
23 |
24 | @compatibility_alias MGLKNativeView NSView;
25 | @compatibility_alias MGLKNativeViewController NSViewController;
26 |
27 | # define MGLKApplicationWillResignActiveNotification NSApplicationWillResignActiveNotification
28 | # define MGLKApplicationDidBecomeActiveNotification NSApplicationDidBecomeActiveNotification
29 | #else
30 | # error "Unsupported platform"
31 | #endif
32 |
33 | #endif /* MGLKitPlatform_h */
34 |
--------------------------------------------------------------------------------
/ios/MetalANGLE.framework/Headers/MGLLayer.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2019 Le Hoang Quyen. All rights reserved.
3 | // Use of this source code is governed by a BSD-style license that can be
4 | // found in the LICENSE file.
5 | //
6 |
7 | // We don't use GLES from Apple framework.
8 | // Instead we use GLES provided by MetalANGLE.
9 | #define GLES_SILENCE_DEPRECATION
10 | #define GL_SILENCE_DEPRECATION
11 |
12 | #import
13 | #import
14 |
15 | #import "MGLKitPlatform.h"
16 |
17 | NS_ASSUME_NONNULL_BEGIN
18 |
19 | @class MGLContext;
20 |
21 | typedef enum MGLDrawableColorFormat : int
22 | {
23 | MGLDrawableColorFormatRGBA8888 = 32,
24 | MGLDrawableColorFormatSRGBA8888 = -32,
25 | MGLDrawableColorFormatRGB565 = 16,
26 | } MGLDrawableColorFormat;
27 |
28 | typedef enum MGLDrawableStencilFormat : int
29 | {
30 | MGLDrawableStencilFormatNone = 0,
31 | MGLDrawableStencilFormat8 = 8,
32 | } MGLDrawableStencilFormat;
33 |
34 | typedef enum MGLDrawableDepthFormat : int
35 | {
36 | MGLDrawableDepthFormatNone = 0,
37 | MGLDrawableDepthFormat16 = 16,
38 | MGLDrawableDepthFormat24 = 24,
39 | } MGLDrawableDepthFormat;
40 |
41 | typedef enum MGLDrawableMultisample : int
42 | {
43 | MGLDrawableMultisampleNone = 0,
44 | MGLDrawableMultisample4X = 4,
45 | } MGLDrawableMultisample;
46 |
47 | @interface MGLLayer : CALayer
48 |
49 | // Return the size of the OpenGL framebuffer.
50 | @property(readonly) CGSize drawableSize;
51 | // Default OpenGL id of the framebuffer storing content of this layer.
52 | // Might not necessary be zero.
53 | @property(readonly) uint32_t defaultOpenGLFrameBufferID;
54 |
55 | @property(nonatomic) MGLDrawableColorFormat drawableColorFormat; // Default is RGBA8888
56 | @property(nonatomic) MGLDrawableDepthFormat drawableDepthFormat; // Default is DepthNone
57 | @property(nonatomic) MGLDrawableStencilFormat drawableStencilFormat; // Default is StencilNone
58 | @property(nonatomic)
59 | MGLDrawableMultisample drawableMultisample; // Default is MGLDrawableMultisampleNone
60 |
61 | // Default value is NO. Setting to YES will keep the framebuffer data after presenting.
62 | // Doing so will reduce performance and increase memory usage.
63 | @property(nonatomic) BOOL retainedBacking;
64 |
65 | // Present the content of OpenGL backed framebuffer on screen as soon as possible.
66 | - (BOOL)present;
67 |
68 | // Bind default framebuffer. Use this after drawing to offscreen FBO.
69 | - (void)bindDefaultFrameBuffer;
70 |
71 | @end
72 |
73 | NS_ASSUME_NONNULL_END
74 |
--------------------------------------------------------------------------------
/ios/MetalANGLE.framework/Headers/angle_gl.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2014 The ANGLE Project Authors. All rights reserved.
3 | // Use of this source code is governed by a BSD-style license that can be
4 | // found in the LICENSE file.
5 | //
6 | // angle_gl.h:
7 | // Includes all necessary GL headers and definitions for ANGLE.
8 | //
9 |
10 | #ifndef ANGLEGL_H_
11 | #define ANGLEGL_H_
12 |
13 | #include "GLES/gl.h"
14 | #include "GLES/glext.h"
15 | #include "GLES2/gl2.h"
16 | #include "GLES2/gl2ext.h"
17 | #include "GLES3/gl3.h"
18 | #include "GLES3/gl31.h"
19 | #include "GLES3/gl32.h"
20 |
21 | #endif // ANGLEGL_H_
22 |
--------------------------------------------------------------------------------
/ios/MetalANGLE.framework/Headers/export.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2014 The ANGLE Project Authors. All rights reserved.
3 | // Use of this source code is governed by a BSD-style license that can be
4 | // found in the LICENSE file.
5 | //
6 |
7 | // export.h : Defines ANGLE_EXPORT, a macro for exporting functions from the DLL
8 |
9 | #ifndef LIBGLESV2_EXPORT_H_
10 | #define LIBGLESV2_EXPORT_H_
11 |
12 | #if !defined(ANGLE_EXPORT)
13 | # if defined(_WIN32)
14 | # if defined(LIBGLESV2_IMPLEMENTATION) || defined(LIBANGLE_IMPLEMENTATION) || \
15 | defined(LIBFEATURE_SUPPORT_IMPLEMENTATION)
16 | # define ANGLE_EXPORT __declspec(dllexport)
17 | # else
18 | # define ANGLE_EXPORT __declspec(dllimport)
19 | # endif
20 | # elif defined(__GNUC__)
21 | # if defined(LIBGLESV2_IMPLEMENTATION) || defined(LIBANGLE_IMPLEMENTATION) || \
22 | defined(LIBFEATURE_SUPPORT_IMPLEMENTATION)
23 | # define ANGLE_EXPORT __attribute__((visibility("default")))
24 | # else
25 | # define ANGLE_EXPORT
26 | # endif
27 | # else
28 | # define ANGLE_EXPORT
29 | # endif
30 | #endif // !defined(ANGLE_EXPORT)
31 |
32 | #if !defined(ANGLE_NO_EXPORT)
33 | # if defined(__GNUC__)
34 | # define ANGLE_NO_EXPORT __attribute__((visibility("hidden")))
35 | # else
36 | # define ANGLE_NO_EXPORT
37 | # endif
38 | #endif // !defined(ANGLE_NO_EXPORT)
39 |
40 | #endif // LIBGLESV2_EXPORT_H_
41 |
--------------------------------------------------------------------------------
/ios/MetalANGLE.framework/Info.plist:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/ios/MetalANGLE.framework/Info.plist
--------------------------------------------------------------------------------
/ios/MetalANGLE.framework/MetalANGLE:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/ios/MetalANGLE.framework/MetalANGLE
--------------------------------------------------------------------------------
/ios/flutter_web_gl.podspec:
--------------------------------------------------------------------------------
1 | #
2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
3 | # Run `pod lib lint flutter_web_gl.podspec` to validate before publishing.
4 | #
5 | Pod::Spec.new do |s|
6 | s.name = 'flutter_web_gl'
7 | s.version = '0.0.1'
8 | s.summary = 'A new flutter plugin project.'
9 | s.description = <<-DESC
10 | A new flutter plugin project.
11 | DESC
12 | s.homepage = 'http://example.com'
13 | s.license = { :file => '../LICENSE' }
14 | s.author = { 'Your Company' => 'email@example.com' }
15 | s.source = { :path => '.' }
16 | s.source_files = 'Classes/**/*.{h,m,swift,inc,plist}'
17 | s.public_header_files = 'Classes/**/*.{h,inc}'
18 |
19 | s.dependency 'Flutter'
20 |
21 | s.platform = :ios, '11.0'
22 | s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
23 | s.swift_version = '5.0'
24 |
25 | s.preserve_paths = 'MetalANGLE.framework'
26 | s.xcconfig = { 'OTHER_LDFLAGS' => '-framework MetalANGLE', 'HEADER_SEARCH_PATHS' => '"${PODS_TARGET_SRCROOT}/MetalANGLE.framework/Headers"'}
27 | s.vendored_frameworks = 'MetalANGLE.framework'
28 | s.library = 'c++'
29 |
30 |
31 | end
32 |
--------------------------------------------------------------------------------
/macos/Classes/FlutterWebGlPlugin.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @interface FlutterWebGlPlugin : NSObject
4 | @end
5 |
6 |
7 |
8 | @interface OpenGLException: NSException
9 | - (instancetype) initWithMessage: (NSString*) message andError: (int) error;
10 | @property (nonatomic,assign) GLint errorCode;
11 | @property (nonatomic,assign) NSString* message;
12 | @end
13 |
14 | @interface FlutterGlTexture : NSObject
15 | - (instancetype)initWithWidth:(int) width andHeight:(int)height registerWidth:(NSObject*) registry;
16 | @property (nonatomic,assign) int width;
17 | @property (nonatomic,assign) int height;
18 | @property (nonatomic,assign) GLuint fbo;
19 | @property (nonatomic,assign) GLuint rbo;
20 | @property (nonatomic,assign) int64_t flutterTextureId;
21 | @property (nonatomic) CVPixelBufferRef pixelData;
22 | // Metal -> GL interop texture
23 | @property (nonatomic, readonly) GLuint metalAsGLTexture;
24 |
25 |
26 | @end
27 |
28 |
--------------------------------------------------------------------------------
/macos/Classes/FlutterWebGlPlugin.swift:
--------------------------------------------------------------------------------
1 | import Cocoa
2 | import FlutterMacOS
3 |
4 | public class FlutterWebGlPlugin: NSObject, FlutterPlugin {
5 | public static func register(with registrar: FlutterPluginRegistrar) {
6 | let channel = FlutterMethodChannel(name: "flutter_web_gl", binaryMessenger: registrar.messenger)
7 | let instance = FlutterWebGlPlugin()
8 | registrar.addMethodCallDelegate(instance, channel: channel)
9 | }
10 |
11 | public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
12 | switch call.method {
13 | case "getPlatformVersion":
14 | result("macOS " + ProcessInfo.processInfo.operatingSystemVersionString)
15 | default:
16 | result(FlutterMethodNotImplemented)
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/macos/MetalANGLE.framework/Headers:
--------------------------------------------------------------------------------
1 | Versions/Current/Headers
--------------------------------------------------------------------------------
/macos/MetalANGLE.framework/MetalANGLE:
--------------------------------------------------------------------------------
1 | Versions/Current/MetalANGLE
--------------------------------------------------------------------------------
/macos/MetalANGLE.framework/Resources:
--------------------------------------------------------------------------------
1 | Versions/Current/Resources
--------------------------------------------------------------------------------
/macos/MetalANGLE.framework/Versions/A/Headers/EGL/.clang-format:
--------------------------------------------------------------------------------
1 |
2 |
3 | DisableFormat: true
4 |
--------------------------------------------------------------------------------
/macos/MetalANGLE.framework/Versions/A/Headers/GLES/.clang-format:
--------------------------------------------------------------------------------
1 |
2 |
3 | DisableFormat: true
4 |
--------------------------------------------------------------------------------
/macos/MetalANGLE.framework/Versions/A/Headers/GLES/README.md:
--------------------------------------------------------------------------------
1 | # ANGLE GLES 1.0 Headers
2 |
3 | The GLES 1.0 headers ANGLE uses are generated using the Khronos tools but modified to include function pointer types and function prototype guards.
4 |
5 | ### Regenerating gl.h
6 |
7 | 1. Install **Python 3** (not 2) with the **lxml** addon. You can do this using `pip install lxml` from your Python's Scripts folder.
8 | 1. Clone [https://github.com/KhronosGroup/OpenGL-Registry.git](https://github.com/KhronosGroup/OpenGL-Registry.git).
9 | 1. Edit `OpenGL-Registry/xml/genheaders.py`:
10 |
11 | 1. Look for the section titled `# GLES 1.x API + mandatory extensions - GLES/gl.h (no function pointers)`
12 | 1. Change `prefixText = prefixStrings + gles1PlatformStrings + genDateCommentString,` to `prefixText = prefixStrings + gles1PlatformStrings + apiEntryPrefixStrings + genDateCommentString,`
13 | 1. Change `genFuncPointers = False,` to `genFuncPointers = True,`
14 | 1. Change `protectProto = False,` to `protectProto = 'nonzero',`
15 | 1. Change `protectProtoStr = 'GL_GLEXT_PROTOTYPES',` to `protectProtoStr = 'GL_GLES_PROTOTYPES',`
16 |
17 | 1. Set your working directory to `OpenGL-Registry/xml/`.
18 | 1. Run `python genheaders.py ../api/GLES/gl.h`
19 | 1. The generated header will now be in `OpenGL-Registry/api/GLES/gl.h`. You can copy the header over to this folder.
20 | 1. Also update `scripts/gl.xml` with the latest version from `OpenGL-Registry/xml/`.
21 |
--------------------------------------------------------------------------------
/macos/MetalANGLE.framework/Versions/A/Headers/GLES/egl.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Copyright (c) 2008-2017 The Khronos Group Inc.
3 | **
4 | ** Licensed under the Apache License, Version 2.0 (the "License");
5 | ** you may not use this file except in compliance with the License.
6 | ** You may obtain a copy of the License at
7 | **
8 | ** http://www.apache.org/licenses/LICENSE-2.0
9 | **
10 | ** Unless required by applicable law or agreed to in writing, software
11 | ** distributed under the License is distributed on an "AS IS" BASIS,
12 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | ** See the License for the specific language governing permissions and
14 | ** limitations under the License.
15 | */
16 |
17 | /*
18 | * Skeleton egl.h to provide compatibility for early GLES 1.0
19 | * applications. Several early implementations included gl.h
20 | * in egl.h leading applications to include only egl.h
21 | */
22 |
23 | #ifndef __legacy_egl_h_
24 | #define __legacy_egl_h_
25 |
26 | #include "../EGL/egl.h"
27 | #include "gl.h"
28 |
29 | #endif /* __legacy_egl_h_ */
30 |
--------------------------------------------------------------------------------
/macos/MetalANGLE.framework/Versions/A/Headers/GLES/glext_angle.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2018 The ANGLE Project Authors. All rights reserved.
3 | // Use of this source code is governed by a BSD-style license that can be
4 | // found in the LICENSE file.
5 | //
6 | // glext_angle.h: ANGLE modifications to the glext.h header file.
7 | // Currently we don't include this file directly, we patch glext.h
8 | // to include it implicitly so it is visible throughout our code.
9 |
10 | #ifndef INCLUDE_GLES_GLEXT_ANGLE_H_
11 | #define INCLUDE_GLES_GLEXT_ANGLE_H_
12 |
13 | // clang-format off
14 |
15 | #ifndef GL_ANGLE_explicit_context_gles1
16 | #define GL_ANGLE_explicit_context_gles1
17 | typedef void *GLeglContext;
18 | #include "glext_explicit_context_autogen.inc"
19 | #endif /* GL_ANGLE_explicit_context_gles1 */
20 |
21 | // clang-format on
22 |
23 | #endif // INCLUDE_GLES_GLEXT_ANGLE_H_
24 |
--------------------------------------------------------------------------------
/macos/MetalANGLE.framework/Versions/A/Headers/GLES/glplatform.h:
--------------------------------------------------------------------------------
1 | #ifndef __glplatform_h_
2 | #define __glplatform_h_
3 |
4 | /*
5 | ** Copyright (c) 2017 The Khronos Group Inc.
6 | **
7 | ** Licensed under the Apache License, Version 2.0 (the "License");
8 | ** you may not use this file except in compliance with the License.
9 | ** You may obtain a copy of the License at
10 | **
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | **
13 | ** Unless required by applicable law or agreed to in writing, software
14 | ** distributed under the License is distributed on an "AS IS" BASIS,
15 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | ** See the License for the specific language governing permissions and
17 | ** limitations under the License.
18 | */
19 |
20 | /* Platform-specific types and definitions for OpenGL ES 1.X gl.h
21 | *
22 | * Adopters may modify khrplatform.h and this file to suit their platform.
23 | * Please contribute modifications back to Khronos as pull requests on the
24 | * public github repository:
25 | * https://github.com/KhronosGroup/OpenGL-Registry
26 | */
27 |
28 | #include "../KHR/khrplatform.h"
29 |
30 | #ifndef GL_API
31 | #define GL_API KHRONOS_APICALL
32 | #endif
33 |
34 | #ifndef GL_APIENTRY
35 | #define GL_APIENTRY KHRONOS_APIENTRY
36 | #endif
37 |
38 | #endif /* __glplatform_h_ */
39 |
--------------------------------------------------------------------------------
/macos/MetalANGLE.framework/Versions/A/Headers/GLES2/.clang-format:
--------------------------------------------------------------------------------
1 |
2 |
3 | DisableFormat: true
4 |
--------------------------------------------------------------------------------
/macos/MetalANGLE.framework/Versions/A/Headers/GLES2/gl2platform.h:
--------------------------------------------------------------------------------
1 | #ifndef __gl2platform_h_
2 | #define __gl2platform_h_
3 |
4 | /* $Revision: 23328 $ on $Date:: 2013-10-02 02:28:28 -0700 #$ */
5 |
6 | /*
7 | * This document is licensed under the SGI Free Software B License Version
8 | * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
9 | */
10 |
11 | /* Platform-specific types and definitions for OpenGL ES 2.X gl2.h
12 | *
13 | * Adopters may modify khrplatform.h and this file to suit their platform.
14 | * You are encouraged to submit all modifications to the Khronos group so that
15 | * they can be included in future versions of this file. Please submit changes
16 | * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
17 | * by filing a bug against product "OpenGL-ES" component "Registry".
18 | */
19 |
20 | #include "../KHR/khrplatform.h"
21 |
22 | #ifndef GL_APICALL
23 | #define GL_APICALL KHRONOS_APICALL
24 | #endif
25 |
26 | #ifndef GL_APIENTRY
27 | #define GL_APIENTRY KHRONOS_APIENTRY
28 | #endif
29 |
30 | #endif /* __gl2platform_h_ */
31 |
--------------------------------------------------------------------------------
/macos/MetalANGLE.framework/Versions/A/Headers/GLES3/.clang-format:
--------------------------------------------------------------------------------
1 |
2 |
3 | DisableFormat: true
4 |
--------------------------------------------------------------------------------
/macos/MetalANGLE.framework/Versions/A/Headers/GLES3/gl3platform.h:
--------------------------------------------------------------------------------
1 | #ifndef __gl3platform_h_
2 | #define __gl3platform_h_
3 |
4 | /* $Revision: 23328 $ on $Date:: 2013-10-02 02:28:28 -0700 #$ */
5 |
6 | /*
7 | * This document is licensed under the SGI Free Software B License Version
8 | * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
9 | */
10 |
11 | /* Platform-specific types and definitions for OpenGL ES 3.X gl3.h
12 | *
13 | * Adopters may modify khrplatform.h and this file to suit their platform.
14 | * You are encouraged to submit all modifications to the Khronos group so that
15 | * they can be included in future versions of this file. Please submit changes
16 | * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
17 | * by filing a bug against product "OpenGL-ES" component "Registry".
18 | */
19 |
20 | #include "../KHR/khrplatform.h"
21 |
22 | #ifndef GL_APICALL
23 | #define GL_APICALL KHRONOS_APICALL
24 | #endif
25 |
26 | #ifndef GL_APIENTRY
27 | #define GL_APIENTRY KHRONOS_APIENTRY
28 | #endif
29 |
30 | #endif /* __gl3platform_h_ */
31 |
--------------------------------------------------------------------------------
/macos/MetalANGLE.framework/Versions/A/Headers/KHR/.clang-format:
--------------------------------------------------------------------------------
1 |
2 |
3 | DisableFormat: true
4 |
--------------------------------------------------------------------------------
/macos/MetalANGLE.framework/Versions/A/Headers/MGLContext.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2019 Le Hoang Quyen. All rights reserved.
3 | // Use of this source code is governed by a BSD-style license that can be
4 | // found in the LICENSE file.
5 | //
6 |
7 | #import "MGLLayer.h"
8 |
9 | NS_ASSUME_NONNULL_BEGIN
10 |
11 | typedef enum MGLRenderingAPI : int
12 | {
13 | kMGLRenderingAPIOpenGLES1 = 1,
14 | kMGLRenderingAPIOpenGLES2 = 2,
15 | kMGLRenderingAPIOpenGLES3 = 3,
16 | } MGLRenderingAPI;
17 |
18 | @interface MGLSharegroup : NSObject
19 | @end
20 |
21 | @interface MGLContext : NSObject
22 |
23 | - (id)initWithAPI:(MGLRenderingAPI)api;
24 |
25 | // NOTE: If you use sharegroup to share resources between contexts, make sure to call glFlush()
26 | // when you finish the works of one context on a thread to make the changes visible to other
27 | // contexts.
28 | - (id)initWithAPI:(MGLRenderingAPI)api sharegroup:(MGLSharegroup *_Nullable)sharegroup;
29 |
30 | - (MGLRenderingAPI)API;
31 |
32 | @property(readonly) MGLSharegroup *sharegroup;
33 |
34 | // Present the content of layer on screen as soon as possible.
35 | - (BOOL)present:(MGLLayer *)layer;
36 |
37 | + (MGLContext *)currentContext;
38 | + (MGLLayer *)currentLayer;
39 |
40 | // Set current context without layer. NOTE: this function is only useful if you want to
41 | // create OpenGL resources such as textures/buffers before creating the presentation layer.
42 | // Before drawing to a layer, use [MGLContext setCurrentContext: forLayer:] function instead.
43 | + (BOOL)setCurrentContext:(MGLContext *_Nullable)context;
44 |
45 | // Set current context to render to the given layer.
46 | + (BOOL)setCurrentContext:(MGLContext *_Nullable)context forLayer:(MGLLayer *_Nullable)layer;
47 |
48 | @end
49 |
50 | NS_ASSUME_NONNULL_END
51 |
--------------------------------------------------------------------------------
/macos/MetalANGLE.framework/Versions/A/Headers/MGLKView.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2019 Le Hoang Quyen. All rights reserved.
3 | // Use of this source code is governed by a BSD-style license that can be
4 | // found in the LICENSE file.
5 | //
6 |
7 | #ifndef MGLKView_h
8 | #define MGLKView_h
9 |
10 | #import "MGLContext.h"
11 |
12 | @class MGLKView;
13 |
14 | @protocol MGLKViewDelegate
15 |
16 | // Implement this method to draw to the view using current OpenGL
17 | // context associated with the view.
18 | - (void)mglkView:(MGLKView *)view drawInRect:(CGRect)rect;
19 |
20 | @end
21 |
22 | // NOTE: do not subclass this class, use delegate if needed to override
23 | // the drawing method.
24 | @interface MGLKView : MGLKNativeView
25 |
26 | @property(nonatomic) MGLContext *context;
27 | @property(nonatomic, assign) IBOutlet id delegate;
28 |
29 | // Default value is NO. Setting to YES will keep the framebuffer data after presenting.
30 | // Doing so will reduce performance and increase memory usage.
31 | @property(nonatomic) BOOL retainedBacking;
32 | @property(nonatomic) MGLDrawableColorFormat drawableColorFormat; // Default is RGBA8888
33 | @property(nonatomic) MGLDrawableDepthFormat drawableDepthFormat; // Default is DepthNone
34 | @property(nonatomic) MGLDrawableStencilFormat drawableStencilFormat; // Default is StencilNone
35 | @property(nonatomic)
36 | MGLDrawableMultisample drawableMultisample; // Default is MGLDrawableMultisampleNone
37 |
38 | @property(nonatomic, weak, readonly) MGLLayer *glLayer;
39 |
40 | // Return the size of the OpenGL default framebuffer.
41 | @property(readonly) CGSize drawableSize;
42 | @property(nonatomic, readonly) NSInteger drawableWidth;
43 | @property(nonatomic, readonly) NSInteger drawableHeight;
44 |
45 | // OpenGL id of the underlying default framebuffer object.
46 | // Might not necessary be zero.
47 | @property(readonly) uint32_t defaultOpenGLFrameBufferID;
48 |
49 | #if TARGET_OS_IOS || TARGET_OS_TV
50 | // Enable setNeedsDisplay method.
51 | @property(nonatomic) BOOL enableSetNeedsDisplay;
52 | @property(readonly, strong) UIImage *snapshot;
53 | #endif
54 |
55 | - (id)initWithFrame:(CGRect)frame context:(MGLContext *)context;
56 |
57 | // Redraw the view's contents immediately.
58 | - (void)display;
59 |
60 | // Binds the underlying default framebuffer object to OpenGL ES.
61 | // Use this after drawing to offscreen FBO.
62 | - (void)bindDrawable;
63 |
64 | @end
65 |
66 | #endif /* MLKView_h */
67 |
--------------------------------------------------------------------------------
/macos/MetalANGLE.framework/Versions/A/Headers/MGLKViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2019 Le Hoang Quyen. All rights reserved.
3 | // Use of this source code is governed by a BSD-style license that can be
4 | // found in the LICENSE file.
5 | //
6 |
7 | #import "MGLKView.h"
8 |
9 | NS_ASSUME_NONNULL_BEGIN
10 |
11 | @class MGLKViewController;
12 |
13 | @protocol MGLKViewControllerDelegate
14 |
15 | - (void)mglkViewControllerUpdate:(MGLKViewController *)controller;
16 |
17 | @end
18 |
19 | @interface MGLKViewController : MGLKNativeViewController
20 |
21 | @property(nonatomic, assign) IBOutlet id delegate;
22 |
23 | // The default value is 30.
24 | // On iOS:
25 | // - Setting to 0 or 1 will sync the framerate with display's refresh rate
26 | // On macOS:
27 | // - Setting to 1 will sync the framerate with display's refresh rate
28 | // - Setting to 0 will display the frames as fast as possible.
29 | @property(nonatomic) NSInteger preferredFramesPerSecond;
30 |
31 | @property(nonatomic, readonly) NSInteger framesDisplayed;
32 | @property(nonatomic, readonly) NSTimeInterval timeSinceLastUpdate;
33 |
34 | @property(nonatomic) bool isPaused;
35 | @property(nonatomic) bool pauseOnWillResignActive;
36 | @property(nonatomic) bool resumeOnDidBecomeActive;
37 |
38 | @property(weak, nonatomic, readonly) MGLKView *glView;
39 |
40 | @end
41 |
42 | NS_ASSUME_NONNULL_END
43 |
--------------------------------------------------------------------------------
/macos/MetalANGLE.framework/Versions/A/Headers/MGLKit.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2019 Le Hoang Quyen. All rights reserved.
3 | // Use of this source code is governed by a BSD-style license that can be
4 | // found in the LICENSE file.
5 | //
6 |
7 | #ifndef MGLKit_h
8 | #define MGLKit_h
9 |
10 | #import "MGLContext.h"
11 | #import "MGLKView.h"
12 | #import "MGLKViewController.h"
13 |
14 | #endif /* MGLKit_h */
15 |
--------------------------------------------------------------------------------
/macos/MetalANGLE.framework/Versions/A/Headers/MGLKitPlatform.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2020 Le Hoang Quyen. All rights reserved.
3 | // Use of this source code is governed by a BSD-style license that can be
4 | // found in the LICENSE file.
5 | //
6 |
7 | #ifndef MGLKitPlatform_h
8 | #define MGLKitPlatform_h
9 |
10 | #include
11 |
12 | #if TARGET_OS_IOS || TARGET_OS_MACCATALYST || TARGET_OS_TV
13 | # include
14 |
15 | @compatibility_alias MGLKNativeView UIView;
16 | @compatibility_alias MGLKNativeViewController UIViewController;
17 |
18 | # define MGLKApplicationWillResignActiveNotification UIApplicationWillResignActiveNotification
19 | # define MGLKApplicationDidBecomeActiveNotification UIApplicationDidBecomeActiveNotification
20 |
21 | #elif TARGET_OS_OSX
22 | # include
23 |
24 | @compatibility_alias MGLKNativeView NSView;
25 | @compatibility_alias MGLKNativeViewController NSViewController;
26 |
27 | # define MGLKApplicationWillResignActiveNotification NSApplicationWillResignActiveNotification
28 | # define MGLKApplicationDidBecomeActiveNotification NSApplicationDidBecomeActiveNotification
29 | #else
30 | # error "Unsupported platform"
31 | #endif
32 |
33 | #endif /* MGLKitPlatform_h */
34 |
--------------------------------------------------------------------------------
/macos/MetalANGLE.framework/Versions/A/Headers/MGLLayer.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2019 Le Hoang Quyen. All rights reserved.
3 | // Use of this source code is governed by a BSD-style license that can be
4 | // found in the LICENSE file.
5 | //
6 |
7 | // We don't use GLES from Apple framework.
8 | // Instead we use GLES provided by MetalANGLE.
9 | #define GLES_SILENCE_DEPRECATION
10 | #define GL_SILENCE_DEPRECATION
11 |
12 | #import
13 | #import
14 |
15 | #import "MGLKitPlatform.h"
16 |
17 | NS_ASSUME_NONNULL_BEGIN
18 |
19 | @class MGLContext;
20 |
21 | typedef enum MGLDrawableColorFormat : int
22 | {
23 | MGLDrawableColorFormatRGBA8888 = 32,
24 | MGLDrawableColorFormatSRGBA8888 = -32,
25 | MGLDrawableColorFormatRGB565 = 16,
26 | } MGLDrawableColorFormat;
27 |
28 | typedef enum MGLDrawableStencilFormat : int
29 | {
30 | MGLDrawableStencilFormatNone = 0,
31 | MGLDrawableStencilFormat8 = 8,
32 | } MGLDrawableStencilFormat;
33 |
34 | typedef enum MGLDrawableDepthFormat : int
35 | {
36 | MGLDrawableDepthFormatNone = 0,
37 | MGLDrawableDepthFormat16 = 16,
38 | MGLDrawableDepthFormat24 = 24,
39 | } MGLDrawableDepthFormat;
40 |
41 | typedef enum MGLDrawableMultisample : int
42 | {
43 | MGLDrawableMultisampleNone = 0,
44 | MGLDrawableMultisample4X = 4,
45 | } MGLDrawableMultisample;
46 |
47 | @interface MGLLayer : CALayer
48 |
49 | // Return the size of the OpenGL framebuffer.
50 | @property(readonly) CGSize drawableSize;
51 | // Default OpenGL id of the framebuffer storing content of this layer.
52 | // Might not necessary be zero.
53 | @property(readonly) uint32_t defaultOpenGLFrameBufferID;
54 |
55 | @property(nonatomic) MGLDrawableColorFormat drawableColorFormat; // Default is RGBA8888
56 | @property(nonatomic) MGLDrawableDepthFormat drawableDepthFormat; // Default is DepthNone
57 | @property(nonatomic) MGLDrawableStencilFormat drawableStencilFormat; // Default is StencilNone
58 | @property(nonatomic)
59 | MGLDrawableMultisample drawableMultisample; // Default is MGLDrawableMultisampleNone
60 |
61 | // Default value is NO. Setting to YES will keep the framebuffer data after presenting.
62 | // Doing so will reduce performance and increase memory usage.
63 | @property(nonatomic) BOOL retainedBacking;
64 |
65 | // Present the content of OpenGL backed framebuffer on screen as soon as possible.
66 | - (BOOL)present;
67 |
68 | // Bind default framebuffer. Use this after drawing to offscreen FBO.
69 | - (void)bindDefaultFrameBuffer;
70 |
71 | @end
72 |
73 | NS_ASSUME_NONNULL_END
74 |
--------------------------------------------------------------------------------
/macos/MetalANGLE.framework/Versions/A/Headers/angle_gl.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2014 The ANGLE Project Authors. All rights reserved.
3 | // Use of this source code is governed by a BSD-style license that can be
4 | // found in the LICENSE file.
5 | //
6 | // angle_gl.h:
7 | // Includes all necessary GL headers and definitions for ANGLE.
8 | //
9 |
10 | #ifndef ANGLEGL_H_
11 | #define ANGLEGL_H_
12 |
13 | #include "GLES/gl.h"
14 | #include "GLES/glext.h"
15 | #include "GLES2/gl2.h"
16 | #include "GLES2/gl2ext.h"
17 | #include "GLES3/gl3.h"
18 | #include "GLES3/gl31.h"
19 | #include "GLES3/gl32.h"
20 |
21 | #endif // ANGLEGL_H_
22 |
--------------------------------------------------------------------------------
/macos/MetalANGLE.framework/Versions/A/Headers/export.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2014 The ANGLE Project Authors. All rights reserved.
3 | // Use of this source code is governed by a BSD-style license that can be
4 | // found in the LICENSE file.
5 | //
6 |
7 | // export.h : Defines ANGLE_EXPORT, a macro for exporting functions from the DLL
8 |
9 | #ifndef LIBGLESV2_EXPORT_H_
10 | #define LIBGLESV2_EXPORT_H_
11 |
12 | #if !defined(ANGLE_EXPORT)
13 | # if defined(_WIN32)
14 | # if defined(LIBGLESV2_IMPLEMENTATION) || defined(LIBANGLE_IMPLEMENTATION) || \
15 | defined(LIBFEATURE_SUPPORT_IMPLEMENTATION)
16 | # define ANGLE_EXPORT __declspec(dllexport)
17 | # else
18 | # define ANGLE_EXPORT __declspec(dllimport)
19 | # endif
20 | # elif defined(__GNUC__)
21 | # if defined(LIBGLESV2_IMPLEMENTATION) || defined(LIBANGLE_IMPLEMENTATION) || \
22 | defined(LIBFEATURE_SUPPORT_IMPLEMENTATION)
23 | # define ANGLE_EXPORT __attribute__((visibility("default")))
24 | # else
25 | # define ANGLE_EXPORT
26 | # endif
27 | # else
28 | # define ANGLE_EXPORT
29 | # endif
30 | #endif // !defined(ANGLE_EXPORT)
31 |
32 | #if !defined(ANGLE_NO_EXPORT)
33 | # if defined(__GNUC__)
34 | # define ANGLE_NO_EXPORT __attribute__((visibility("hidden")))
35 | # else
36 | # define ANGLE_NO_EXPORT
37 | # endif
38 | #endif // !defined(ANGLE_NO_EXPORT)
39 |
40 | #endif // LIBGLESV2_EXPORT_H_
41 |
--------------------------------------------------------------------------------
/macos/MetalANGLE.framework/Versions/A/MetalANGLE:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/macos/MetalANGLE.framework/Versions/A/MetalANGLE
--------------------------------------------------------------------------------
/macos/MetalANGLE.framework/Versions/A/Resources/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | BuildMachineOSBuild
6 | 20D74
7 | CFBundleDevelopmentRegion
8 | en
9 | CFBundleExecutable
10 | MetalANGLE
11 | CFBundleIdentifier
12 | com.google.OpenGLES
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | MetalANGLE
17 | CFBundlePackageType
18 | FMWK
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSupportedPlatforms
22 |
23 | MacOSX
24 |
25 | CFBundleVersion
26 | 1
27 | DTCompiler
28 | com.apple.compilers.llvm.clang.1_0
29 | DTPlatformBuild
30 | 12D4e
31 | DTPlatformName
32 | macosx
33 | DTPlatformVersion
34 | 11.1
35 | DTSDKBuild
36 | 20C63
37 | DTSDKName
38 | macosx11.1
39 | DTXcode
40 | 1240
41 | DTXcodeBuild
42 | 12D4e
43 | LSMinimumSystemVersion
44 | 10.13
45 |
46 |
47 |
--------------------------------------------------------------------------------
/macos/MetalANGLE.framework/Versions/Current:
--------------------------------------------------------------------------------
1 | A
--------------------------------------------------------------------------------
/macos/flutter_web_gl.podspec:
--------------------------------------------------------------------------------
1 | #
2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
3 | # Run `pod lib lint flutter_web_gl.podspec` to validate before publishing.
4 | #
5 | Pod::Spec.new do |s|
6 | s.name = 'flutter_web_gl'
7 | s.version = '0.0.1'
8 | s.summary = 'A new flutter plugin project.'
9 | s.description = <<-DESC
10 | A new flutter plugin project.
11 | DESC
12 | s.homepage = 'http://example.com'
13 | s.license = { :file => '../LICENSE' }
14 | s.author = { 'Your Company' => 'email@example.com' }
15 | s.source = { :path => '.' }
16 | s.source_files = 'Classes/**/*.{h,m,swift,inc,plist}'
17 | s.public_header_files = 'Classes/**/*.{h,inc}'
18 |
19 | s.dependency 'FlutterMacOS'
20 |
21 | s.platform = :osx, '10.13'
22 | s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
23 | s.swift_version = '5.0'
24 |
25 | s.preserve_paths = 'MetalANGLE.framework'
26 | s.xcconfig = { 'OTHER_LDFLAGS' => '-framework MetalANGLE', 'HEADER_SEARCH_PATHS' => '"${PODS_TARGET_SRCROOT}/MetalANGLE.framework/Headers"'}
27 | s.vendored_frameworks = 'MetalANGLE.framework'
28 | s.library = 'c++'
29 |
30 |
31 | end
32 |
--------------------------------------------------------------------------------
/pubspec.lock:
--------------------------------------------------------------------------------
1 | # Generated by pub
2 | # See https://dart.dev/tools/pub/glossary#lockfile
3 | packages:
4 | async:
5 | dependency: transitive
6 | description:
7 | name: async
8 | url: "https://pub.dartlang.org"
9 | source: hosted
10 | version: "2.5.0"
11 | boolean_selector:
12 | dependency: transitive
13 | description:
14 | name: boolean_selector
15 | url: "https://pub.dartlang.org"
16 | source: hosted
17 | version: "2.1.0"
18 | characters:
19 | dependency: transitive
20 | description:
21 | name: characters
22 | url: "https://pub.dartlang.org"
23 | source: hosted
24 | version: "1.1.0"
25 | charcode:
26 | dependency: transitive
27 | description:
28 | name: charcode
29 | url: "https://pub.dartlang.org"
30 | source: hosted
31 | version: "1.2.0"
32 | clock:
33 | dependency: transitive
34 | description:
35 | name: clock
36 | url: "https://pub.dartlang.org"
37 | source: hosted
38 | version: "1.1.0"
39 | collection:
40 | dependency: transitive
41 | description:
42 | name: collection
43 | url: "https://pub.dartlang.org"
44 | source: hosted
45 | version: "1.15.0"
46 | dylib:
47 | dependency: "direct main"
48 | description:
49 | name: dylib
50 | url: "https://pub.dartlang.org"
51 | source: hosted
52 | version: "0.2.1-nullsafety.0"
53 | fake_async:
54 | dependency: transitive
55 | description:
56 | name: fake_async
57 | url: "https://pub.dartlang.org"
58 | source: hosted
59 | version: "1.2.0"
60 | ffi:
61 | dependency: "direct main"
62 | description:
63 | name: ffi
64 | url: "https://pub.dartlang.org"
65 | source: hosted
66 | version: "1.0.0"
67 | flutter:
68 | dependency: "direct main"
69 | description: flutter
70 | source: sdk
71 | version: "0.0.0"
72 | flutter_test:
73 | dependency: "direct dev"
74 | description: flutter
75 | source: sdk
76 | version: "0.0.0"
77 | matcher:
78 | dependency: transitive
79 | description:
80 | name: matcher
81 | url: "https://pub.dartlang.org"
82 | source: hosted
83 | version: "0.12.10"
84 | meta:
85 | dependency: transitive
86 | description:
87 | name: meta
88 | url: "https://pub.dartlang.org"
89 | source: hosted
90 | version: "1.3.0"
91 | opengl_es_bindings:
92 | dependency: "direct main"
93 | description:
94 | name: opengl_es_bindings
95 | url: "https://pub.dartlang.org"
96 | source: hosted
97 | version: "1.0.0-pre.1"
98 | path:
99 | dependency: transitive
100 | description:
101 | name: path
102 | url: "https://pub.dartlang.org"
103 | source: hosted
104 | version: "1.8.0"
105 | sky_engine:
106 | dependency: transitive
107 | description: flutter
108 | source: sdk
109 | version: "0.0.99"
110 | source_span:
111 | dependency: transitive
112 | description:
113 | name: source_span
114 | url: "https://pub.dartlang.org"
115 | source: hosted
116 | version: "1.8.0"
117 | stack_trace:
118 | dependency: transitive
119 | description:
120 | name: stack_trace
121 | url: "https://pub.dartlang.org"
122 | source: hosted
123 | version: "1.10.0"
124 | stream_channel:
125 | dependency: transitive
126 | description:
127 | name: stream_channel
128 | url: "https://pub.dartlang.org"
129 | source: hosted
130 | version: "2.1.0"
131 | string_scanner:
132 | dependency: transitive
133 | description:
134 | name: string_scanner
135 | url: "https://pub.dartlang.org"
136 | source: hosted
137 | version: "1.1.0"
138 | term_glyph:
139 | dependency: transitive
140 | description:
141 | name: term_glyph
142 | url: "https://pub.dartlang.org"
143 | source: hosted
144 | version: "1.2.0"
145 | test_api:
146 | dependency: transitive
147 | description:
148 | name: test_api
149 | url: "https://pub.dartlang.org"
150 | source: hosted
151 | version: "0.2.19"
152 | typed_data:
153 | dependency: transitive
154 | description:
155 | name: typed_data
156 | url: "https://pub.dartlang.org"
157 | source: hosted
158 | version: "1.3.0"
159 | vector_math:
160 | dependency: transitive
161 | description:
162 | name: vector_math
163 | url: "https://pub.dartlang.org"
164 | source: hosted
165 | version: "2.1.0"
166 | sdks:
167 | dart: ">=2.12.0 <3.0.0"
168 | flutter: ">=1.20.0"
169 |
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: flutter_web_gl
2 | description: A new flutter plugin project.
3 | version: 0.0.1-nullsafety.0
4 | homepage: https://github.com/FlutterGL/flutter_web_gl
5 |
6 | environment:
7 | sdk: ">=2.12.0-0 <3.0.0"
8 | flutter: ">=1.20.0"
9 |
10 | dependencies:
11 | dylib: 0.2.1-nullsafety.0
12 | ffi: ^1.0.0
13 | opengl_es_bindings: ^1.0.0-pre.1
14 | # git: https://github.com/FlutterGL/opengl_es_bindings
15 | flutter:
16 | sdk: flutter
17 |
18 | dev_dependencies:
19 | flutter_test:
20 | sdk: flutter
21 |
22 | # For information on the generic Dart part of this file, see the
23 | # following page: https://dart.dev/tools/pub/pubspec
24 |
25 | # The following section is specific to Flutter.
26 | flutter:
27 | # This section identifies this Flutter project as a plugin project.
28 | # The 'pluginClass' and Android 'package' identifiers should not ordinarily
29 | # be modified. They are used by the tooling to maintain consistency when
30 | # adding or updating assets for this project.
31 | plugin:
32 | platforms:
33 | android:
34 | package: org.fluttergl.flutter_web_gl
35 | pluginClass: FlutterWebGlPlugin
36 | ios:
37 | pluginClass: FlutterWebGlPlugin
38 | windows:
39 | pluginClass: FlutterWebGlPlugin
40 | macos:
41 | pluginClass: FlutterWebGlPlugin
42 |
43 |
44 | # To add assets to your plugin package, add an assets section, like this:
45 | # assets:
46 | # - images/a_dot_burr.jpeg
47 | # - images/a_dot_ham.jpeg
48 | #
49 | # For details regarding assets in packages, see
50 | # https://flutter.dev/assets-and-images/#from-packages
51 | #
52 | # An image asset can refer to one or more resolution-specific "variants", see
53 | # https://flutter.dev/assets-and-images/#resolution-aware.
54 |
55 | # To add custom fonts to your plugin package, add a fonts section here,
56 | # in this "flutter" section. Each entry in this list should have a
57 | # "family" key with the font family name, and a "fonts" key with a
58 | # list giving the asset and other descriptors for the font. For
59 | # example:
60 | # fonts:
61 | # - family: Schyler
62 | # fonts:
63 | # - asset: fonts/Schyler-Regular.ttf
64 | # - asset: fonts/Schyler-Italic.ttf
65 | # style: italic
66 | # - family: Trajan Pro
67 | # fonts:
68 | # - asset: fonts/TrajanPro.ttf
69 | # - asset: fonts/TrajanPro_Bold.ttf
70 | # weight: 700
71 | #
72 | # For details regarding fonts in packages, see
73 | # https://flutter.dev/custom-fonts/#from-packages
74 |
--------------------------------------------------------------------------------
/test/flutter_web_gl_test.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/services.dart';
2 | import 'package:flutter_test/flutter_test.dart';
3 | import 'package:flutter_web_gl/flutter_web_gl.dart';
4 |
5 | void main() {
6 | const MethodChannel channel = MethodChannel('flutter_web_gl');
7 |
8 | TestWidgetsFlutterBinding.ensureInitialized();
9 |
10 | setUp(() {
11 | channel.setMockMethodCallHandler((MethodCall methodCall) async {
12 | return '42';
13 | });
14 | });
15 |
16 | tearDown(() {
17 | channel.setMockMethodCallHandler(null);
18 | });
19 |
20 | test('getPlatformVersion', () async {
21 | expect(await FlutterWebGL.platformVersion, '42');
22 | });
23 | }
24 |
--------------------------------------------------------------------------------
/windows/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/
2 |
3 | # Visual Studio user-specific files.
4 | *.suo
5 | *.user
6 | *.userosscache
7 | *.sln.docstates
8 |
9 | # Visual Studio build-related files.
10 | # x64/
11 | # x86/
12 |
13 | # Visual Studio cache files
14 | # files ending in .cache can be ignored
15 | *.[Cc]ache
16 | # but keep track of directories ending in .cache
17 | !*.[Cc]ache/
18 |
--------------------------------------------------------------------------------
/windows/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.15)
2 | set(PROJECT_NAME "flutter_web_gl")
3 | project(${PROJECT_NAME} LANGUAGES CXX)
4 |
5 | # This value is used when generating builds using this plugin, so it must
6 | # not be changed
7 | set(PLUGIN_NAME "flutter_web_gl_plugin")
8 |
9 | add_library(${PLUGIN_NAME} SHARED
10 | "flutter_web_gl_plugin.cpp"
11 | )
12 | apply_standard_settings(${PLUGIN_NAME})
13 | set_target_properties(${PLUGIN_NAME} PROPERTIES
14 | CXX_VISIBILITY_PRESET hidden)
15 | target_compile_definitions(${PLUGIN_NAME} PRIVATE FLUTTER_PLUGIN_IMPL)
16 | target_include_directories(${PLUGIN_NAME} INTERFACE
17 | "${CMAKE_CURRENT_SOURCE_DIR}/include")
18 |
19 | set(LIB_GLES_NAME "libGLESv2.dll")
20 | set(LIB_EGL_NAME "libEGL.dll")
21 | set(ZLIB_NAME "zlib.dll")
22 | set(ANGLE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/angle")
23 | set(OPENGL_ARCH ${MSVC_CXX_ARCHITECTURE_ID})
24 | set(OPENGL_BUILD_TYPE "$<$:debug>$<$:release>")
25 | set(OPENGL_LIB_DIR "${ANGLE_DIR}/${OPENGL_ARCH}/${OPENGL_BUILD_TYPE}")
26 | set(OPENGL_LIB "${OPENGL_LIB_DIR}/${LIB_GLES_NAME}")
27 | set(EGL_LIB "${OPENGL_LIB_DIR}/${LIB_EGL_NAME}")
28 | set(ZLIB_LIB "${OPENGL_LIB_DIR}/${ZLIB_NAME}")
29 |
30 | target_link_directories(${PLUGIN_NAME} PUBLIC ${OPENGL_LIB_DIR} )
31 | target_link_libraries(${PLUGIN_NAME} PRIVATE flutter flutter_wrapper_plugin ${LIB_GLES_NAME}.lib ${LIB_EGL_NAME}.lib)
32 | # List of absolute paths to libraries that should be bundled with the plugin
33 | set(flutter_web_gl_bundled_libraries
34 | "${OPENGL_LIB}"
35 | "${EGL_LIB}"
36 | "${ZLIB_LIB}"
37 | PARENT_SCOPE
38 | )
--------------------------------------------------------------------------------
/windows/angle/x64/debug/libEGL.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/windows/angle/x64/debug/libEGL.dll
--------------------------------------------------------------------------------
/windows/angle/x64/debug/libEGL.dll.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/windows/angle/x64/debug/libEGL.dll.lib
--------------------------------------------------------------------------------
/windows/angle/x64/debug/libGLESv2.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/windows/angle/x64/debug/libGLESv2.dll
--------------------------------------------------------------------------------
/windows/angle/x64/debug/libGLESv2.dll.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/windows/angle/x64/debug/libGLESv2.dll.lib
--------------------------------------------------------------------------------
/windows/angle/x64/debug/zlib.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterGL/flutter_web_gl/6a38f2f98f7387268fb1f8e1f6536062e51eeb45/windows/angle/x64/debug/zlib.dll
--------------------------------------------------------------------------------
/windows/include/flutter_web_gl/flutter_web_gl_plugin.h:
--------------------------------------------------------------------------------
1 | #ifndef FLUTTER_PLUGIN_FLUTTER_WEB_GL_PLUGIN_H_
2 | #define FLUTTER_PLUGIN_FLUTTER_WEB_GL_PLUGIN_H_
3 |
4 | #include
5 |
6 | #ifdef FLUTTER_PLUGIN_IMPL
7 | #define FLUTTER_PLUGIN_EXPORT __declspec(dllexport)
8 | #else
9 | #define FLUTTER_PLUGIN_EXPORT __declspec(dllimport)
10 | #endif
11 |
12 | #if defined(__cplusplus)
13 | extern "C" {
14 | #endif
15 |
16 | FLUTTER_PLUGIN_EXPORT void FlutterWebGlPluginRegisterWithRegistrar(
17 | FlutterDesktopPluginRegistrarRef registrar);
18 |
19 | #if defined(__cplusplus)
20 | } // extern "C"
21 | #endif
22 |
23 | #endif // FLUTTER_PLUGIN_FLUTTER_WEB_GL_PLUGIN_H_
24 |
--------------------------------------------------------------------------------
/windows/include/gl3platform.h:
--------------------------------------------------------------------------------
1 | #ifndef __gl3platform_h_
2 | #define __gl3platform_h_
3 |
4 | /*
5 | ** Copyright 2017-2020 The Khronos Group Inc.
6 | ** SPDX-License-Identifier: Apache-2.0
7 | */
8 |
9 | /* Platform-specific types and definitions for OpenGL ES 3.X gl3.h
10 | *
11 | * Adopters may modify khrplatform.h and this file to suit their platform.
12 | * Please contribute modifications back to Khronos as pull requests on the
13 | * public github repository:
14 | * https://github.com/KhronosGroup/OpenGL-Registry
15 | */
16 |
17 | #include "khrplatform.h"
18 |
19 | #ifndef GL_APICALL
20 | #define GL_APICALL KHRONOS_APICALL
21 | #endif
22 |
23 | #ifndef GL_APIENTRY
24 | #define GL_APIENTRY KHRONOS_APIENTRY
25 | #endif
26 |
27 | #endif /* __gl3platform_h_ */
28 |
--------------------------------------------------------------------------------