1 module evael.graphics.FrameBuffer; 2 3 import evael.graphics.GraphicsDevice; 4 import evael.graphics.Texture; 5 6 /** 7 * FrameBuffer. 8 */ 9 class FrameBuffer 10 { 11 protected GraphicsDevice m_graphicsDevice; 12 protected uint m_id; 13 protected Texture m_texture; 14 15 /** 16 * FrameBuffer constructor. 17 * Params: 18 * graphics : graphics device 19 * width : width 20 * height : height 21 */ 22 @nogc 23 public this(GraphicsDevice graphics, in int width, in int height) nothrow 24 { 25 this.m_graphicsDevice = graphics; 26 27 gl.GenFramebuffers(1, &this.m_id); 28 } 29 30 /** 31 * FrameBuffer destructor. 32 */ 33 @nogc 34 public void dispose() const nothrow 35 { 36 gl.DeleteFramebuffers(1, &this.m_id); 37 } 38 39 /** 40 * Properties 41 */ 42 @nogc @safe 43 @property pure nothrow 44 { 45 public uint id() const 46 { 47 return this.m_id; 48 } 49 50 public Texture texture() 51 { 52 return this.m_texture; 53 } 54 } 55 }