[Notice of Holidays]
Please note that our staff will not be available from 2024/Dec/28 - 2025/Jan/5 JST.
The Live2D Creators Forum will remain open during the holidays.
Submissions that require a response will be answered after we reopen for business.
Please note that it will take longer than usual to respond to your request.
Live2D pageview switch with in flutter andorid
i use live2d cubism sdk for java and following sample code
class MainActivity : FlutterActivity() {
private var live2dView: Live2dView? = null
private val CHANNEL = "com.example.flutter_glass_llm/platform"
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine)
GeneratedPluginRegistrant.registerWith(flutterEngine)
flutterEngine
.platformViewsController
.registry
.registerViewFactory("live2d-view", Live2dViewFactory())
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL).setMethodCallHandler { call, result ->
when (call.method) {
//"updateTextView" -> {
// val text = call.argument("text")
// live2dView?.updateTextView(text ?: "")
// result.success(null)
//}
"controlCharacter" -> {
val action = call.argument("action")
live2dView?.controlCharacter(action ?: "")
result.success(null)
}
else -> {
result.notImplemented()
}
}
}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if(live2dView == null){
live2dView = Live2dView(this)
}
}
override fun onStart() {
super.onStart()
live2dView?.onStart(this as Activity)
}
override fun onResume() {
super.onResume()
//live2dView?.onResume()
live2dView?.onStart(this as Activity)
}
override fun onPause() {
super.onPause()
//live2dView?.onPause()
live2dView?.onStart(this as Activity)
}
override fun onStop() {
super.onStop()
//live2dView?.onStop()
live2dView?.onStart(this as Activity)
}
override fun onDestroy() {
super.onDestroy()
live2dView?.onDestroy()
}
// Method to update the TextView content
//fun updateLive2dTextView(text: String) {
// live2dView?.updateTextView(text)
//}
}
i have two pages in this app, it's correct when initialized, but if i switch page to non-live2d and switch back, the render result is black. the error log is as following
I/PlatformViewsController( 4496): PlatformView is using SurfaceProducer backend
E/OpenGLRenderer( 4496): Unable to match the desired swap behavior.
D/[APP] ( 4496): [CSM][W]CubismFramework.initialize() skipped, already initialized.
E/emuglGLESv2_enc( 4496): device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glUseProgram:2266 GL error 0x501 condition [program && !shared->isShaderOrProgramObject(program)]
E/emuglGLESv2_enc( 4496): device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glDrawElements:1479 GL error 0x506 condition [ctx->m_state->checkFramebufferCompleteness(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE]
E/emuglGLESv2_enc( 4496): device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glUseProgram:2266 GL error 0x501 condition [program && !shared->isShaderOrProgramObject(program)]
0 ·
Comments
Thanks for using our products.
For our investigation, please store the smallest project file that reproduces the problem in the data box below.
https://biz.datadeliver.net/posts/Fs9TJArtP5B2
Best regards
Thank you for providing the project.
I have set up the Flutter environment and executed the project, and the app started and the sample ran without any problems.
Checking the log you originally posted, it appears that there is an invalid input error (0x501) in glUseProgram() and no swap operation was performed immediately prior to that error.
Please check the execution environment for any problems with the renderer or settings.
This error is not reproduced in our execution environment.
Best regards.
Sorry for the late reply, we have confirmed the phenomenon.
We initially thought that a newer API version of Android was causing this error, but it appears that the error is caused by the Cubism SDK.
We are currently working on a fix and will fix it in the next release of the Cubism SDK.
Best regards.