Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom 3D geometry layer does not render on MapLibre map (type: "custom", renderingMode: "3d") #5502

Open
HSUCHING opened this issue Feb 16, 2025 · 1 comment
Labels
need more info Further information is requested

Comments

@HSUCHING
Copy link

maplibre-gl-js version:

5.1.0

@maptiler/sdk version:

3.0.1

Browser:

Google Chrome

Steps to Trigger Behavior
1. Initialize a maplibregl.Map instance with renderingMode: "3d".
2. Add a custom WebGL layer (type: "custom") to render a non-regular 3D object.
3. The map loads, but the custom 3D object does not appear on the map.

`
const map = new maplibregl.Map({
container: "map",
style: "https://api.maptiler.com/maps/streets/style.json?key=YOUR_MAPTILER_KEY",
center: [121.5, 31.2], // Example coordinates
zoom: 15,
pitch: 60,
bearing: 30,
renderingMode: "3d",
});

map.on("load", () => {
map.addLayer({
id: "custom-3d-layer",
type: "custom",
renderingMode: "3d",
onAdd: function (map, gl) {
this.gl = gl;
this.program = gl.createProgram(); // Custom WebGL setup here
// Shader setup, buffer initialization, etc.
},
render: function (gl, matrix) {
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
// WebGL rendering logic for 3D object
},
});
});

.....................
`

Expected Behavior

The custom 3D geometry should render correctly on the map, appearing above the terrain.

Actual Behavior

The custom 3D object does not appear on the map. The map itself loads normally. No errors appear in the console.

This prevents me from rendering custom 3D objects on MapLibre maps using type: "custom" layers. Please advise on possible solutions or workarounds.

Image

@HarelM
Copy link
Collaborator

HarelM commented Feb 16, 2025

There are examples of how to write those, did you try modifying those?

@HarelM HarelM added the need more info Further information is requested label Feb 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need more info Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants