- Right now, the 2D visualization of the maps and vehicles uses the
Graphics2Djava class inside the
- This is not a very efficient rendering method, especially for large scale cities.
- It is also not precise: the polygon geometry can only be passed with integer pixel positions.
Use OpenGL rendering.
- As OpenGL library (for example): JOGL
- Test a simple 2D triangle with a basic shader.
- Make it build and run using the JOGL maven artifacts.
- Make a colored triangle shader with an orthogonal view matrix, test binding it to the map controls (position, zoom). Render a simple triangle (or 2)
- Make a colored line shader, same view matrix, test a simple outline.
- Generate the building geometry in one VBO/VAO/EBO set.
- Use the already split convex parts
- The convex polygon parts can be rendered using the
- In combination with the Primitive Restart
- Use an Element-Buffer
- Use the
PRIMITIVE_RESTARTindex to separate triangle fans for different polygons
- Since we only want to draw contiguous vertices, the
glMultiDrawElements()method can be useful
- Generate the road geometry (or visualization lines)
- Generate the vehicle geometry (one VBO/EBO/VAO set)
- Same triangle shader, but give it a view+model matrix (pre-multiplied)
- All the debug lines/elements (AABB, building outlines, ...) can be in their own VBO/EBO/VAO.
- Check the thread interaction between Swing and OpenGL. The OpenGL calls are not thread-safe for a given context. Be sure that the OpenGL calls happen in the correct thread.
Note: The existing visualization already "pre-generates" the geometry in some way to save computation. Changing to save this geometry in OpenGL buffer would not be a big change.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information