- Substantially compatible with the D3DLIBA (for BB4W), ogllib (for desktop BBCSDL) and gleslib (for mobile BBCSDL) libraries.
- Implemented using shader programs rather than the legacy Fixed Function Pipeline used by the other libraries.
- Uses retained mode rather than immediate mode; there are no client-side arrays and all objects are stored in GPU memory. This is necessary for compatibility with WebGL and OpenGLES 2.0, and also offers some performance benefits.
- Alpha-blending and specular reflections are always enabled, they can only be disabled by explicitly setting the alpha to 1.0 and the specular component of lights and/or textures to 0.0. However the alpha value is taken only from the vertex parameters or a texture, not from a material.
- Lighting calculations always take account of the sign of the normal vector. This is different from the way the Fixed Function Pipeline works and you may need to reverse the direction of the normal to achieve compatibility. Face culling works as expected so you may need to arrange that the direction of the normal corresponds to the vertex winding order. Two-sided textures are not supported
- There is a maximum of five lights (although this could be increased). These may be point-source, directional or spotlight, but there is currently no support for falloff with distance, and the spotlight cone has a hard boundary.
- Although the library is primarily intended to be used with the in-browser edition of BBCSDL (WebGL) it is compatible with OpenGL and OpenGLES 2.0 so should also work on other platforms. This may provide some performance benefits, such as per-pixel lighting calculations.
Notes on the webgllib library
Notes on the webgllib library
The webgllib.bbc library has been written primarily to support 3D graphics on the in-browser (Emscripten / Web Assembly) edition of BBC BASIC for SDL 2.0. Here are some of its features:
Re: Notes on the webgllib library
I've realised this is misleading. The alpha component is always output from my shader code, but the blending of different objects downstream of the shader still needs to be explicitly enabled:RichardRussell wrote: ↑Sun 11 Oct 2020, 16:17[*]Alpha-blending and specular reflections are always enabled
Code: Select all
GL_BLEND = &0BE2
GL_SRC_ALPHA = &0302
GL_ONE_MINUS_SRC_ALPHA = &0303
SYS FN_gpa("glEnable"), GL_BLEND, @memhdc%
SYS FN_gpa("glBlendFunc"), GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, @memhdc%
Re: Notes on the webgllib library
In recent versions of webgllib alpha-blending can be enabled by setting bit 1 of (i.e. adding 2 to) the third parameter of FN_initgl():RichardRussell wrote: ↑Sun 11 Oct 2020, 23:19 I've realised this is misleading. The alpha component is always output from my shader code, but the blending of different objects downstream of the shader still needs to be explicitly enabled:
Code: Select all
pdev% = FN_initgl(hw%%, cull%, light_blend%)