WarpingC.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*: Demonstrates how to use texture coordinates to warp an image.
  2. Load an image (preferably with dimensions a power of two, not too big,
  3. and less than 256x256 if you have and old hardware, all TNT, GeForce,
  4. Radeon and better should have no trouble loading big pictures), then click
  5. somewhere in the image to define the warp point.<br>
  6. You may use the menu to adjust or choose the effect.
  7. This sample displays an image with the help of a single TGLHeightField used
  8. as a convenient way to specify texture coordinates. The camera is in
  9. orthogonal mode and adjusted along with the viewer to a ratio of 1:1.
  10. All the warping code is in the TForm1.HeightFieldGetHeight event (the two
  11. warping codes actually), the rest are just utility methods to load/save,
  12. adjust settings etc.
  13. */
  14. //---------------------------------------------------------------------------
  15. #include <vcl.h>
  16. #pragma hdrstop
  17. USEFORM("fWarpingC.cpp", Form1);
  18. //---------------------------------------------------------------------------
  19. WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
  20. {
  21. try
  22. {
  23. Application->Initialize();
  24. Application->CreateForm(__classid(TForm1), &Form1);
  25. Application->Run();
  26. }
  27. catch (Exception &exception)
  28. {
  29. Application->ShowException(&exception);
  30. }
  31. return 0;
  32. }
  33. //---------------------------------------------------------------------------