demo runs not smoothly on android
The demo program runs not smoothly and stutters on the Android system, but it run smoothly on the iOS system
android runs video:
https://github.com/user-attachments/assets/171e7477-208c-4c9b-a6c2-78f10b81e4ce
the whole code :
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter_scene/camera.dart';
import 'package:flutter_scene/node.dart';
import 'package:flutter_scene/scene.dart';
import 'package:vector_math/vector_math.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
MyAppState createState() => MyAppState();
}
class MyAppState extends State<MyApp> with SingleTickerProviderStateMixin {
double elapsedSeconds = 0;
Scene scene = Scene();
@override
void initState() {
createTicker((elapsed) {
debugPrint("time ${elapsed.inMilliseconds.toDouble() / 1000}");
setState(() {
elapsedSeconds = elapsed.inMilliseconds.toDouble() / 1000;
});
}).start();
Node.fromAsset('build/models/DamagedHelmet.model').then((model) {
model.name = 'Helmet';
scene.add(model);
});
super.initState();
}
@override
Widget build(BuildContext context) {
final painter = ScenePainter(
scene: scene,
camera: PerspectiveCamera(
position: Vector3(sin(elapsedSeconds) * 2, 2, cos(elapsedSeconds) * 2),
target: Vector3(0, 0, 0),
),
);
return MaterialApp(
title: '我的 3D 应用',
home: CustomPaint(painter: painter),
);
}
}
class ScenePainter extends CustomPainter {
ScenePainter({required this.scene, required this.camera});
Scene scene;
Camera camera;
@override
void paint(Canvas canvas, Size size) {
scene.render(camera, canvas, viewport: Offset.zero & size);
}
@override
bool shouldRepaint(covariant CustomPainter oldDelegate) => true;
}
@wangcker did you run using flutter scene locally like in #38 ? I'm curious if were you able to resolve that issue when you ran the demo
@wangcker did you run using flutter scene locally like in #38 ? I'm curious if were you able to resolve that issue when you ran the demo
no,the problem still exists , so change the flutter_scene ref from pub.dev.
@wangcker did you run using flutter scene locally like in #38 ? I'm curious if were you able to resolve that issue when you ran the demo
i fix it #43
Some questions:
- What Android device are you testing this out on?
- Is it real hardware or a simulator?
- Could you paste the full run log? Specifically, I'm interested in the line that says which Impeller backend is in use. For most devices, the Vulkan backend will be used, but for others we'll fall back to the OpenGLES 2 backend (which has different performance characteristics).
- it is hardware
- testing on xiaomi 14 pro
it`s may be producted by memory leak
Hi, I am using moto g power(2021), galaxy 20 FE. I am experiencing the same issue as wangsker. It seems there is memory leak and after running the example demo for 10 mins, the application crashes.