Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

If you have any questions, reports, suggestions, or requests about Live2D, please send them to this forum.
※We cannot guarantee statements or answers from Live2D staff. Thank you for your understanding in advance.
 
Live2D Cubism
Cubism Products and Downloads
Cubism product manuals and tutorials
Cubism Editor Manual    Cubism Editor Tutorial    Cubism SDK Manual    Cubism SDK Tutorial
[About macOS Sequoia] (Updated October 22, 2024)
Live2D Cubism Editor 5.1.02 now supports macOS Sequoia.
Other Live2D Cubism products currently released are not guaranteed to work on macOS Sequoia.
Please refrain from upgrading macOS, as it may not operate properly.

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)]

Comments

Sign In or Register to comment.