TextureFormat.cpp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #include "wrapper/TextureFormat.h"
  2. TextureFormat::TextureFormat(GLint internalformat, GLenum format, GLenum type, bool depth) :
  3. internalformat(internalformat), format(format), type(type), depth(depth) {
  4. }
  5. TextureFormat TextureFormat::color1() {
  6. return TextureFormat(GL_RED, GL_RED, GL_UNSIGNED_BYTE);
  7. }
  8. TextureFormat TextureFormat::color2() {
  9. return TextureFormat(GL_RG, GL_RG, GL_UNSIGNED_BYTE);
  10. }
  11. TextureFormat TextureFormat::color3() {
  12. return TextureFormat(GL_RGB, GL_RGB, GL_UNSIGNED_BYTE);
  13. }
  14. TextureFormat TextureFormat::color4() {
  15. return TextureFormat(GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE);
  16. }
  17. TextureFormat TextureFormat::float16() {
  18. return TextureFormat(GL_R16F, GL_RED, GL_FLOAT);
  19. }
  20. TextureFormat TextureFormat::float32() {
  21. return TextureFormat(GL_R32F, GL_RED, GL_FLOAT);
  22. }
  23. TextureFormat TextureFormat::float16Vector2() {
  24. return TextureFormat(GL_RG16F, GL_RG, GL_FLOAT);
  25. }
  26. TextureFormat TextureFormat::float16Vector3() {
  27. return TextureFormat(GL_RGB16F, GL_RGB, GL_FLOAT);
  28. }
  29. TextureFormat TextureFormat::float16Vector4() {
  30. return TextureFormat(GL_RGBA16F, GL_RGBA, GL_FLOAT);
  31. }
  32. TextureFormat TextureFormat::float32Vector2() {
  33. return TextureFormat(GL_RG32F, GL_RG, GL_FLOAT);
  34. }
  35. TextureFormat TextureFormat::float32Vector3() {
  36. return TextureFormat(GL_RGB32F, GL_RGB, GL_FLOAT);
  37. }
  38. TextureFormat TextureFormat::float32Vector4() {
  39. return TextureFormat(GL_RGBA32F, GL_RGBA, GL_FLOAT);
  40. }
  41. TextureFormat TextureFormat::depth16() {
  42. return TextureFormat(GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_FLOAT, true);
  43. }
  44. TextureFormat TextureFormat::depth32() {
  45. return TextureFormat(GL_DEPTH_COMPONENT32, GL_DEPTH_COMPONENT, GL_FLOAT, true);
  46. }