Cross-platform 3D is one of those problems that looks impossible when you list the constraints. iOS wants Metal and Metal Shading Language. Android wants OpenGL ES and GLSL. The web wants WebGL. Windows wants Direct3D and HLSL. Every one of these has its own shader language, its own pipeline model, and its own buffer semantics. Most portable engines solve this by making you write shaders multiple times, or by adopting a giant dependency that becomes your whole application.

What is Codename One? Codename One is an open-source framework for building native iOS, Android, desktop, and web apps from a single Java or Kotlin codebase. Learn more at codenameone.com.

PR #5151 takes a different path. The new com.codename1.gpu package is a portable 3D API where applications never write shader source at all. You describe a Material: its lighting model, color, texture, shininess. Per-platform generators emit the actual shader, GLSL ES on Android and WebGL, Metal Shading Language on iOS and Mac, HLSL on the new native Windows port. One Java code base, five GPU backends.

A cube in one screen of code

The API centers on a Renderer you implement and a RenderView that hosts it. Here is a complete Phong-lit cube: