Framebuffer.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #ifndef LOVE_GRAPHICS_FRAMEBUFFER_H
  2. #define LOVE_GRAPHICS_FRAMEBUFFER_H
  3. #include <graphics/Drawable.h>
  4. #include <graphics/Volatile.h>
  5. #include <graphics/Image.h>
  6. #include <graphics/Color.h>
  7. #include <image/Image.h>
  8. #include <image/ImageData.h>
  9. #include <common/math.h>
  10. #include "GLee.h"
  11. namespace love
  12. {
  13. namespace graphics
  14. {
  15. namespace opengl
  16. {
  17. class Framebuffer : public Drawable, public Volatile
  18. {
  19. public:
  20. Framebuffer(int width, int height);
  21. virtual ~Framebuffer();
  22. static bool isSupported();
  23. unsigned int getStatus() const { return status; }
  24. static Framebuffer* current;
  25. static void bindDefaultBuffer();
  26. void startGrab();
  27. void stopGrab();
  28. void clear(const Color& c);
  29. virtual void draw(float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky) const;
  30. love::image::ImageData * getImageData(love::image::Image * image);
  31. void setFilter(const Image::Filter &f);
  32. Image::Filter getFilter() const;
  33. void setWrap(const Image::Wrap &w);
  34. Image::Wrap getWrap() const;
  35. int getWidth();
  36. int getHeight();
  37. bool loadVolatile();
  38. void unloadVolatile();
  39. private:
  40. friend class PixelEffect;
  41. GLuint getTextureName() const { return img; }
  42. GLsizei width;
  43. GLsizei height;
  44. GLuint fbo;
  45. GLuint depthbuffer;
  46. GLuint img;
  47. vertex vertices[4];
  48. GLenum status;
  49. struct {
  50. Image::Filter filter;
  51. Image::Wrap wrap;
  52. } settings;
  53. };
  54. } // opengl
  55. } // graphics
  56. } // love
  57. #endif // LOVE_GRAPHICS_FRAMEBUFFER_H