The Open Source BlitzMax Compiler Project.
bmx-ng / gfx.mod Goto Github PK
View Code? Open in Web Editor NEWbgfx rendering library backend for BlitzMax
bgfx rendering library backend for BlitzMax
Once shader support is implemented, we should probably have a set of basic Max2D friendly shaders integrated.
These would allow us to do the basic rendering that the Max2D API requires.
bgfx requires textures to be of a certain format : DDS, KTX or PVR texture data.
We don't currently have a direct way to take (say) a .png and load it as a bgfx texture instance.
There is a command-line texture compiler available with bgfx. This may be all that's required, and assume that the developer will convert their images into a compatible format - which could then be loaded by the app at runtime (incbin/stream/etc).
Or we port/wrap the texture compiler so that it can be used inline.
Ferdi from the cerberus-x,com community is trying to bring in bgfx to cerberus (prior Monkey-x).
Maybe his works can be of help for us:
https://github.com/Ferddi/cxbgfx
thinking about getting primitives etc to work.
The initial commit of bgfxgraphics only supports Win32.
We will need to implement support for Linux.
Some platforms support different renderers : Win32 -> GL, Dx9, Dx11 : macOS -> GL, metal...
It would be nice if there was an easy way we could select the renderer, for example via the Graphics statement...
Unfortunately, adding them as bit-wise "flags" would be an issue as there aren't many free bits left, so we'd either need add a new argument or allow it to be set another way, eg. via a SetBGFXRenderer(BGFX_RENDERER_TYPE_VULKAN)
Note that the renderer can only be set once.
Just to keep it noted down - might be of use later on: a comprehensive guide on how to write some shaders we might later provide as "templates" for easy addition:
bgfx shaders are based on the glsl standard, with a few tweaks to make it easier to compile them into shaders for all the supported platforms.
This means you can effectively write one shader to work with GL, metal and direct x.
bgfx comes with a command-line shader compiler which generates the required shaders for a given platform, which you then include in your app. This may be all that's required, and assume that the developer will compile their shaders and just include them, precompiled, with their app.
Or we port/wrap the shader compiler so that it can be used inline.
Hi
Just want to ask whether you plan to upload the wrapper somewhen.
I thought of having seen it already, but am not able to find it. So this is why I ask.
The initial commit of bgfxgraphics only supports Win32.
We will need to implement support for macOS.
Import "-ldl"
is needed in the example file "bx.mod/examples/matrix.bmx" to get it compile on Linux.
After the initial commit, the gfx.bgfxmax2d module is basically the bare minimum to get a window and render loop up and running.
The drawing APIs are stubs.
There's no support for textures.
There's no support for shaders.
There's are the main bits that require implementing for basic Max2D.
Currently, on my laptop at least, anything other than the direct3d9 renderer fails to correctly establish the context on the given window.
It looks like it may be related to hidpi.
The "basic" example, appears to start okay, but moving the window shows that the actual graphics are rendering at a much higher dpi in the top left corner of the screen - moving the window to the top left and the rendered text appears in the window.
Since one render target appears to be working, we can carry on using this until the issue is resolved.
A basic Linux OpenGL test worked as expected.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.