Skip to main content

ent_opengl 0.1.0-dev.4 copy "ent_opengl: ^0.1.0-dev.4" to clipboard
ent_opengl: ^0.1.0-dev.4 copied to clipboard

The OpenGL ES renderer of Ent Engine: the shared renderer core drawing through OpenGL ES 3, on ANGLE (Metal) on macOS and on the system's OpenGL ES on Android.

example/main.dart

// A lit cube turning in an EntView, drawn with OpenGL ES; drag to orbit, scroll or pinch to zoom. The app around it
// registers the one shader variant it draws with, "physical" (MeshStandardMaterial), under ent_opengl (README,
// Getting started). The repository's examples/cube is a whole app around this renderer.

import 'package:ent_opengl/ent_opengl.dart';
import 'package:material_ui/material_ui.dart' hide Color, Texture;

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  final renderer = await OpenGlRenderer.create(antialias: true);
  final camera = PerspectiveCamera(60, 1, 0.1, 100)
    ..position.set(0, 1.5, 4)
    ..lookAt(Vector3(0, 0, 0));
  final cube = Mesh(BoxGeometry(1, 1, 1), MeshStandardMaterial({'color': 0x44aa88, 'roughness': 0.4}));
  final scene = Scene()
    ..background = Color(0x202020)
    ..add(cube)
    ..add(AmbientLight(0xffffff, 0.3))
    ..add(DirectionalLight(0xffffff, 2)..position.set(3, 5, 2));
  final controls = OrbitControls(camera)..enableDamping = true;

  runApp(
    MaterialApp(
      home: OrbitControlsListener(
        controls: controls,
        child: EntView(
          renderer: renderer,
          scene: scene,
          camera: camera,
          onFrame: (elapsed) {
            cube.rotation.y = elapsed.inMicroseconds / 1e6;

            // Damping needs an update every frame.
            controls.update();
          },
        ),
      ),
    ),
  );
}
0
likes
160
points
0
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

The OpenGL ES renderer of Ent Engine: the shared renderer core drawing through OpenGL ES 3, on ANGLE (Metal) on macOS and on the system's OpenGL ES on Android.

Repository (GitHub)
View/report issues

Topics

#graphics #rendering #opengl

License

MIT (license)

Dependencies

code_assets, ent, ent_impeller, ent_renderer, ffi, flutter, hooks, vector_math, wrangle

More

Packages that depend on ent_opengl

Packages that implement ent_opengl