According to Dev, Codename One is introducing a significant shift in how developers handle 3D graphics across diverse operating systems. The new com.codename1.gpu package provides a portable API where applications never require the developer to write shader source code manually. Instead, the framework handles the complexity of translating high-level material descriptions into platform-specific instructions.
Abstracting complex shader languages
Traditionally, cross-platform 3D development requires managing multiple distinct graphics APIs and shading languages. Developers often have to write specific code for Metal Shading Language on Apple devices, GLSL for Android and WebGL, and HLSL for Windows. Codename One addresses this fragmentation by allowing developers to define a Material object that specifies lighting models, colors, textures, and shininess.
The framework then employs per-platform generators to emit the correct shader code automatically. This approach supports five distinct GPU backends from a single Java or Kotlin codebase:
Integration with standard 3D assets
The API is designed to work with industry-standard tools rather than just basic primitives. It includes a GltfLoader capable of reading binary glTF (.glb) files, which is the primary interchange format for software like Blender. This allows developers to ship complex models as regular project resources that load consistently across all platforms.
By integrating 3D components into a standard layout system, the framework ensures that 3D views can sit alongside traditional UI elements like buttons and labels. The inclusion of a deterministic software rasterizer for headless environments also ensures that automated screenshot tests can verify 3D output consistently across all deployment targets.
This architectural shift significantly lowers the barrier to entry for high-performance graphics in mobile and desktop applications. By removing the need for manual shader management, Codename One enables developers to focus on content and logic while the framework handles the underlying hardware abstraction.