Stage.TextureFormat.pas 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945
  1. //
  2. // The graphics engine GLScene
  3. //
  4. unit Stage.TextureFormat;
  5. (* Texture formats and functions *)
  6. interface
  7. uses
  8. Winapi.OpenGL,
  9. Winapi.OpenGLext,
  10. Stage.OpenGLTokens,
  11. Stage.Strings;
  12. type
  13. // Texture addressing rules
  14. TglSeparateTextureWrap = (twRepeat, twClampToEdge, twClampToBorder,
  15. twMirrorRepeat, twMirrorClampToEdge, twMirrorClampToBorder);
  16. (* Specifies the texture comparison mode for currently bound depth textures.
  17. That is, a texture whose internal format is tfDEPTH_COMPONENT* *)
  18. TglTextureCompareMode = (tcmNone, tcmCompareRtoTexture);
  19. // Filtering quality
  20. TglTextureFilteringQuality = (tfIsotropic, tfAnisotropic);
  21. TglTextureTarget =
  22. (
  23. ttNoShape, ttTexture1D, ttTexture2D, ttTexture3D, ttTexture1DArray,
  24. ttTexture2DArray, ttTextureRect, ttTextureBuffer, ttTextureCube,
  25. ttTexture2DMultisample, ttTexture2DMultisampleArray, ttTextureCubeArray
  26. );
  27. TglTextureSwizzle = (tswRed, tswGreen, tswBlue, tswAlpha, tswZero, tswOne);
  28. TglSwizzleVector = array[0..3] of TglTextureSwizzle;
  29. TglInternalFormat = (
  30. tfALPHA4,
  31. tfALPHA8,
  32. tfALPHA12,
  33. tfALPHA16,
  34. tfDEPTH_COMPONENT16,
  35. tfDEPTH_COMPONENT24,
  36. tfDEPTH_COMPONENT32,
  37. tfLUMINANCE4,
  38. tfLUMINANCE8,
  39. tfLUMINANCE12,
  40. tfLUMINANCE16,
  41. tfLUMINANCE4_ALPHA4,
  42. tfLUMINANCE6_ALPHA2,
  43. tfLUMINANCE8_ALPHA8,
  44. tfLUMINANCE12_ALPHA4,
  45. tfLUMINANCE12_ALPHA12,
  46. tfLUMINANCE16_ALPHA16,
  47. tfINTENSITY4,
  48. tfINTENSITY8,
  49. tfINTENSITY12,
  50. tfINTENSITY16,
  51. tfR3_G3_B2,
  52. tfRGB4,
  53. tfRGB5,
  54. tfRGB8,
  55. tfRGB10,
  56. tfRGB12,
  57. tfR16G16B16,
  58. tfRGBA2,
  59. tfRGBA4,
  60. tfRGB5_A1,
  61. tfRGBA8,
  62. tfRGB10_A2,
  63. tfRGBA12,
  64. tfR16G16B16A16,
  65. tfCOMPRESSED_RGB_S3TC_DXT1,
  66. tfCOMPRESSED_RGBA_S3TC_DXT1,
  67. tfCOMPRESSED_RGBA_S3TC_DXT3,
  68. tfCOMPRESSED_RGBA_S3TC_DXT5,
  69. tfSIGNED_LUMINANCE8,
  70. tfSIGNED_LUMINANCE8_ALPHA8,
  71. tfSIGNED_RGB8,
  72. tfSIGNED_RGBA8,
  73. tfSIGNED_RGB8_UNSIGNED_ALPHA8,
  74. tfSIGNED_ALPHA8,
  75. tfSIGNED_INTENSITY8,
  76. tfHILO16,
  77. tfSIGNED_HILO16,
  78. tfDSDT8,
  79. tfDSDT8_MAG8,
  80. tfDSDT8_MAG8_INTENSITY8,
  81. tfHILO8,
  82. tfSIGNED_HILO8,
  83. tfFLOAT_R16,
  84. tfFLOAT_R32,
  85. tfFLOAT_RG16,
  86. tfFLOAT_RGB16,
  87. tfFLOAT_RGBA16,
  88. tfFLOAT_RG32,
  89. tfFLOAT_RGB32,
  90. tfFLOAT_RGBA32,
  91. tfRGBA_FLOAT32,
  92. tfRGB_FLOAT32,
  93. tfALPHA_FLOAT32,
  94. tfINTENSITY_FLOAT32,
  95. tfLUMINANCE_FLOAT32,
  96. tfLUMINANCE_ALPHA_FLOAT32,
  97. tfRGBA_FLOAT16,
  98. tfRGB_FLOAT16,
  99. tfALPHA_FLOAT16,
  100. tfINTENSITY_FLOAT16,
  101. tfLUMINANCE_FLOAT16,
  102. tfLUMINANCE_ALPHA_FLOAT16,
  103. tfDEPTH24_STENCIL8,
  104. tfDEPTH_COMPONENT32F,
  105. tfDEPTH32F_STENCIL8,
  106. tfSRGB8,
  107. tfSRGB8_ALPHA8,
  108. tfSLUMINANCE8,
  109. tfSLUMINANCE8_ALPHA8,
  110. tfCOMPRESSED_SRGB_S3TC_DXT1,
  111. tfCOMPRESSED_SRGB_ALPHA_S3TC_DXT1,
  112. tfCOMPRESSED_SRGB_ALPHA_S3TC_DXT3,
  113. tfCOMPRESSED_SRGB_ALPHA_S3TC_DXT5,
  114. tfRGB9_E5,
  115. tfR11F_G11F_B10F,
  116. tfCOMPRESSED_LUMINANCE_LATC1,
  117. tfCOMPRESSED_SIGNED_LUMINANCE_LATC1,
  118. tfCOMPRESSED_LUMINANCE_ALPHA_LATC2,
  119. tfCOMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2,
  120. tfCOMPRESSED_LUMINANCE_ALPHA_3DC,
  121. tfRGBA32UI,
  122. tfRGB32UI,
  123. tfALPHA32UI,
  124. tfINTENSITY32UI,
  125. tfLUMINANCE32UI,
  126. tfLUMINANCE_ALPHA32UI,
  127. tfRGBA16UI,
  128. tfRGB16UI,
  129. tfALPHA16UI,
  130. tfINTENSITY16UI,
  131. tfLUMINANCE16UI,
  132. tfLUMINANCE_ALPHA16UI,
  133. tfRGBA8UI,
  134. tfRGB8UI,
  135. tfALPHA8UI,
  136. tfINTENSITY8UI,
  137. tfLUMINANCE8UI,
  138. tfLUMINANCE_ALPHA8UI,
  139. tfRGBA32I,
  140. tfRGB32I,
  141. tfALPHA32I,
  142. tfINTENSITY32I,
  143. tfLUMINANCE32I,
  144. tfLUMINANCE_ALPHA32I,
  145. tfRGBA16I,
  146. tfRGB16I,
  147. tfALPHA16I,
  148. tfINTENSITY16I,
  149. tfLUMINANCE16I,
  150. tfLUMINANCE_ALPHA16I,
  151. tfRGBA8I,
  152. tfRGB8I,
  153. tfALPHA8I,
  154. tfINTENSITY8I,
  155. tfLUMINANCE8I,
  156. tfLUMINANCE_ALPHA8I,
  157. tfRG32UI,
  158. tfR32UI,
  159. tfRG16UI,
  160. tfR16UI,
  161. tfRG8UI,
  162. tfR8UI,
  163. tfRG32I,
  164. tfR32I,
  165. tfRG16I,
  166. tfR16I,
  167. tfRG8I,
  168. tfR8I,
  169. tfRG8,
  170. tfR8,
  171. tfRG16,
  172. tfR16,
  173. tfRG16F,
  174. tfR16F,
  175. tfRG32F,
  176. tfR32F,
  177. tfCOMPRESSED_RED_RGTC1,
  178. tfCOMPRESSED_SIGNED_RED_RGTC1,
  179. tfCOMPRESSED_RG_RGTC2,
  180. tfCOMPRESSED_SIGNED_RG_RGTC2,
  181. tfR8_SNORM,
  182. tfRG8_SNORM,
  183. tfRGB8_SNORM,
  184. tfRGBA8_SNORM,
  185. tfR16_SNORM,
  186. tfRG16_SNORM,
  187. tfRGB16_SNORM,
  188. tfRGBA16_SNORM
  189. );
  190. (* Texture compression option.
  191. If OpenGL supports it, this will activate a compressed texture format:
  192. tcDefault : uses global default compression option
  193. tcNone : do not use compression
  194. tcStandard : use standard compression, average quality, average rate
  195. tcHighQuality : choose a high-quality, low-speed compression
  196. tcHighSpeed : choose a high-speed, low-quality compression *)
  197. TglInternalCompression = (tcDefault, tcNone, tcStandard, tcHighQuality, tcHighSpeed);
  198. var
  199. vDefaultTextureFormat: TglInternalFormat = tfRGBA8;
  200. vDefaultTextureCompression: TglInternalCompression = tcNone;
  201. const
  202. cDefaultSwizzleVector: TglSwizzleVector = (tswRed, tswGreen, tswBlue, tswAlpha);
  203. // Give a openGL texture format from GLScene texture format
  204. function InternalFormatToOpenGLFormat(intFormat: TGLInternalFormat): Cardinal;
  205. // Give a GLScene texture format from openGL texture format
  206. function OpenGLFormatToInternalFormat(glFormat: Cardinal): TGLInternalFormat;
  207. // Give a pixel size in bytes from texture format or data format
  208. function GetTextureElementSize(intFormat: TGLInternalFormat): Integer; overload;
  209. function GetTextureElementSize(colorFormat: Cardinal; dataType: Cardinal):
  210. Integer; overload;
  211. // Give compatible openGL image format and data type
  212. procedure FindCompatibleDataFormat(intFormat: TGLInternalFormat; out dFormat:
  213. Cardinal; out dType: Cardinal);
  214. (* Give a compressed openGL texture format from GLScene texture format
  215. if format is have not compression than return same openGL format *)
  216. function CompressedInternalFormatToOpenGL(intFormat: TGLInternalFormat): Integer;
  217. // True if texture target supported
  218. function IsTargetSupported(glTarget: Cardinal): Boolean; overload;
  219. function IsTargetSupported(target: TGLTextureTarget): Boolean; overload;
  220. // True if texture format is supported by hardware or software
  221. function IsFormatSupported(intFormat: TGLInternalFormat): Boolean;
  222. // True if texture format is float
  223. function IsFloatFormat(intFormat: TGLInternalFormat): Boolean; overload;
  224. function IsFloatFormat(glFormat: Cardinal): Boolean; overload;
  225. // True if depth texture
  226. function IsDepthFormat(intFormat: TGLInternalFormat): boolean; overload;
  227. function IsDepthFormat(glFormat: Cardinal): Boolean; overload;
  228. // True if texture compressed
  229. function IsCompressedFormat(intFormat: TGLInternalFormat): Boolean; overload;
  230. function IsCompressedFormat(glFormat: Cardinal): Boolean; overload;
  231. // Give generic compressed OpenGL texture format
  232. function GetGenericCompressedFormat(const intFormat: TGLInternalFormat;
  233. const colorFormat: Cardinal; out internalFormat: Cardinal): Boolean;
  234. // Give uncompressed texture format and OpenGL color format
  235. function GetUncompressedFormat(const intFormat: TGLInternalFormat;
  236. out internalFormat: TGLInternalFormat; out colorFormat: Cardinal): Boolean;
  237. function DecodeTextureTarget(const TextureTarget: TGLTextureTarget): Cardinal;
  238. function EncodeGLTextureTarget(const glTarget: Cardinal): TGLTextureTarget;
  239. function IsTargetSupportMipmap(const TextureTarget: TGLTextureTarget): Boolean; overload;
  240. function IsTargetSupportMipmap(const glTarget: Cardinal): Boolean; overload;
  241. implementation //-------------------------------------------------------------
  242. type
  243. TFormatDesc = record
  244. IntFmt: Cardinal;
  245. ClrFmt: Cardinal;
  246. DataFmt: Cardinal;
  247. RBit: Byte;
  248. GBit: Byte;
  249. BBit: Byte;
  250. ABit: Byte;
  251. LBit: Byte;
  252. DBit: Byte;
  253. Sign: Boolean;
  254. Flt: Boolean;
  255. Fix: Boolean;
  256. Comp: Boolean;
  257. end;
  258. const
  259. // InternalFormat, ColorFormat, DataType
  260. cTextureFormatToOpenGL: array[low(TglInternalFormat)..high(TglInternalFormat)] of TFormatDesc =
  261. (
  262. (IntFmt: GL_ALPHA4; ClrFmt: GL_ALPHA; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 4; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  263. (IntFmt: GL_ALPHA8; ClrFmt: GL_ALPHA; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 8; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  264. (IntFmt: GL_ALPHA12; ClrFmt: GL_ALPHA; DataFmt: GL_UNSIGNED_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 12; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  265. (IntFmt: GL_ALPHA16; ClrFmt: GL_ALPHA; DataFmt: GL_UNSIGNED_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 16; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  266. (IntFmt: GL_DEPTH_COMPONENT16; ClrFmt: GL_DEPTH_COMPONENT; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 16; Sign: False; Flt: False; Fix: False; Comp: False),
  267. (IntFmt: GL_DEPTH_COMPONENT24; ClrFmt: GL_DEPTH_COMPONENT; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 24; Sign: False; Flt: False; Fix: False; Comp: False),
  268. (IntFmt: GL_DEPTH_COMPONENT32; ClrFmt: GL_DEPTH_COMPONENT; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 32; Sign: False; Flt: False; Fix: False; Comp: False),
  269. (IntFmt: GL_LUMINANCE4; ClrFmt: GL_LUMINANCE; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 4; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  270. (IntFmt: GL_LUMINANCE8; ClrFmt: GL_LUMINANCE; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 8; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  271. (IntFmt: GL_LUMINANCE12; ClrFmt: GL_LUMINANCE; DataFmt: GL_UNSIGNED_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 12; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  272. (IntFmt: GL_LUMINANCE16; ClrFmt: GL_LUMINANCE; DataFmt: GL_UNSIGNED_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 16; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  273. (IntFmt: GL_LUMINANCE4_ALPHA4; ClrFmt: GL_LUMINANCE_ALPHA; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 4; LBit: 4; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  274. (IntFmt: GL_LUMINANCE6_ALPHA2; ClrFmt: GL_LUMINANCE_ALPHA; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 6; LBit: 2; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  275. (IntFmt: GL_LUMINANCE8_ALPHA8; ClrFmt: GL_LUMINANCE_ALPHA; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 8; LBit: 8; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  276. (IntFmt: GL_LUMINANCE12_ALPHA4; ClrFmt: GL_LUMINANCE_ALPHA; DataFmt: GL_UNSIGNED_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 4; LBit: 12; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  277. (IntFmt: GL_LUMINANCE12_ALPHA12; ClrFmt: GL_LUMINANCE_ALPHA; DataFmt: GL_UNSIGNED_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 12; LBit: 12; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  278. (IntFmt: GL_LUMINANCE16_ALPHA16; ClrFmt: GL_LUMINANCE_ALPHA; DataFmt: GL_UNSIGNED_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 16; LBit: 16; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  279. (IntFmt: GL_INTENSITY4; ClrFmt: GL_LUMINANCE; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 4; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  280. (IntFmt: GL_INTENSITY8; ClrFmt: GL_LUMINANCE; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 8; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  281. (IntFmt: GL_INTENSITY12; ClrFmt: GL_LUMINANCE; DataFmt: GL_UNSIGNED_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 12; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  282. (IntFmt: GL_INTENSITY16; ClrFmt: GL_LUMINANCE; DataFmt: GL_UNSIGNED_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 16; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  283. (IntFmt: GL_R3_G3_B2; ClrFmt: GL_RGB; DataFmt: GL_UNSIGNED_BYTE_3_3_2; RBit: 3; GBit: 3; BBit: 2; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  284. (IntFmt: GL_RGB4; ClrFmt: GL_RGB; DataFmt: GL_UNSIGNED_BYTE; RBit: 4; GBit: 4; BBit: 4; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  285. (IntFmt: GL_RGB5; ClrFmt: GL_RGB; DataFmt: GL_UNSIGNED_SHORT_5_6_5; RBit: 5; GBit: 6; BBit: 5; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  286. (IntFmt: GL_RGB8; ClrFmt: GL_RGB; DataFmt: GL_UNSIGNED_BYTE; RBit: 8; GBit: 8; BBit: 8; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  287. (IntFmt: GL_RGB10; ClrFmt: GL_RGBA; DataFmt: GL_UNSIGNED_INT_10_10_10_2; RBit: 10; GBit: 10; BBit: 10; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  288. (IntFmt: GL_RGB12; ClrFmt: GL_RGB; DataFmt: GL_UNSIGNED_BYTE; RBit: 12; GBit: 12; BBit: 12; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  289. (IntFmt: GL_RGB16; ClrFmt: GL_RGB; DataFmt: GL_UNSIGNED_SHORT; RBit: 16; GBit: 16; BBit: 16; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  290. (IntFmt: GL_RGBA2; ClrFmt: GL_RGBA; DataFmt: GL_UNSIGNED_BYTE; RBit: 2; GBit: 2; BBit: 2; ABit: 2; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  291. (IntFmt: GL_RGBA4; ClrFmt: GL_RGBA; DataFmt: GL_UNSIGNED_SHORT_4_4_4_4; RBit: 4; GBit: 4; BBit: 4; ABit: 4; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  292. (IntFmt: GL_RGB5_A1; ClrFmt: GL_RGBA; DataFmt: GL_UNSIGNED_SHORT_5_5_5_1; RBit: 5; GBit: 5; BBit: 5; ABit: 1; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  293. (IntFmt: GL_RGBA8; ClrFmt: GL_RGBA; DataFmt: GL_UNSIGNED_BYTE; RBit: 8; GBit: 8; BBit: 8; ABit: 8; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  294. (IntFmt: GL_RGB10_A2; ClrFmt: GL_RGBA; DataFmt: GL_UNSIGNED_INT_10_10_10_2; RBit: 10; GBit: 10; BBit: 10; ABit: 2; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  295. (IntFmt: GL_RGBA12; ClrFmt: GL_RGBA; DataFmt: GL_UNSIGNED_BYTE; RBit: 12; GBit: 12; BBit: 12; ABit: 12; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  296. (IntFmt: GL_RGBA16; ClrFmt: GL_RGBA; DataFmt: GL_UNSIGNED_SHORT; RBit: 16; GBit: 16; BBit: 16; ABit: 16; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  297. (IntFmt: GL_COMPRESSED_RGB_S3TC_DXT1_EXT; ClrFmt: GL_COMPRESSED_RGB_S3TC_DXT1_EXT; DataFmt: GL_COMPRESSED_RGB_S3TC_DXT1_EXT; RBit: 8; GBit: 8; BBit: 8; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: True),
  298. (IntFmt: GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; ClrFmt: GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; DataFmt: GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; RBit: 8; GBit: 8; BBit: 8; ABit: 1; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: True),
  299. (IntFmt: GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; ClrFmt: GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; DataFmt: GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; RBit: 8; GBit: 8; BBit: 8; ABit: 8; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: True),
  300. (IntFmt: GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; ClrFmt: GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; DataFmt: GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; RBit: 8; GBit: 8; BBit: 0; ABit: 8; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: True),
  301. (IntFmt: GL_SIGNED_LUMINANCE8_NV; ClrFmt: GL_LUMINANCE; DataFmt: GL_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 8; DBit: 0; Sign: True; Flt: False; Fix: False; Comp: False),
  302. (IntFmt: GL_SIGNED_LUMINANCE8_ALPHA8_NV; ClrFmt: GL_LUMINANCE_ALPHA; DataFmt: GL_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 8; LBit: 8; DBit: 0; Sign: True; Flt: False; Fix: False; Comp: False),
  303. (IntFmt: GL_SIGNED_RGB8_NV; ClrFmt: GL_RGB; DataFmt: GL_BYTE; RBit: 8; GBit: 8; BBit: 8; ABit: 0; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: False; Comp: False),
  304. (IntFmt: GL_SIGNED_RGBA8_NV; ClrFmt: GL_RGBA; DataFmt: GL_BYTE; RBit: 8; GBit: 8; BBit: 8; ABit: 8; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: False; Comp: False),
  305. (IntFmt: GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV; ClrFmt: GL_RGBA; DataFmt: GL_BYTE; RBit: 8; GBit: 8; BBit: 8; ABit: 8; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: False; Comp: False),
  306. (IntFmt: GL_SIGNED_ALPHA8_NV; ClrFmt: GL_ALPHA; DataFmt: GL_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 8; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: False; Comp: False),
  307. (IntFmt: GL_SIGNED_INTENSITY8_NV; ClrFmt: GL_INTENSITY; DataFmt: GL_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 8; DBit: 0; Sign: True; Flt: False; Fix: False; Comp: False),
  308. (IntFmt: GL_HILO16_NV; ClrFmt: GL_RG; DataFmt: GL_UNSIGNED_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  309. (IntFmt: GL_SIGNED_HILO16_NV; ClrFmt: GL_RG; DataFmt: GL_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: False; Comp: False),
  310. (IntFmt: GL_DSDT8_NV; ClrFmt: GL_RED; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  311. (IntFmt: GL_DSDT8_MAG8_NV; ClrFmt: GL_RG; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  312. (IntFmt: GL_DSDT8_MAG8_INTENSITY8_NV; ClrFmt: GL_RGB; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  313. (IntFmt: GL_HILO8_NV; ClrFmt: GL_RG; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  314. (IntFmt: GL_SIGNED_HILO8_NV; ClrFmt: GL_RG; DataFmt: GL_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: False; Comp: False),
  315. (IntFmt: GL_FLOAT_R16_NV; ClrFmt: GL_RED; DataFmt: GL_HALF_FLOAT; RBit: 16; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  316. (IntFmt: GL_FLOAT_R32_NV; ClrFmt: GL_RED; DataFmt: GL_FLOAT; RBit: 32; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  317. (IntFmt: GL_FLOAT_RG16_NV; ClrFmt: GL_RG; DataFmt: GL_HALF_FLOAT; RBit: 16; GBit: 16; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  318. (IntFmt: GL_FLOAT_RGB16_NV; ClrFmt: GL_RGB; DataFmt: GL_HALF_FLOAT; RBit: 16; GBit: 16; BBit: 16; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  319. (IntFmt: GL_FLOAT_RGBA16_NV; ClrFmt: GL_RGBA; DataFmt: GL_HALF_FLOAT; RBit: 16; GBit: 16; BBit: 16; ABit: 16; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  320. (IntFmt: GL_FLOAT_RG32_NV; ClrFmt: GL_RG; DataFmt: GL_FLOAT; RBit: 32; GBit: 32; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  321. (IntFmt: GL_FLOAT_RGB32_NV; ClrFmt: GL_RGB; DataFmt: GL_FLOAT; RBit: 32; GBit: 32; BBit: 32; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  322. (IntFmt: GL_FLOAT_RGBA32_NV; ClrFmt: GL_RGBA; DataFmt: GL_FLOAT; RBit: 32; GBit: 32; BBit: 32; ABit: 32; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  323. (IntFmt: GL_RGBA32F_ARB; ClrFmt: GL_RGBA; DataFmt: GL_FLOAT; RBit: 32; GBit: 32; BBit: 32; ABit: 32; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  324. (IntFmt: GL_RGB32F_ARB; ClrFmt: GL_RGB; DataFmt: GL_FLOAT; RBit: 32; GBit: 32; BBit: 32; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  325. (IntFmt: GL_ALPHA32F_ARB; ClrFmt: GL_ALPHA; DataFmt: GL_FLOAT; RBit: 0; GBit: 0; BBit: 0; ABit: 32; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  326. (IntFmt: GL_INTENSITY32F_ARB; ClrFmt: GL_LUMINANCE; DataFmt: GL_FLOAT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 32; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  327. (IntFmt: GL_LUMINANCE32F_ARB; ClrFmt: GL_LUMINANCE; DataFmt: GL_FLOAT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 32; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  328. (IntFmt: GL_LUMINANCE_ALPHA32F_ARB; ClrFmt: GL_LUMINANCE_ALPHA; DataFmt: GL_FLOAT; RBit: 0; GBit: 0; BBit: 0; ABit: 32; LBit: 32; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  329. (IntFmt: GL_RGBA16F_ARB; ClrFmt: GL_RGBA; DataFmt: GL_HALF_FLOAT; RBit: 16; GBit: 16; BBit: 16; ABit: 16; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  330. (IntFmt: GL_RGB16F_ARB; ClrFmt: GL_RGB; DataFmt: GL_HALF_FLOAT; RBit: 16; GBit: 16; BBit: 16; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  331. (IntFmt: GL_ALPHA16F_ARB; ClrFmt: GL_ALPHA; DataFmt: GL_HALF_FLOAT; RBit: 0; GBit: 0; BBit: 0; ABit: 16; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  332. (IntFmt: GL_INTENSITY16F_ARB; ClrFmt: GL_LUMINANCE; DataFmt: GL_HALF_FLOAT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 16; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  333. (IntFmt: GL_LUMINANCE16F_ARB; ClrFmt: GL_LUMINANCE; DataFmt: GL_HALF_FLOAT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 16; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  334. (IntFmt: GL_LUMINANCE_ALPHA16F_ARB; ClrFmt: GL_LUMINANCE_ALPHA; DataFmt: GL_HALF_FLOAT; RBit: 0; GBit: 0; BBit: 0; ABit: 16; LBit: 16; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  335. (IntFmt: GL_DEPTH24_STENCIL8; ClrFmt: GL_DEPTH_STENCIL; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 24; Sign: False; Flt: False; Fix: False; Comp: False),
  336. (IntFmt: GL_DEPTH_COMPONENT32F; ClrFmt: GL_DEPTH_COMPONENT; DataFmt: GL_FLOAT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 32; Sign: False; Flt: True; Fix: False; Comp: False),
  337. (IntFmt: GL_DEPTH32F_STENCIL8; ClrFmt: GL_DEPTH_STENCIL; DataFmt: GL_FLOAT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 32; Sign: False; Flt: True; Fix: False; Comp: False),
  338. (IntFmt: GL_SRGB8; ClrFmt: GL_RGB; DataFmt: GL_UNSIGNED_BYTE; RBit: 8; GBit: 8; BBit: 8; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  339. (IntFmt: GL_SRGB8_ALPHA8; ClrFmt: GL_RGBA; DataFmt: GL_UNSIGNED_BYTE; RBit: 8; GBit: 8; BBit: 8; ABit: 8; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  340. (IntFmt: GL_SLUMINANCE8; ClrFmt: GL_LUMINANCE; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 8; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  341. (IntFmt: GL_SLUMINANCE8_ALPHA8; ClrFmt: GL_LUMINANCE_ALPHA; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 8; LBit: 8; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  342. (IntFmt: GL_COMPRESSED_SRGB_S3TC_DXT1_EXT; ClrFmt: GL_COMPRESSED_SRGB_S3TC_DXT1_EXT; DataFmt: GL_COMPRESSED_SRGB_S3TC_DXT1_EXT; RBit: 8; GBit: 8; BBit: 8; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: True),
  343. (IntFmt: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT; ClrFmt: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT; DataFmt: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT; RBit: 8; GBit: 8; BBit: 8; ABit: 1; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: True),
  344. (IntFmt: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT; ClrFmt: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT; DataFmt: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT; RBit: 8; GBit: 8; BBit: 8; ABit: 8; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: True),
  345. (IntFmt: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT; ClrFmt: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT; DataFmt: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT; RBit: 8; GBit: 8; BBit: 8; ABit: 8; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: True),
  346. (IntFmt: GL_RGB9_E5; ClrFmt: GL_RGBA; DataFmt: GL_FLOAT; RBit: 8; GBit: 8; BBit: 8; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  347. (IntFmt: GL_R11F_G11F_B10F; ClrFmt: GL_RGB; DataFmt: GL_FLOAT; RBit: 11; GBit: 11; BBit: 10; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  348. (IntFmt: GL_COMPRESSED_LUMINANCE_LATC1_EXT; ClrFmt: GL_COMPRESSED_LUMINANCE_LATC1_EXT; DataFmt: GL_COMPRESSED_LUMINANCE_LATC1_EXT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 8; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: True),
  349. (IntFmt: GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT; ClrFmt: GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT; DataFmt: GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 8; DBit: 0; Sign: True; Flt: False; Fix: False; Comp: True),
  350. (IntFmt: GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT; ClrFmt: GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT; DataFmt: GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT; RBit: 0; GBit: 0; BBit: 0; ABit: 8; LBit: 8; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: True),
  351. (IntFmt: GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT; ClrFmt: GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT; DataFmt: GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT; RBit: 0; GBit: 0; BBit: 0; ABit: 8; LBit: 8; DBit: 0; Sign: True; Flt: False; Fix: False; Comp: True),
  352. (IntFmt: GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI; ClrFmt: GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI; DataFmt: GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI; RBit: 0; GBit: 0; BBit: 0; ABit: 8; LBit: 8; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: True),
  353. (IntFmt: GL_RGBA32UI; ClrFmt: GL_RGBA_INTEGER; DataFmt: GL_UNSIGNED_INT; RBit: 32; GBit: 32; BBit: 32; ABit: 32; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  354. (IntFmt: GL_RGB32UI; ClrFmt: GL_RGB_INTEGER; DataFmt: GL_UNSIGNED_INT; RBit: 32; GBit: 32; BBit: 32; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  355. (IntFmt: GL_ALPHA32UI_EXT; ClrFmt: GL_ALPHA_INTEGER; DataFmt: GL_UNSIGNED_INT; RBit: 0; GBit: 0; BBit: 0; ABit: 32; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  356. (IntFmt: GL_INTENSITY32UI_EXT; ClrFmt: GL_LUMINANCE_INTEGER_EXT; DataFmt: GL_UNSIGNED_INT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 32; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  357. (IntFmt: GL_LUMINANCE32UI_EXT; ClrFmt: GL_LUMINANCE_INTEGER_EXT; DataFmt: GL_UNSIGNED_INT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 32; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  358. (IntFmt: GL_LUMINANCE_ALPHA32UI_EXT; ClrFmt: GL_LUMINANCE_ALPHA_INTEGER_EXT; DataFmt: GL_UNSIGNED_INT; RBit: 0; GBit: 0; BBit: 0; ABit: 32; LBit: 32; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  359. (IntFmt: GL_RGBA16UI; ClrFmt: GL_RGBA_INTEGER; DataFmt: GL_UNSIGNED_SHORT; RBit: 16; GBit: 16; BBit: 16; ABit: 16; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  360. (IntFmt: GL_RGB16UI; ClrFmt: GL_RGB_INTEGER; DataFmt: GL_UNSIGNED_SHORT; RBit: 16; GBit: 16; BBit: 16; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  361. (IntFmt: GL_ALPHA16UI_EXT; ClrFmt: GL_ALPHA_INTEGER; DataFmt: GL_UNSIGNED_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 16; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  362. (IntFmt: GL_INTENSITY16UI_EXT; ClrFmt: GL_LUMINANCE_INTEGER_EXT; DataFmt: GL_UNSIGNED_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 16; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  363. (IntFmt: GL_LUMINANCE16UI_EXT; ClrFmt: GL_LUMINANCE_INTEGER_EXT; DataFmt: GL_UNSIGNED_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 16; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  364. (IntFmt: GL_LUMINANCE_ALPHA16UI_EXT; ClrFmt: GL_LUMINANCE_ALPHA_INTEGER_EXT; DataFmt: GL_UNSIGNED_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 16; LBit: 16; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  365. (IntFmt: GL_RGBA8UI; ClrFmt: GL_RGBA_INTEGER; DataFmt: GL_UNSIGNED_BYTE; RBit: 8; GBit: 8; BBit: 8; ABit: 8; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  366. (IntFmt: GL_RGB8UI; ClrFmt: GL_RGB_INTEGER; DataFmt: GL_UNSIGNED_BYTE; RBit: 8; GBit: 8; BBit: 8; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  367. (IntFmt: GL_ALPHA8UI_EXT; ClrFmt: GL_ALPHA_INTEGER; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 8; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  368. (IntFmt: GL_INTENSITY8UI_EXT; ClrFmt: GL_LUMINANCE_INTEGER_EXT; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 8; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  369. (IntFmt: GL_LUMINANCE8UI_EXT; ClrFmt: GL_LUMINANCE_INTEGER_EXT; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 8; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  370. (IntFmt: GL_LUMINANCE_ALPHA8UI_EXT; ClrFmt: GL_LUMINANCE_ALPHA_INTEGER_EXT; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 8; LBit: 8; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  371. (IntFmt: GL_RGBA32I; ClrFmt: GL_RGBA_INTEGER; DataFmt: GL_INT; RBit: 32; GBit: 32; BBit: 32; ABit: 32; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  372. (IntFmt: GL_RGB32I; ClrFmt: GL_RGB_INTEGER; DataFmt: GL_INT; RBit: 32; GBit: 32; BBit: 32; ABit: 0; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  373. (IntFmt: GL_ALPHA32I_EXT; ClrFmt: GL_ALPHA_INTEGER; DataFmt: GL_INT; RBit: 0; GBit: 0; BBit: 0; ABit: 32; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  374. (IntFmt: GL_INTENSITY32I_EXT; ClrFmt: GL_LUMINANCE_INTEGER_EXT; DataFmt: GL_INT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 32; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  375. (IntFmt: GL_LUMINANCE32I_EXT; ClrFmt: GL_LUMINANCE_INTEGER_EXT; DataFmt: GL_INT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 32; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  376. (IntFmt: GL_LUMINANCE_ALPHA32I_EXT; ClrFmt: GL_LUMINANCE_ALPHA_INTEGER_EXT; DataFmt: GL_INT; RBit: 0; GBit: 0; BBit: 0; ABit: 32; LBit: 32; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  377. (IntFmt: GL_RGBA16I; ClrFmt: GL_RGBA_INTEGER; DataFmt: GL_SHORT; RBit: 16; GBit: 16; BBit: 16; ABit: 16; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  378. (IntFmt: GL_RGB16I; ClrFmt: GL_RGB_INTEGER; DataFmt: GL_SHORT; RBit: 16; GBit: 16; BBit: 16; ABit: 0; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  379. (IntFmt: GL_ALPHA16I_EXT; ClrFmt: GL_ALPHA_INTEGER; DataFmt: GL_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 16; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  380. (IntFmt: GL_INTENSITY16I_EXT; ClrFmt: GL_LUMINANCE_INTEGER_EXT; DataFmt: GL_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 16; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  381. (IntFmt: GL_LUMINANCE16I_EXT; ClrFmt: GL_LUMINANCE_INTEGER_EXT; DataFmt: GL_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 16; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  382. (IntFmt: GL_LUMINANCE_ALPHA16I_EXT; ClrFmt: GL_LUMINANCE_ALPHA_INTEGER_EXT; DataFmt: GL_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 16; LBit: 16; DBit: 0; Sign: True; Flt: True; Fix: False; Comp: False),
  383. (IntFmt: GL_RGBA8I; ClrFmt: GL_RGBA_INTEGER; DataFmt: GL_BYTE; RBit: 8; GBit: 8; BBit: 8; ABit: 8; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  384. (IntFmt: GL_RGB8I; ClrFmt: GL_RGB_INTEGER; DataFmt: GL_BYTE; RBit: 8; GBit: 8; BBit: 8; ABit: 0; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  385. (IntFmt: GL_ALPHA8I_EXT; ClrFmt: GL_ALPHA_INTEGER; DataFmt: GL_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 8; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  386. (IntFmt: GL_INTENSITY8I_EXT; ClrFmt: GL_INTENSITY; DataFmt: GL_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 8; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  387. (IntFmt: GL_LUMINANCE8I_EXT; ClrFmt: GL_LUMINANCE; DataFmt: GL_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 8; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  388. (IntFmt: GL_LUMINANCE_ALPHA8I_EXT; ClrFmt: GL_LUMINANCE_ALPHA; DataFmt: GL_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 8; LBit: 8; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  389. (IntFmt: GL_RG32UI; ClrFmt: GL_RG; DataFmt: GL_UNSIGNED_INT; RBit: 8; GBit: 8; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  390. (IntFmt: GL_R32UI; ClrFmt: GL_RED_INTEGER; DataFmt: GL_UNSIGNED_INT; RBit: 8; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  391. (IntFmt: GL_RG16UI; ClrFmt: GL_RG; DataFmt: GL_UNSIGNED_SHORT; RBit: 16; GBit: 16; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  392. (IntFmt: GL_R16UI; ClrFmt: GL_RED_INTEGER; DataFmt: GL_UNSIGNED_SHORT; RBit: 16; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  393. (IntFmt: GL_RG8UI; ClrFmt: GL_RG; DataFmt: GL_UNSIGNED_BYTE; RBit: 8; GBit: 8; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  394. (IntFmt: GL_R8UI; ClrFmt: GL_RED_INTEGER; DataFmt: GL_UNSIGNED_BYTE; RBit: 8; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  395. (IntFmt: GL_RG32I; ClrFmt: GL_RG; DataFmt: GL_INT; RBit: 32; GBit: 32; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  396. (IntFmt: GL_R32I; ClrFmt: GL_RED_INTEGER; DataFmt: GL_INT; RBit: 16; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  397. (IntFmt: GL_RG16I; ClrFmt: GL_RG; DataFmt: GL_SHORT; RBit: 16; GBit: 16; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  398. (IntFmt: GL_R16I; ClrFmt: GL_RED_INTEGER; DataFmt: GL_SHORT; RBit: 16; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  399. (IntFmt: GL_RG8I; ClrFmt: GL_RG; DataFmt: GL_BYTE; RBit: 8; GBit: 8; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  400. (IntFmt: GL_R8I; ClrFmt: GL_RED_INTEGER; DataFmt: GL_BYTE; RBit: 8; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  401. (IntFmt: GL_RG8; ClrFmt: GL_RG; DataFmt: GL_BYTE; RBit: 8; GBit: 8; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  402. (IntFmt: GL_R8; ClrFmt: GL_RED; DataFmt: GL_BYTE; RBit: 8; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  403. (IntFmt: GL_RG16; ClrFmt: GL_RG; DataFmt: GL_SHORT; RBit: 16; GBit: 16; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  404. (IntFmt: GL_R16; ClrFmt: GL_RED; DataFmt: GL_SHORT; RBit: 16; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  405. (IntFmt: GL_RG16F; ClrFmt: GL_RG; DataFmt: GL_HALF_FLOAT; RBit: 16; GBit: 16; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  406. (IntFmt: GL_R16F; ClrFmt: GL_RED; DataFmt: GL_HALF_FLOAT; RBit: 16; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  407. (IntFmt: GL_RG32F; ClrFmt: GL_RG; DataFmt: GL_FLOAT; RBit: 32; GBit: 32; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  408. (IntFmt: GL_R32F; ClrFmt: GL_LUMINANCE; DataFmt: GL_FLOAT; RBit: 32; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  409. (IntFmt: GL_COMPRESSED_RED_RGTC1; ClrFmt: GL_COMPRESSED_RED_RGTC1; DataFmt: GL_COMPRESSED_RED_RGTC1; RBit: 8; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: True),
  410. (IntFmt: GL_COMPRESSED_SIGNED_RED_RGTC1; ClrFmt: GL_COMPRESSED_SIGNED_RED_RGTC1; DataFmt: GL_COMPRESSED_SIGNED_RED_RGTC1; RBit: 8; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: False; Comp: True),
  411. (IntFmt: GL_COMPRESSED_RG_RGTC2; ClrFmt: GL_COMPRESSED_RG_RGTC2; DataFmt: GL_COMPRESSED_RG_RGTC2; RBit: 8; GBit: 8; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: True),
  412. (IntFmt: GL_COMPRESSED_SIGNED_RG_RGTC2; ClrFmt: GL_COMPRESSED_SIGNED_RG_RGTC2; DataFmt: GL_COMPRESSED_SIGNED_RG_RGTC2; RBit: 8; GBit: 8; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: False; Comp: True),
  413. (IntFmt: GL_R8_SNORM; ClrFmt: GL_R; DataFmt: GL_BYTE; RBit: 8; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  414. (IntFmt: GL_RG8_SNORM; ClrFmt: GL_RG; DataFmt: GL_BYTE; RBit: 8; GBit: 8; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  415. (IntFmt: GL_RGB8_SNORM; ClrFmt: GL_RGB; DataFmt: GL_BYTE; RBit: 8; GBit: 8; BBit: 8; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  416. (IntFmt: GL_RGBA8_SNORM; ClrFmt: GL_RGBA; DataFmt: GL_BYTE; RBit: 8; GBit: 8; BBit: 8; ABit: 8; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  417. (IntFmt: GL_R16_SNORM; ClrFmt: GL_R; DataFmt: GL_SHORT; RBit: 16; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  418. (IntFmt: GL_RG16_SNORM; ClrFmt: GL_RG; DataFmt: GL_SHORT; RBit: 16; GBit: 16; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  419. (IntFmt: GL_RGB16_SNORM; ClrFmt: GL_RGB; DataFmt: GL_SHORT; RBit: 16; GBit: 16; BBit: 16; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  420. (IntFmt: GL_RGBA16_SNORM; ClrFmt: GL_RGBA; DataFmt: GL_SHORT; RBit: 16; GBit: 16; BBit: 16; ABit: 16; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False)
  421. );
  422. function InternalFormatToOpenGLFormat(intFormat: TGLInternalFormat): Cardinal;
  423. begin
  424. Result := cTextureFormatToOpenGL[intFormat].IntFmt;
  425. end;
  426. function OpenGLFormatToInternalFormat(glFormat: Cardinal): TGLInternalFormat;
  427. var
  428. i: TGLInternalFormat;
  429. begin
  430. Result := tfRGBA8;
  431. for i := Low(cTextureFormatToOpenGL) to High(cTextureFormatToOpenGL) do
  432. if glFormat = cTextureFormatToOpenGL[i].IntFmt then
  433. begin
  434. Result := i;
  435. Exit;
  436. end;
  437. Assert(false);
  438. end;
  439. function GetTextureElementSize(intFormat: TGLInternalFormat): Integer;
  440. begin
  441. Result := GetTextureElementSize(
  442. cTextureFormatToOpenGL[intFormat].ClrFmt,
  443. cTextureFormatToOpenGL[intFormat].DataFmt);
  444. end;
  445. function GetTextureElementSize(colorFormat: Cardinal; dataType: Cardinal):
  446. Integer;
  447. var
  448. components: Byte;
  449. begin
  450. case colorFormat of
  451. GL_RGB, GL_BGR: components := 3;
  452. GL_RGBA, GL_BGRA: components := 4;
  453. GL_ALPHA: components := 1;
  454. GL_LUMINANCE: components := 1;
  455. GL_LUMINANCE_ALPHA: components := 2;
  456. GL_INTENSITY: components := 1;
  457. GL_RED: components := 1;
  458. GL_GREEN: components := 1;
  459. GL_BLUE: components := 1;
  460. GL_RG: components := 2;
  461. GL_RGB_INTEGER: components := 3;
  462. GL_RGBA_INTEGER: components := 4;
  463. GL_ALPHA_INTEGER: components := 1;
  464. GL_LUMINANCE_INTEGER_EXT: components := 1;
  465. GL_LUMINANCE_ALPHA_INTEGER_EXT: components := 2;
  466. GL_RED_INTEGER: components := 1;
  467. GL_RG_INTEGER: components := 2;
  468. else
  469. components := 1;
  470. end;
  471. case dataType of
  472. GL_BITMAP,
  473. GL_UNSIGNED_BYTE,
  474. GL_BYTE: Result := components;
  475. GL_UNSIGNED_BYTE_3_3_2,
  476. GL_UNSIGNED_BYTE_2_3_3_REV: Result := 1;
  477. GL_UNSIGNED_SHORT,
  478. GL_SHORT: Result := components * 2;
  479. GL_UNSIGNED_SHORT_4_4_4_4,
  480. GL_UNSIGNED_SHORT_4_4_4_4_REV,
  481. GL_UNSIGNED_SHORT_5_6_5,
  482. GL_UNSIGNED_SHORT_5_6_5_REV,
  483. GL_UNSIGNED_SHORT_5_5_5_1,
  484. GL_UNSIGNED_SHORT_1_5_5_5_REV: Result := 2;
  485. GL_UNSIGNED_INT,
  486. GL_INT: Result := components * 4;
  487. GL_UNSIGNED_INT_8_8_8_8,
  488. GL_UNSIGNED_INT_8_8_8_8_REV,
  489. GL_UNSIGNED_INT_10_10_10_2,
  490. GL_UNSIGNED_INT_2_10_10_10_REV: Result := 4;
  491. GL_FLOAT: Result := components * 4;
  492. GL_HALF_FLOAT: Result := components * 2;
  493. GL_COMPRESSED_RGB_S3TC_DXT1_EXT: Result := 8;
  494. GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: Result := 8;
  495. GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: Result := 16;
  496. GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: Result := 16;
  497. GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: Result := 8;
  498. GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: Result := 8;
  499. GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: Result := 16;
  500. GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: Result := 16;
  501. GL_COMPRESSED_LUMINANCE_LATC1_EXT: Result := 8;
  502. GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT: Result := 8;
  503. GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT: Result := 16;
  504. GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT: Result := 16;
  505. GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI: Result := 16;
  506. GL_COMPRESSED_RED_RGTC1: Result := 8;
  507. GL_COMPRESSED_SIGNED_RED_RGTC1: Result := 8;
  508. GL_COMPRESSED_RG_RGTC2: Result := 16;
  509. GL_COMPRESSED_SIGNED_RG_RGTC2: Result := 16;
  510. else
  511. Result := 1;
  512. end;
  513. end;
  514. function CompressedInternalFormatToOpenGL(intFormat: TglInternalFormat):
  515. Integer;
  516. begin
  517. Result := GL_COMPRESSED_RGBA;
  518. case intFormat of
  519. tfRGB8: Result := GL_COMPRESSED_RGB;
  520. tfRGBA8: Result := GL_COMPRESSED_RGBA;
  521. tfRGB5: Result := GL_COMPRESSED_RGB;
  522. tfRGBA4: Result := GL_COMPRESSED_RGBA;
  523. tfALPHA8: Result := GL_COMPRESSED_ALPHA;
  524. tfLUMINANCE8: Result := GL_COMPRESSED_LUMINANCE;
  525. tfLUMINANCE8_ALPHA8: Result := GL_COMPRESSED_LUMINANCE_ALPHA;
  526. tfINTENSITY8: Result := GL_COMPRESSED_INTENSITY;
  527. else
  528. Assert(false);
  529. end;
  530. end;
  531. procedure FindCompatibleDataFormat(intFormat: TglInternalFormat; out dFormat:
  532. Cardinal; out dType: Cardinal);
  533. begin
  534. dFormat := cTextureFormatToOpenGL[intFormat].ClrFmt;
  535. dType := cTextureFormatToOpenGL[intFormat].DataFmt;
  536. end;
  537. function IsTargetSupported(target: TglTextureTarget): Boolean;
  538. begin
  539. Result := IsTargetSupported(DecodeTextureTarget(target));
  540. end;
  541. function IsTargetSupported(glTarget: Cardinal): Boolean;
  542. begin
  543. Result := True; // All OpenGL versions!
  544. (*
  545. case glTarget of
  546. GL_TEXTURE_1D: Result := GL.VERSION_1_1 or GL.EXT_texture_object;
  547. GL_TEXTURE_2D: Result := GL.VERSION_1_1 or GL.EXT_texture_object;
  548. GL_TEXTURE_3D: Result := GL.EXT_texture3D;
  549. GL_TEXTURE_RECTANGLE: Result := GL.ARB_texture_rectangle;
  550. GL_TEXTURE_CUBE_MAP,
  551. GL_TEXTURE_CUBE_MAP_POSITIVE_X,
  552. GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
  553. GL_TEXTURE_CUBE_MAP_POSITIVE_Y,
  554. GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,
  555. GL_TEXTURE_CUBE_MAP_POSITIVE_Z,
  556. GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: Result := GL.ARB_texture_cube_map;
  557. GL_TEXTURE_1D_ARRAY: Result := GL.EXT_texture_array;
  558. GL_TEXTURE_2D_ARRAY: Result := GL.EXT_texture_array;
  559. GL_TEXTURE_CUBE_MAP_ARRAY: Result := GL.ARB_texture_cube_map_array;
  560. GL_TEXTURE_BUFFER: Result := GL.ARB_texture_buffer_object;
  561. GL_TEXTURE_2D_MULTISAMPLE,
  562. GL_TEXTURE_2D_MULTISAMPLE_ARRAY: Result := GL.ARB_texture_multisample;
  563. else
  564. begin
  565. Result := false;
  566. // Assert(False, strErrorEx + strUnknownType);
  567. end;
  568. end;
  569. *)
  570. end;
  571. function IsFormatSupported(intFormat: TGLInternalFormat): Boolean;
  572. begin
  573. Result := True; // All OpenGL versions!
  574. (*
  575. Result := false;
  576. if ((intFormat >= tfALPHA4) and (intFormat <= tfALPHA16)) or
  577. ((intFormat >= tfLUMINANCE4) and (intFormat <= tfR16G16B16A16)) then
  578. begin
  579. // Result := GL.VERSION_1_1;
  580. EXIT;
  581. end;
  582. if ((intFormat >= tfDEPTH_COMPONENT16) and (intFormat <= tfDEPTH_COMPONENT32)) then
  583. begin
  584. // Result := GL.ARB_depth_texture;
  585. EXIT;
  586. end;
  587. if ((intFormat >= tfCOMPRESSED_RGB_S3TC_DXT1) and (intFormat <=
  588. tfCOMPRESSED_RGBA_S3TC_DXT5)) then
  589. begin
  590. // Result := GL.EXT_texture_compression_s3tc;
  591. EXIT;
  592. end;
  593. if ((intFormat >= tfSIGNED_LUMINANCE8) and (intFormat <=
  594. tfDSDT8_MAG8_INTENSITY8)) then
  595. begin
  596. // Result := GL.NV_texture_shader;
  597. EXIT;
  598. end;
  599. if ((intFormat = tfHILO8) or (intFormat = tfSIGNED_HILO8)) then
  600. begin
  601. // Result := GL.NV_texture_shader3;
  602. EXIT;
  603. end;
  604. if ((intFormat >= tfFLOAT_R16) and (intFormat <= tfFLOAT_RGBA32)) then
  605. begin
  606. // Result := GL.NV_float_buffer;
  607. EXIT;
  608. end;
  609. if ((intFormat >= tfRGBA_FLOAT32)
  610. and (intFormat <= tfLUMINANCE_ALPHA_FLOAT16)) then
  611. begin
  612. // Result := GL.ARB_texture_float or GL.ATI_texture_float;
  613. EXIT;
  614. end;
  615. if intFormat = tfDEPTH24_STENCIL8 then
  616. begin
  617. // Result := GL.EXT_packed_depth_stencil;
  618. EXIT;
  619. end;
  620. if ((intFormat = tfDEPTH_COMPONENT32F) or (intFormat = tfDEPTH32F_STENCIL8)) then
  621. begin
  622. // Result := GL.NV_depth_buffer_float;
  623. EXIT;
  624. end;
  625. if ((intFormat >= tfSRGB8) and (intFormat <=
  626. tfCOMPRESSED_SRGB_ALPHA_S3TC_DXT5)) then
  627. begin
  628. // Result := GL.EXT_texture_sRGB;
  629. EXIT;
  630. end;
  631. if intFormat = tfRGB9_E5 then
  632. begin
  633. // Result := GL.EXT_texture_shared_exponent;
  634. EXIT;
  635. end;
  636. if intFormat = tfR11F_G11F_B10F then
  637. begin
  638. // Result := GL.EXT_packed_float;
  639. EXIT;
  640. end;
  641. if ((intFormat >= tfCOMPRESSED_LUMINANCE_LATC1) and (intFormat <=
  642. tfCOMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2)) then
  643. begin
  644. // Result := GL.EXT_texture_compression_latc;
  645. EXIT;
  646. end;
  647. if intFormat = tfCOMPRESSED_LUMINANCE_ALPHA_3DC then
  648. begin
  649. // Result := GL.ATI_texture_compression_3dc;
  650. EXIT;
  651. end;
  652. if ((intFormat >= tfRGBA32UI) and (intFormat <= tfLUMINANCE_ALPHA8I)) then
  653. begin
  654. // Result := GL.EXT_texture_integer;
  655. EXIT;
  656. end;
  657. if ((intFormat >= tfRG32UI) and (intFormat <= tfR32F)) then
  658. Result := GL.ARB_texture_rg;
  659. if ((intFormat >= tfCOMPRESSED_RED_RGTC1) and (intFormat <=
  660. tfCOMPRESSED_SIGNED_RG_RGTC2)) then
  661. begin
  662. // Result := GL.ARB_texture_compression_rgtc;
  663. EXIT;
  664. end;
  665. if ((intFormat >= tfR8_SNORM) and (intFormat <= tfRGBA16_SNORM)) then
  666. begin
  667. // Result := GL.VERSION_3_1;
  668. EXIT;
  669. end
  670. *)
  671. end;
  672. function IsFloatFormat(intFormat: TglInternalFormat): boolean;
  673. begin
  674. Result := cTextureFormatToOpenGL[intFormat].Flt;
  675. end;
  676. function IsFloatFormat(glFormat: Cardinal): boolean;
  677. begin
  678. Result := IsFloatFormat(OpenGLFormatToInternalFormat(glFormat));
  679. end;
  680. function IsDepthFormat(intFormat: TGLInternalFormat): boolean;
  681. begin
  682. Result := cTextureFormatToOpenGL[intFormat].DBit > 0;
  683. end;
  684. function IsDepthFormat(glFormat: Cardinal): boolean;
  685. begin
  686. Result := cTextureFormatToOpenGL[OpenGLFormatToInternalFormat(glFormat)].DBit > 0;
  687. end;
  688. function IsCompressedFormat(intFormat: TglInternalFormat): boolean;
  689. begin
  690. Result := cTextureFormatToOpenGL[intFormat].Comp;
  691. end;
  692. function IsCompressedFormat(glFormat: Cardinal): boolean;
  693. begin
  694. Result := cTextureFormatToOpenGL[OpenGLFormatToInternalFormat(glFormat)].Comp;
  695. end;
  696. function GetGenericCompressedFormat(const intFormat: TglInternalFormat;
  697. const colorFormat: Cardinal; out internalFormat: Cardinal): Boolean;
  698. begin
  699. Result := false;
  700. if IsCompressedFormat(intFormat) then
  701. Exit;
  702. if not IsFormatSupported(intFormat) then
  703. Exit;
  704. internalFormat := 0;
  705. if ((intFormat >= tfSRGB8) and (intFormat <=
  706. tfCOMPRESSED_SRGB_ALPHA_S3TC_DXT5)) then
  707. case colorFormat of
  708. GL_RGB: internalFormat := GL_COMPRESSED_SRGB;
  709. GL_RGBA: internalFormat := GL_COMPRESSED_SRGB_ALPHA;
  710. GL_LUMINANCE: internalFormat := GL_COMPRESSED_SLUMINANCE;
  711. GL_LUMINANCE_ALPHA: internalFormat := GL_COMPRESSED_SLUMINANCE_ALPHA;
  712. end
  713. else
  714. case colorFormat of
  715. GL_RGB, GL_BGR: internalFormat := GL_COMPRESSED_RGB;
  716. GL_RGBA, GL_BGRA: internalFormat := GL_COMPRESSED_RGBA;
  717. GL_ALPHA: internalFormat := GL_COMPRESSED_ALPHA;
  718. GL_LUMINANCE: internalFormat := GL_COMPRESSED_LUMINANCE;
  719. GL_LUMINANCE_ALPHA: internalFormat := GL_COMPRESSED_LUMINANCE_ALPHA;
  720. GL_INTENSITY: internalFormat := GL_COMPRESSED_INTENSITY;
  721. GL_RED: internalFormat := GL_COMPRESSED_RED;
  722. GL_RG: internalFormat := GL_COMPRESSED_RG;
  723. end;
  724. if internalFormat = 0 then
  725. Exit;
  726. Result := true;
  727. end;
  728. function GetUncompressedFormat(const intFormat: TglInternalFormat;
  729. out internalFormat: TglInternalFormat; out colorFormat: Cardinal): Boolean;
  730. begin
  731. Result := false;
  732. if not IsCompressedFormat(intFormat) then
  733. Exit;
  734. if not IsFormatSupported(intFormat) then
  735. Exit;
  736. colorFormat := 0;
  737. case intFormat of
  738. tfCOMPRESSED_RGB_S3TC_DXT1:
  739. begin
  740. colorFormat := GL_RGB;
  741. internalFormat := tfRGB8;
  742. end;
  743. tfCOMPRESSED_RGBA_S3TC_DXT1:
  744. begin
  745. colorFormat := GL_RGBA;
  746. internalFormat := tfRGBA8;
  747. end;
  748. tfCOMPRESSED_RGBA_S3TC_DXT3:
  749. begin
  750. colorFormat := GL_RGBA;
  751. internalFormat := tfRGBA8;
  752. end;
  753. tfCOMPRESSED_RGBA_S3TC_DXT5:
  754. begin
  755. colorFormat := GL_RGBA;
  756. internalFormat := tfRGBA8;
  757. end;
  758. tfCOMPRESSED_SRGB_S3TC_DXT1:
  759. begin
  760. colorFormat := GL_RGBA;
  761. internalFormat := tfSRGB8;
  762. end;
  763. tfCOMPRESSED_SRGB_ALPHA_S3TC_DXT1:
  764. begin
  765. colorFormat := GL_RGBA;
  766. internalFormat := tfSRGB8_ALPHA8;
  767. end;
  768. tfCOMPRESSED_SRGB_ALPHA_S3TC_DXT3:
  769. begin
  770. colorFormat := GL_RGBA;
  771. internalFormat := tfSRGB8_ALPHA8;
  772. end;
  773. tfCOMPRESSED_SRGB_ALPHA_S3TC_DXT5:
  774. begin
  775. colorFormat := GL_RGBA;
  776. internalFormat := tfSRGB8_ALPHA8;
  777. end;
  778. tfCOMPRESSED_LUMINANCE_LATC1:
  779. begin
  780. colorFormat := GL_LUMINANCE;
  781. internalFormat := tfLUMINANCE8;
  782. end;
  783. tfCOMPRESSED_SIGNED_LUMINANCE_LATC1:
  784. begin
  785. colorFormat := GL_LUMINANCE;
  786. internalFormat := tfSIGNED_LUMINANCE8;
  787. end;
  788. tfCOMPRESSED_LUMINANCE_ALPHA_LATC2:
  789. begin
  790. colorFormat := GL_LUMINANCE_ALPHA;
  791. internalFormat := tfLUMINANCE8_ALPHA8;
  792. end;
  793. tfCOMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2:
  794. begin
  795. colorFormat := GL_LUMINANCE_ALPHA;
  796. internalFormat := tfSIGNED_LUMINANCE8_ALPHA8;
  797. end;
  798. tfCOMPRESSED_LUMINANCE_ALPHA_3DC:
  799. begin
  800. colorFormat := GL_LUMINANCE_ALPHA;
  801. internalFormat := tfLUMINANCE8_ALPHA8;
  802. end;
  803. tfCOMPRESSED_RED_RGTC1:
  804. begin
  805. colorFormat := GL_RED;
  806. internalFormat := tfR8;
  807. end;
  808. tfCOMPRESSED_SIGNED_RED_RGTC1:
  809. begin
  810. colorFormat := GL_RED;
  811. internalFormat := tfR8;
  812. end;
  813. tfCOMPRESSED_RG_RGTC2:
  814. begin
  815. colorFormat := GL_RG;
  816. internalFormat := tfRG8;
  817. end;
  818. tfCOMPRESSED_SIGNED_RG_RGTC2:
  819. begin
  820. colorFormat := GL_RG;
  821. internalFormat := tfRG8;
  822. end;
  823. end;
  824. Result := colorFormat <> 0;
  825. end;
  826. function DecodeTextureTarget(const TextureTarget: TglTextureTarget): Cardinal;
  827. const
  828. cTargetToEnum: array[TglTextureTarget] of Cardinal =
  829. (
  830. 0,
  831. GL_TEXTURE_1D,
  832. GL_TEXTURE_2D,
  833. GL_TEXTURE_3D,
  834. GL_TEXTURE_1D_ARRAY,
  835. GL_TEXTURE_2D_ARRAY,
  836. GL_TEXTURE_RECTANGLE,
  837. GL_TEXTURE_BUFFER,
  838. GL_TEXTURE_CUBE_MAP,
  839. GL_TEXTURE_2D_MULTISAMPLE,
  840. GL_TEXTURE_2D_MULTISAMPLE_ARRAY,
  841. GL_TEXTURE_CUBE_MAP_ARRAY
  842. );
  843. begin
  844. // Assert(TextureTarget <> ttNoShape);
  845. Result := cTargetToEnum[TextureTarget];
  846. end;
  847. function EncodeGLTextureTarget(const glTarget: Cardinal): TglTextureTarget;
  848. begin
  849. case glTarget of
  850. GL_TEXTURE_1D: Result := ttTexture1d;
  851. GL_TEXTURE_2D: Result := ttTexture2d;
  852. GL_TEXTURE_3D: Result := ttTexture3d;
  853. GL_TEXTURE_RECTANGLE: Result := ttTextureRect;
  854. GL_TEXTURE_CUBE_MAP: Result := ttTextureCube;
  855. GL_TEXTURE_1D_ARRAY: Result := ttTexture1dArray;
  856. GL_TEXTURE_2D_ARRAY: Result := ttTexture2dArray;
  857. GL_TEXTURE_CUBE_MAP_ARRAY: Result := ttTextureCubeArray;
  858. GL_TEXTURE_2D_MULTISAMPLE: Result := ttTexture2DMultisample;
  859. GL_TEXTURE_2D_MULTISAMPLE_ARRAY: Result := ttTexture2DMultisampleArray;
  860. else
  861. begin
  862. Result := ttTexture2d;
  863. Assert(False, strErrorEx + strUnknownType);
  864. end;
  865. end;
  866. end;
  867. function IsTargetSupportMipmap(const TextureTarget: TglTextureTarget): Boolean;
  868. begin
  869. Result := (TextureTarget <> ttTextureRect)
  870. and (TextureTarget <> ttTexture2DMultisample)
  871. and (TextureTarget <> ttTexture2DMultisampleArray);
  872. end;
  873. function IsTargetSupportMipmap(const glTarget: Cardinal): Boolean;
  874. begin
  875. Result := (glTarget <> GL_TEXTURE_RECTANGLE)
  876. and (glTarget <> GL_TEXTURE_2D_MULTISAMPLE)
  877. and (glTarget <> GL_TEXTURE_2D_MULTISAMPLE_ARRAY);
  878. end;
  879. end.