LargeGLFWFramebuffer. It defaults to OpenGL, and creation via native API (OSMesa is an option via LWJGL).
GLFWCapableBuffer#changeRenderingThreadToCurrent()to bind the rendering context to the current thread. Then call
GLFWCapableBuffer#render(Runnable)to render your content. This will call the
Runnableargument, swap the invisible window buffer, extract the framebuffer pixels and convert to map colors. The map colors are available via
Framebuffer#toMapColors()if you do not use
renderis highly recommended to ensure Minestom grab the contents of the framebuffer and converts the pixels to map colors.
setupRenderLoop(long period, TimeUnit unit, Runnable renderCode).
periodis a long, representing the period between two render calls. Expressed in
unitunit in which the period is expressed
renderCodeyour render code.
period. It also binds to the correct thread before rendering for the first time.
GLFWCapableBuffer#useMapColors()will tell the framebuffer that you are not rendering with RGB directly, but with map colors. The map color is in this case encoded in the RED channel of the framebuffer. When grabbing the pixels from the framebuffer for processing, Minestom will only query the red channel and interpret the red intensity as the index inside the color palette. If you want to use this mode manually, you can always convert a color index to a color intensity by simply dividing the index by
/shaders/mapcolorconvert.vertex.glsla simple vertex shader to render a full-screen quad
/shaders/mapcolorconvert.fragment.glslfragment shader responsible for converting RGB to map colors
/textures/palette.pngthe color palette used by maps. Can be autogenerated via
net.minestom.server.map.PaletteGenerator, outputs to