Framebuffer.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. unsigned int getStatus() const { return status; }
  23. static Framebuffer* current;
  24. static void bindDefaultBuffer();
  25. void startGrab();
  26. void stopGrab();
  27. void clear(const Color& c);
  28. virtual void draw(float x, float y, float angle, float sx, float sy, float ox, float oy) const;
  29. love::image::ImageData * getImageData(love::image::Image * image);
  30. void setFilter(const Image::Filter &f);
  31. Image::Filter getFilter() const;
  32. void setWrap(const Image::Wrap &w);
  33. Image::Wrap getWrap() const;
  34. bool loadVolatile();
  35. void unloadVolatile();
  36. private:
  37. GLsizei width;
  38. GLsizei height;
  39. GLuint fbo;
  40. GLuint depthbuffer;
  41. GLuint img;
  42. vertex vertices[4];
  43. GLenum status;
  44. struct {
  45. Image::Filter filter;
  46. Image::Wrap wrap;
  47. } settings;
  48. };
  49. } // opengl
  50. } // graphics
  51. } // love
  52. #endif // LOVE_GRAPHICS_FRAMEBUFFER_H