Nxna2
|
Nxna2 is primarily a cross-platform wrapper around OpenGL and Direct3D. Write your graphics code once with Nxna2 and get maximum portability!
Compiling Nxna2 is simple. The easiest thing to do is this:
Now whenever you need to use Nxna2, just #include the header file you created.
The first thing to do is to create a new window, along with an OpenGL context if you intend to use the OpenGL renderer or a Direct3D device and device context if you intend to use Direct3D. It's your responsibility to set up the window and context/device. Nxna2 won't do it. That's so that you have complete control over the window creation process without Nxna2 getting in the way.
Next, you'll need to create a new GraphicsDevice object, which will act as a wrapper around whatever API you choose. You do that by filling out an Nxna::Graphics::GraphicsDeviceDesc struct and pass that to Nxna::Graphics::GraphicsDevice::CreateGraphicsDevice().
To create a new OpenGL device:
To create a Direct3D 11 device:
To be continued...
Basically, you just create a bunch of state objects by passing ...Desc to GraphicsDevice::Create...(), then call GraphicsDevice::Set...() with that new object. Then you create your index buffers and vertex buffer and constant buffers, set those two, and then render.
Nxna2 has lots of objects, like BlendState, VertexBuffer, etc, that have unions with different OpenGL and Direct3D references in them. Generally you should treat those objects as completely opaque and not mess around with what is inside. But if you want to, go for it.