MultiPass.dpr 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. {: Simple TGLShader based multipass demo.
  2. This demo uses a custom TGLShader subclass to implement the classic
  3. multipass hidden lines rendering technique on a torus: first pass renders
  4. model with filled triangles, second pass does the wireframe.
  5. You'll also note the glPolygonOffset call, it displaces fragments depths
  6. value a little "farther away" so that surface fill depth values do not
  7. interact with the rendering of the lines (comment out the call and you'll
  8. see).
  9. The axis and sphere allow you to see the limit of that simple technique:
  10. it actually "paints" between the lines, so you cannot use it to make
  11. transparent wireframed objects with hidden lines - if that thought ever
  12. blossomed in your mind ;)
  13. Additionnal objects around the show a glow/toon edges effect achieved in two
  14. passes too: the 1st pass activate lines and gives them a width, the second
  15. is used to fill the surface (and clear the lines that aren't on edges).
  16. (TOutLineShader thanks to Delauney Jerome, [email protected])
  17. }
  18. program MultiPass;
  19. uses
  20. Forms,
  21. fMultiPass in 'fMultiPass.pas' {FormMultiPath};
  22. {$R *.res}
  23. begin
  24. Application.Initialize;
  25. Application.CreateForm(TFormMultiPath, FormMultiPath);
  26. Application.Run;
  27. end.