1
1

renderTarget.d 628 B

1234567891011121314151617181920212223
  1. module three.renderTarget;
  2. import three.gl.util;
  3. struct RenderTarget {
  4. uint width;
  5. uint height;
  6. GLuint textureTarget;
  7. void construct(uint width, uint height) nothrow {
  8. this.width = width;
  9. this.height = height;
  10. glCheck!glGenTextures(1, &this.textureTarget);
  11. glCheck!glBindTexture(GL_TEXTURE_2D, this.textureTarget);
  12. glCheck!glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA32F, width, height);
  13. glCheck!glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RGBA, GL_FLOAT, null);
  14. glCheck!glBindTexture(GL_TEXTURE_2D, 0);
  15. }
  16. void destruct() nothrow {
  17. glCheck!glDeleteTextures(1, &this.textureTarget);
  18. }
  19. }