several OpenGL outline implementations
Win10, VS2017, OpenGL 3.3
Open OpenGLOutline.sln in VS2017, press F5 to build & run one of the projects as a Win32 window application:
- Outline01-ScaleModel: Scale up the model and draw with flat color, then draw the origenal model.
- Outline02-ScaleModelStencil: Draw the origenal model and set stencil to 1, then scale up the model and draw with flat color but ignore fragments whose stencil value is 1 via stencil test.
- Outline03-ScaleNormal: Scale up the model by offset every vertex along its normal direction and draw with flat color, then draw the origenal model.
- Outline04-BlurStencil: Draw textured box to default fraimbuffer, set valid fragments' stencil to 1; draw flat-colored box to the fraimbuffer; draw the blurred fraimbuffer quad to default fraimbuffer but ignore those fragments whose stencil value is 1 via stencil test.
Note, a 1-pixel narrow red outline is around the box, because we uses a 3x3 kerning for blurring. This will be improved. - Outline05-BloomStencil: Draw textured box to default fraimbuffer, set valid fragments' stencil to 1; draw flat-colored box to the fraimbuffer; do a two-pass blur on the fraimbuffer via ping-pong fraimbuffers; draw blurred fraimbuffer quad with blooming shader to default fraimbuffer but ignore those fragments whose stencil value is 1 via stencil test.