culling.cpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*: Visibility culling demo/test/sample.
  2. This sample is used to test and showcase the efficiency (or inefficiency) of
  3. visibility in various cases. Be aware that the sample may be slow loading
  4. (the same mesh is loaded multiple times to put some stress).<br>
  5. In each of the tests, a "square grid" of objects is created and made visible,
  6. the camera points at the center of the square, making most of the objects
  7. off-screen. Visibility culling detects that and does not render the off-screen
  8. or too-far away objects.
  9. <ul>
  10. <li>Spheres: this is the default setting, and one in which culling is
  11. completely inefficient on a T&L board or good OpenGL ICD, mainly because
  12. the spheres are rendered with build lists that already have some visibility
  13. culling built-in. If culling is efficient for you in this case, well be
  14. happy it is, but start looking for a newer graphics board ;)
  15. <li>Actors: this one is culling friendly, and your framerate can more than
  16. double by choosing "ObjectBased" mode. This is due to the fact that the
  17. actor geometry must be resent at each frame, thus limiting T&L capability
  18. (the AGP stands in the way...). A culled object's geometry is not sent
  19. at all, and that can reduce the AGP and graphics driver load drastically.
  20. </ul>
  21. */
  22. //---------------------------------------------------------------------------
  23. #include <vcl.h>
  24. #pragma hdrstop
  25. USERES("culling.res");
  26. USEFORM("Unit1.cpp", Form1);
  27. //---------------------------------------------------------------------------
  28. WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
  29. {
  30. try
  31. {
  32. Application->Initialize();
  33. Application->CreateForm(__classid(TForm1), &Form1);
  34. Application->Run();
  35. }
  36. catch (Exception &exception)
  37. {
  38. Application->ShowException(&exception);
  39. }
  40. return 0;
  41. }
  42. //---------------------------------------------------------------------------