I’m constructing a 3D engine and have a rendering abstraction that focuses on writing shaders. Most my 3D shaders have
gl_Position output like:
gl_Position = projection * view * mannequin * vec4(place, 1);
I want to draw some 2D UI on high of all of the 3D draw calls. I’m having a tough time understanding how to do that.
For instance I wished to attract a HUD participant life bar that’s mounted to the underside left nook of the display screen. I can think about drawing a quad. and perhaps making use of a texture to it. I’d have four vertices for the quad to feed to the shader. How would I alter the
gl_Position calculation to deal with drawing solely to 2D display screen area? Would I replace the transformation to solely apply the
gl_Position = projection * vec4(place, 0, 1);
How you can decide the native coordinates of the quad verts? When the display screen scales or decision varies, How to make sure the quad stays positioned to the decrease backside display screen? How to make sure the quad dimensions keep the identical ratio?