example_myApplication.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #ifndef VWK_MY_TEST_APPLICATION_H
  2. #define VWK_MY_TEST_APPLICATION_H
  3. #include <vkw/VulkanApplication.h>
  4. #include <iostream>
  5. #include <cassert>
  6. class MyApplication : public vkw::Application
  7. {
  8. // Application interface
  9. public:
  10. void initResources() override
  11. {
  12. // The following can be used here
  13. // getDevice();
  14. // getPhysicalDevice();
  15. // getInstance();
  16. std::cout << "initResources() " << std::endl;
  17. }
  18. void releaseResources() override
  19. {
  20. // The following can be used here
  21. // getDevice();
  22. // getPhysicalDevice();
  23. // getInstance();
  24. std::cout << "releaseResources() " << std::endl;
  25. }
  26. void initSwapChainResources() override
  27. {
  28. // The following can be used here
  29. // swapchainImageCount();
  30. // swapchainImage( index );
  31. // colorFormat();
  32. // depthStencilFormat();
  33. // swapchainImageSize();
  34. // swapchainImageView();
  35. std::cout << "initSwapchainResources() " << std::endl;
  36. }
  37. void releaseSwapChainResources() override
  38. {
  39. std::cout << "releaseSwapChainResources() " << std::endl;
  40. }
  41. void render( vkw::Frame &frame) override
  42. {
  43. assert( frame.depthImage != VK_NULL_HANDLE);
  44. frame.clearColor.float32[0] = 0.0f;
  45. //frame.clearColor.float32[1] = 1.0f;
  46. //frame.clearColor.float32[2] = 1.0f;
  47. //frame.clearColor.float32[3] = 1.0f;
  48. frame.beginRenderPass( frame.commandBuffer );
  49. frame.endRenderPass(frame.commandBuffer);
  50. // request the next frame
  51. // so that this function will be called again
  52. requestNextFrame();
  53. }
  54. };
  55. #endif