| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A native Java binding for the Live2D Cubism SDK, enabling seamless integration of Live2D models in Java applications.
For detailed documentation, please visit our Wiki.
JNI (Java Native Interface) is a programming framework that enables Java code to interact with native applications and libraries written in languages like C or C++. In this project:
For more details on JNI, refer to the official Oracle JNI documentation.
Here's a simple example to get you up and running:
import dev.eatgrapes.live2d.CubismFramework;
import dev.eatgrapes.live2d.CubismUserModel;
// 1. Initialize the Framework
CubismFramework.startUp();
CubismFramework.makeGL(); // or CubismFramework.makeVulkan(...)
CubismFramework.initialize();
// 2. Load Model & Components
CubismUserModel model = new CubismUserModel();
model.loadModel(moc3Bytes); // Load model data
model.loadPose(poseBytes); // Load pose data
model.loadPhysics(physicsBytes); // Load physics data
// 3. Setup Renderer
model.createRenderer();
model.registerTexture(0, openGLTextureId); // OpenGL texture
// Vulkan: model.registerTextureVulkan(index, width, height, rgbaPixels);
// 4. Handle Interactions & Motions
model.setDragging(nx, ny); // Enable eye tracking or dragging
model.startMotion(motionBytes, priority, loop, name -> {
System.out.println("Motion finished!"); // Callback on completion
});
// 5. Update & Draw (in your main render loop)
model.update(deltaTime); // Update model state
model.draw(mvpMatrix); // Render the modelFor Vulkan, update render target each frame before draw:
model.setVulkanRenderTarget(vkImage, vkImageView, vkFormat, width, height);Run the following in the project root:
python3 scripts/build.pyThis will generate artifacts in the out/ directory:
OpenGL and Vulkan are bundled into the same shared/native dependencies. No extra Vulkan-only JAR is required.
We welcome Pull Requests (PRs)! Whether it's implementing additional SDK features, enhancing platform support, or fixing bugs, your help is appreciated. Please follow these steps:
| Back | FazBrowse Home | New Git URL |