webgl.pas 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698
  1. Unit webgl;
  2. {$MODE ObjFPC}
  3. {$H+}
  4. {$modeswitch externalclass}
  5. interface
  6. uses JS, Web;
  7. {
  8. Automatically generated file by TWebIDLToPas on 2018-06-23 15:31:57
  9. Used command-line options :
  10. -i
  11. webgl.idl
  12. -v
  13. v2
  14. -t
  15. EventTarget=TJSEventTarget,DOMHighResTimeStamp=TJSDOMHighResTimeStamp,HTMLMediaElement=TJSElement,MediaStream=JSValue,MediaStreamTrack=JSValue,EventHandler=TJSEVentHandler,Promise=TJSPromise,Event=TJSEvent,Worklet=TJSOBject,WorkletGlobalScope=TJSObject,VoidFunction=TProcedure,MessagePort=TJSMessagePort,HTMLCanvasElement=TJSHTMLCanvasElement,BufferSource=TJSBufferSource,ArrayBufferView=TJSTypedArray
  16. -x
  17. web,types
  18. -d
  19. -p
  20. Command-line options translate to:
  21. Options : [coDictionaryAsClass,coaddOptionsToheader]
  22. Keyword prefix :
  23. Keyword suffix : _
  24. Class prefix : TJS
  25. Class suffix :
  26. Field prefix : F
  27. WEBIDLversion : v2
  28. Type aliases:
  29. EventTarget=TJSEventTarget
  30. DOMHighResTimeStamp=TJSDOMHighResTimeStamp
  31. HTMLMediaElement=TJSElement
  32. MediaStream=JSValue
  33. MediaStreamTrack=JSValue
  34. EventHandler=TJSEVentHandler
  35. Promise=TJSPromise
  36. Event=TJSEvent
  37. Worklet=TJSOBject
  38. WorkletGlobalScope=TJSObject
  39. VoidFunction=TProcedure
  40. MessagePort=TJSMessagePort
  41. HTMLCanvasElement=TJSHTMLCanvasElement
  42. BufferSource=TJSBufferSource
  43. ArrayBufferView=TJSTypedArray
  44. }
  45. Type
  46. // Forward class definitions
  47. TJSWebGLObject = Class;
  48. TJSWebGLBuffer = Class;
  49. TJSWebGLFramebuffer = Class;
  50. TJSWebGLProgram = Class;
  51. TJSWebGLRenderbuffer = Class;
  52. TJSWebGLShader = Class;
  53. TJSWebGLTexture = Class;
  54. TJSWebGLUniformLocation = Class;
  55. TJSWebGLActiveInfo = Class;
  56. TJSWebGLShaderPrecisionFormat = Class;
  57. TJSWebGLRenderingContextBase = Class;
  58. TJSWebGLRenderingContext = Class;
  59. TJSWebGLContextEvent = Class;
  60. TJSWebGLContextAttributes = Class;
  61. TJSWebGLContextEventInit = Class;
  62. WebGLPowerPreference = String;
  63. GLenum = NativeInt;
  64. GLboolean = boolean;
  65. GLbitfield = NativeInt;
  66. GLbyte = byte;
  67. GLshort = Integer;
  68. GLint = Integer;
  69. GLsizei = Integer;
  70. GLintptr = NativeInt;
  71. GLsizeiptr = NativeInt;
  72. GLubyte = Byte;
  73. GLushort = Cardinal;
  74. GLuint = NativeInt;
  75. GLfloat = Double;
  76. GLclampf = Double;
  77. // Union of ImageBitmap, ImageData, HTMLImageElement, HTMLCanvasElement, HTMLVideoElement
  78. TexImageSource = JSValue;
  79. // Union of Float32Array, sequence
  80. Float32List = JSValue;
  81. // Union of Int32Array, sequence
  82. Int32List = JSValue;
  83. { --------------------------------------------------------------------
  84. TJSWebGLContextAttributes
  85. --------------------------------------------------------------------}
  86. TJSWebGLContextAttributes = class(TJSObject)
  87. alpha : GLboolean;
  88. depth : GLboolean;
  89. stencil : GLboolean;
  90. antialias : GLboolean;
  91. premultipliedAlpha : GLboolean;
  92. preserveDrawingBuffer : GLboolean;
  93. powerPreference : WebGLPowerPreference;
  94. failIfMajorPerformanceCaveat : GLboolean;
  95. end;
  96. { --------------------------------------------------------------------
  97. TJSWebGLContextEventInit
  98. --------------------------------------------------------------------}
  99. TJSWebGLContextEventInit = class(TJSObject)
  100. statusMessage : String;
  101. end;
  102. { --------------------------------------------------------------------
  103. TJSWebGLObject
  104. --------------------------------------------------------------------}
  105. TJSWebGLObject = class external name 'WebGLObject'
  106. Private
  107. Public
  108. end;
  109. { --------------------------------------------------------------------
  110. TJSWebGLBuffer
  111. --------------------------------------------------------------------}
  112. TJSWebGLBuffer = class external name 'WebGLBuffer' (TJSWebGLObject)
  113. Private
  114. Public
  115. end;
  116. { --------------------------------------------------------------------
  117. TJSWebGLFramebuffer
  118. --------------------------------------------------------------------}
  119. TJSWebGLFramebuffer = class external name 'WebGLFramebuffer' (TJSWebGLObject)
  120. Private
  121. Public
  122. end;
  123. { --------------------------------------------------------------------
  124. TJSWebGLProgram
  125. --------------------------------------------------------------------}
  126. TJSWebGLProgram = class external name 'WebGLProgram' (TJSWebGLObject)
  127. Private
  128. Public
  129. end;
  130. { --------------------------------------------------------------------
  131. TJSWebGLRenderbuffer
  132. --------------------------------------------------------------------}
  133. TJSWebGLRenderbuffer = class external name 'WebGLRenderbuffer' (TJSWebGLObject)
  134. Private
  135. Public
  136. end;
  137. { --------------------------------------------------------------------
  138. TJSWebGLShader
  139. --------------------------------------------------------------------}
  140. TJSWebGLShader = class external name 'WebGLShader' (TJSWebGLObject)
  141. Private
  142. Public
  143. end;
  144. { --------------------------------------------------------------------
  145. TJSWebGLTexture
  146. --------------------------------------------------------------------}
  147. TJSWebGLTexture = class external name 'WebGLTexture' (TJSWebGLObject)
  148. Private
  149. Public
  150. end;
  151. { --------------------------------------------------------------------
  152. TJSWebGLUniformLocation
  153. --------------------------------------------------------------------}
  154. TJSWebGLUniformLocation = class external name 'WebGLUniformLocation'
  155. Private
  156. Public
  157. end;
  158. { --------------------------------------------------------------------
  159. TJSWebGLActiveInfo
  160. --------------------------------------------------------------------}
  161. TJSWebGLActiveInfo = class external name 'WebGLActiveInfo'
  162. Private
  163. Fsize : GLint; external name 'size';
  164. Ftype_ : GLenum; external name 'type';
  165. Fname : String; external name 'name';
  166. Public
  167. Property size : GLint Read Fsize;
  168. Property type_ : GLenum Read Ftype_;
  169. Property name : String Read Fname;
  170. end;
  171. { --------------------------------------------------------------------
  172. TJSWebGLShaderPrecisionFormat
  173. --------------------------------------------------------------------}
  174. TJSWebGLShaderPrecisionFormat = class external name 'WebGLShaderPrecisionFormat'
  175. Private
  176. FrangeMin : GLint; external name 'rangeMin';
  177. FrangeMax : GLint; external name 'rangeMax';
  178. Fprecision : GLint; external name 'precision';
  179. Public
  180. Property rangeMin : GLint Read FrangeMin;
  181. Property rangeMax : GLint Read FrangeMax;
  182. Property precision : GLint Read Fprecision;
  183. end;
  184. { --------------------------------------------------------------------
  185. TJSWebGLRenderingContextBase
  186. --------------------------------------------------------------------}
  187. TStringDynArray = Array of String;
  188. TTJSWebGLShaderDynArray = Array of TJSWebGLShader;
  189. TGLfloatDynArray = Array of GLfloat;
  190. TGLintDynArray = Array of GLint;
  191. // MG: added ancestor (TJSObject), issue 34745
  192. TJSWebGLRenderingContextBase = class external name 'WebGLRenderingContextBase' (TJSObject)
  193. Private
  194. Fcanvas : TJSHTMLCanvasElement; external name 'canvas';
  195. FdrawingBufferWidth : GLsizei; external name 'drawingBufferWidth';
  196. FdrawingBufferHeight : GLsizei; external name 'drawingBufferHeight';
  197. Public
  198. Const
  199. DEPTH_BUFFER_BIT = $00000100;
  200. STENCIL_BUFFER_BIT = $00000400;
  201. COLOR_BUFFER_BIT = $00004000;
  202. POINTS = $0000;
  203. LINES = $0001;
  204. LINE_LOOP = $0002;
  205. LINE_STRIP = $0003;
  206. TRIANGLES = $0004;
  207. TRIANGLE_STRIP = $0005;
  208. TRIANGLE_FAN = $0006;
  209. ZERO = 0;
  210. ONE = 1;
  211. SRC_COLOR = $0300;
  212. ONE_MINUS_SRC_COLOR = $0301;
  213. SRC_ALPHA = $0302;
  214. ONE_MINUS_SRC_ALPHA = $0303;
  215. DST_ALPHA = $0304;
  216. ONE_MINUS_DST_ALPHA = $0305;
  217. DST_COLOR = $0306;
  218. ONE_MINUS_DST_COLOR = $0307;
  219. SRC_ALPHA_SATURATE = $0308;
  220. FUNC_ADD = $8006;
  221. BLEND_EQUATION = $8009;
  222. BLEND_EQUATION_RGB = $8009;
  223. BLEND_EQUATION_ALPHA = $883D;
  224. FUNC_SUBTRACT = $800A;
  225. FUNC_REVERSE_SUBTRACT = $800B;
  226. BLEND_DST_RGB = $80C8;
  227. BLEND_SRC_RGB = $80C9;
  228. BLEND_DST_ALPHA = $80CA;
  229. BLEND_SRC_ALPHA = $80CB;
  230. CONSTANT_COLOR = $8001;
  231. ONE_MINUS_CONSTANT_COLOR = $8002;
  232. CONSTANT_ALPHA = $8003;
  233. ONE_MINUS_CONSTANT_ALPHA = $8004;
  234. BLEND_COLOR = $8005;
  235. ARRAY_BUFFER = $8892;
  236. ELEMENT_ARRAY_BUFFER = $8893;
  237. ARRAY_BUFFER_BINDING = $8894;
  238. ELEMENT_ARRAY_BUFFER_BINDING = $8895;
  239. STREAM_DRAW = $88E0;
  240. STATIC_DRAW = $88E4;
  241. DYNAMIC_DRAW = $88E8;
  242. BUFFER_SIZE = $8764;
  243. BUFFER_USAGE = $8765;
  244. CURRENT_VERTEX_ATTRIB = $8626;
  245. FRONT = $0404;
  246. BACK = $0405;
  247. FRONT_AND_BACK = $0408;
  248. CULL_FACE = $0B44;
  249. BLEND = $0BE2;
  250. DITHER = $0BD0;
  251. STENCIL_TEST = $0B90;
  252. DEPTH_TEST = $0B71;
  253. SCISSOR_TEST = $0C11;
  254. POLYGON_OFFSET_FILL = $8037;
  255. SAMPLE_ALPHA_TO_COVERAGE = $809E;
  256. SAMPLE_COVERAGE = $80A0;
  257. NO_ERROR = 0;
  258. INVALID_ENUM = $0500;
  259. INVALID_VALUE = $0501;
  260. INVALID_OPERATION = $0502;
  261. OUT_OF_MEMORY = $0505;
  262. CW = $0900;
  263. CCW = $0901;
  264. LINE_WIDTH = $0B21;
  265. ALIASED_POINT_SIZE_RANGE = $846D;
  266. ALIASED_LINE_WIDTH_RANGE = $846E;
  267. CULL_FACE_MODE = $0B45;
  268. FRONT_FACE = $0B46;
  269. DEPTH_RANGE = $0B70;
  270. DEPTH_WRITEMASK = $0B72;
  271. DEPTH_CLEAR_VALUE = $0B73;
  272. DEPTH_FUNC = $0B74;
  273. STENCIL_CLEAR_VALUE = $0B91;
  274. STENCIL_FUNC = $0B92;
  275. STENCIL_FAIL = $0B94;
  276. STENCIL_PASS_DEPTH_FAIL = $0B95;
  277. STENCIL_PASS_DEPTH_PASS = $0B96;
  278. STENCIL_REF = $0B97;
  279. STENCIL_VALUE_MASK = $0B93;
  280. STENCIL_WRITEMASK = $0B98;
  281. STENCIL_BACK_FUNC = $8800;
  282. STENCIL_BACK_FAIL = $8801;
  283. STENCIL_BACK_PASS_DEPTH_FAIL = $8802;
  284. STENCIL_BACK_PASS_DEPTH_PASS = $8803;
  285. STENCIL_BACK_REF = $8CA3;
  286. STENCIL_BACK_VALUE_MASK = $8CA4;
  287. STENCIL_BACK_WRITEMASK = $8CA5;
  288. VIEWPORT_ = $0BA2;
  289. SCISSOR_BOX = $0C10;
  290. COLOR_CLEAR_VALUE = $0C22;
  291. COLOR_WRITEMASK = $0C23;
  292. UNPACK_ALIGNMENT = $0CF5;
  293. PACK_ALIGNMENT = $0D05;
  294. MAX_TEXTURE_SIZE = $0D33;
  295. MAX_VIEWPORT_DIMS = $0D3A;
  296. SUBPIXEL_BITS = $0D50;
  297. RED_BITS = $0D52;
  298. GREEN_BITS = $0D53;
  299. BLUE_BITS = $0D54;
  300. ALPHA_BITS = $0D55;
  301. DEPTH_BITS = $0D56;
  302. STENCIL_BITS = $0D57;
  303. POLYGON_OFFSET_UNITS = $2A00;
  304. POLYGON_OFFSET_FACTOR = $8038;
  305. TEXTURE_BINDING_2D = $8069;
  306. SAMPLE_BUFFERS = $80A8;
  307. SAMPLES = $80A9;
  308. SAMPLE_COVERAGE_VALUE = $80AA;
  309. SAMPLE_COVERAGE_INVERT = $80AB;
  310. COMPRESSED_TEXTURE_FORMATS = $86A3;
  311. DONT_CARE = $1100;
  312. FASTEST = $1101;
  313. NICEST = $1102;
  314. GENERATE_MIPMAP_HINT = $8192;
  315. BYTE = $1400;
  316. UNSIGNED_BYTE = $1401;
  317. SHORT = $1402;
  318. UNSIGNED_SHORT = $1403;
  319. INT = $1404;
  320. UNSIGNED_INT = $1405;
  321. FLOAT = $1406;
  322. DEPTH_COMPONENT = $1902;
  323. ALPHA = $1906;
  324. RGB = $1907;
  325. RGBA = $1908;
  326. LUMINANCE = $1909;
  327. LUMINANCE_ALPHA = $190A;
  328. UNSIGNED_SHORT_4_4_4_4 = $8033;
  329. UNSIGNED_SHORT_5_5_5_1 = $8034;
  330. UNSIGNED_SHORT_5_6_5 = $8363;
  331. FRAGMENT_SHADER = $8B30;
  332. VERTEX_SHADER = $8B31;
  333. MAX_VERTEX_ATTRIBS = $8869;
  334. MAX_VERTEX_UNIFORM_VECTORS = $8DFB;
  335. MAX_VARYING_VECTORS = $8DFC;
  336. MAX_COMBINED_TEXTURE_IMAGE_UNITS = $8B4D;
  337. MAX_VERTEX_TEXTURE_IMAGE_UNITS = $8B4C;
  338. MAX_TEXTURE_IMAGE_UNITS = $8872;
  339. MAX_FRAGMENT_UNIFORM_VECTORS = $8DFD;
  340. SHADER_TYPE = $8B4F;
  341. DELETE_STATUS = $8B80;
  342. LINK_STATUS = $8B82;
  343. VALIDATE_STATUS = $8B83;
  344. ATTACHED_SHADERS = $8B85;
  345. ACTIVE_UNIFORMS = $8B86;
  346. ACTIVE_ATTRIBUTES = $8B89;
  347. SHADING_LANGUAGE_VERSION = $8B8C;
  348. CURRENT_PROGRAM = $8B8D;
  349. NEVER = $0200;
  350. LESS = $0201;
  351. EQUAL = $0202;
  352. LEQUAL = $0203;
  353. GREATER = $0204;
  354. NOTEQUAL = $0205;
  355. GEQUAL = $0206;
  356. ALWAYS = $0207;
  357. KEEP = $1E00;
  358. REPLACE = $1E01;
  359. INCR = $1E02;
  360. DECR = $1E03;
  361. INVERT = $150A;
  362. INCR_WRAP = $8507;
  363. DECR_WRAP = $8508;
  364. VENDOR = $1F00;
  365. RENDERER = $1F01;
  366. VERSION = $1F02;
  367. NEAREST = $2600;
  368. LINEAR = $2601;
  369. NEAREST_MIPMAP_NEAREST = $2700;
  370. LINEAR_MIPMAP_NEAREST = $2701;
  371. NEAREST_MIPMAP_LINEAR = $2702;
  372. LINEAR_MIPMAP_LINEAR = $2703;
  373. TEXTURE_MAG_FILTER = $2800;
  374. TEXTURE_MIN_FILTER = $2801;
  375. TEXTURE_WRAP_S = $2802;
  376. TEXTURE_WRAP_T = $2803;
  377. TEXTURE_2D = $0DE1;
  378. TEXTURE = $1702;
  379. TEXTURE_CUBE_MAP = $8513;
  380. TEXTURE_BINDING_CUBE_MAP = $8514;
  381. TEXTURE_CUBE_MAP_POSITIVE_X = $8515;
  382. TEXTURE_CUBE_MAP_NEGATIVE_X = $8516;
  383. TEXTURE_CUBE_MAP_POSITIVE_Y = $8517;
  384. TEXTURE_CUBE_MAP_NEGATIVE_Y = $8518;
  385. TEXTURE_CUBE_MAP_POSITIVE_Z = $8519;
  386. TEXTURE_CUBE_MAP_NEGATIVE_Z = $851A;
  387. MAX_CUBE_MAP_TEXTURE_SIZE = $851C;
  388. TEXTURE0 = $84C0;
  389. TEXTURE1 = $84C1;
  390. TEXTURE2 = $84C2;
  391. TEXTURE3 = $84C3;
  392. TEXTURE4 = $84C4;
  393. TEXTURE5 = $84C5;
  394. TEXTURE6 = $84C6;
  395. TEXTURE7 = $84C7;
  396. TEXTURE8 = $84C8;
  397. TEXTURE9 = $84C9;
  398. TEXTURE10 = $84CA;
  399. TEXTURE11 = $84CB;
  400. TEXTURE12 = $84CC;
  401. TEXTURE13 = $84CD;
  402. TEXTURE14 = $84CE;
  403. TEXTURE15 = $84CF;
  404. TEXTURE16 = $84D0;
  405. TEXTURE17 = $84D1;
  406. TEXTURE18 = $84D2;
  407. TEXTURE19 = $84D3;
  408. TEXTURE20 = $84D4;
  409. TEXTURE21 = $84D5;
  410. TEXTURE22 = $84D6;
  411. TEXTURE23 = $84D7;
  412. TEXTURE24 = $84D8;
  413. TEXTURE25 = $84D9;
  414. TEXTURE26 = $84DA;
  415. TEXTURE27 = $84DB;
  416. TEXTURE28 = $84DC;
  417. TEXTURE29 = $84DD;
  418. TEXTURE30 = $84DE;
  419. TEXTURE31 = $84DF;
  420. ACTIVE_TEXTURE = $84E0;
  421. REPEAT_ = $2901;
  422. CLAMP_TO_EDGE = $812F;
  423. MIRRORED_REPEAT = $8370;
  424. FLOAT_VEC2 = $8B50;
  425. FLOAT_VEC3 = $8B51;
  426. FLOAT_VEC4 = $8B52;
  427. INT_VEC2 = $8B53;
  428. INT_VEC3 = $8B54;
  429. INT_VEC4 = $8B55;
  430. BOOL = $8B56;
  431. BOOL_VEC2 = $8B57;
  432. BOOL_VEC3 = $8B58;
  433. BOOL_VEC4 = $8B59;
  434. FLOAT_MAT2 = $8B5A;
  435. FLOAT_MAT3 = $8B5B;
  436. FLOAT_MAT4 = $8B5C;
  437. SAMPLER_2D = $8B5E;
  438. SAMPLER_CUBE = $8B60;
  439. VERTEX_ATTRIB_ARRAY_ENABLED = $8622;
  440. VERTEX_ATTRIB_ARRAY_SIZE = $8623;
  441. VERTEX_ATTRIB_ARRAY_STRIDE = $8624;
  442. VERTEX_ATTRIB_ARRAY_TYPE = $8625;
  443. VERTEX_ATTRIB_ARRAY_NORMALIZED = $886A;
  444. VERTEX_ATTRIB_ARRAY_POINTER = $8645;
  445. VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = $889F;
  446. IMPLEMENTATION_COLOR_READ_TYPE = $8B9A;
  447. IMPLEMENTATION_COLOR_READ_FORMAT = $8B9B;
  448. COMPILE_STATUS = $8B81;
  449. LOW_FLOAT = $8DF0;
  450. MEDIUM_FLOAT = $8DF1;
  451. HIGH_FLOAT = $8DF2;
  452. LOW_INT = $8DF3;
  453. MEDIUM_INT = $8DF4;
  454. HIGH_INT = $8DF5;
  455. FRAMEBUFFER = $8D40;
  456. RENDERBUFFER = $8D41;
  457. RGBA4 = $8056;
  458. RGB5_A1 = $8057;
  459. RGB565 = $8D62;
  460. DEPTH_COMPONENT16 = $81A5;
  461. STENCIL_INDEX8 = $8D48;
  462. DEPTH_STENCIL = $84F9;
  463. RENDERBUFFER_WIDTH = $8D42;
  464. RENDERBUFFER_HEIGHT = $8D43;
  465. RENDERBUFFER_INTERNAL_FORMAT = $8D44;
  466. RENDERBUFFER_RED_SIZE = $8D50;
  467. RENDERBUFFER_GREEN_SIZE = $8D51;
  468. RENDERBUFFER_BLUE_SIZE = $8D52;
  469. RENDERBUFFER_ALPHA_SIZE = $8D53;
  470. RENDERBUFFER_DEPTH_SIZE = $8D54;
  471. RENDERBUFFER_STENCIL_SIZE = $8D55;
  472. FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = $8CD0;
  473. FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = $8CD1;
  474. FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = $8CD2;
  475. FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = $8CD3;
  476. COLOR_ATTACHMENT0 = $8CE0;
  477. DEPTH_ATTACHMENT = $8D00;
  478. STENCIL_ATTACHMENT = $8D20;
  479. DEPTH_STENCIL_ATTACHMENT = $821A;
  480. NONE = 0;
  481. FRAMEBUFFER_COMPLETE = $8CD5;
  482. FRAMEBUFFER_INCOMPLETE_ATTACHMENT = $8CD6;
  483. FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = $8CD7;
  484. FRAMEBUFFER_INCOMPLETE_DIMENSIONS = $8CD9;
  485. FRAMEBUFFER_UNSUPPORTED = $8CDD;
  486. FRAMEBUFFER_BINDING = $8CA6;
  487. RENDERBUFFER_BINDING = $8CA7;
  488. MAX_RENDERBUFFER_SIZE = $84E8;
  489. INVALID_FRAMEBUFFER_OPERATION = $0506;
  490. UNPACK_FLIP_Y_WEBGL = $9240;
  491. UNPACK_PREMULTIPLY_ALPHA_WEBGL = $9241;
  492. CONTEXT_LOST_WEBGL = $9242;
  493. UNPACK_COLORSPACE_CONVERSION_WEBGL = $9243;
  494. BROWSER_DEFAULT_WEBGL = $9244;
  495. Public
  496. function getContextAttributes: TJSWebGLContextAttributes;
  497. function isContextLost: boolean;
  498. function getSupportedExtensions: TStringDynArray;
  499. function getExtension(name : String): TJSObject;
  500. Procedure activeTexture(texture : GLenum);
  501. Procedure attachShader(program_ : TJSWebGLProgram; shader : TJSWebGLShader);
  502. Procedure bindAttribLocation(program_ : TJSWebGLProgram; index : GLuint; name : String);
  503. Procedure bindBuffer(target : GLenum; buffer : TJSWebGLBuffer);
  504. Procedure bindFramebuffer(target : GLenum; framebuffer : TJSWebGLFramebuffer);
  505. Procedure bindRenderbuffer(target : GLenum; renderbuffer : TJSWebGLRenderbuffer);
  506. Procedure bindTexture(target : GLenum; texture : TJSWebGLTexture);
  507. Procedure blendColor(red : GLclampf; green : GLclampf; blue : GLclampf; alpha : GLclampf);
  508. Procedure blendEquation(mode : GLenum);
  509. Procedure blendEquationSeparate(modeRGB : GLenum; modeAlpha : GLenum);
  510. Procedure blendFunc(sfactor : GLenum; dfactor : GLenum);
  511. Procedure blendFuncSeparate(srcRGB : GLenum; dstRGB : GLenum; srcAlpha : GLenum; dstAlpha : GLenum);
  512. Procedure bufferData(target : GLenum; size : GLsizeiptr; usage : GLenum); overload;
  513. Procedure bufferData(target : GLenum; data : TJSBufferSource; usage : GLenum); overload;
  514. Procedure bufferSubData(target : GLenum; offset : GLintptr; data : TJSBufferSource);
  515. function checkFramebufferStatus(target : GLenum): GLenum;
  516. Procedure clear(mask : GLbitfield);
  517. Procedure clearColor(red : GLclampf; green : GLclampf; blue : GLclampf; alpha : GLclampf);
  518. Procedure clearDepth(depth : GLclampf);
  519. Procedure clearStencil(s : GLint);
  520. Procedure colorMask(red : GLboolean; green : GLboolean; blue : GLboolean; alpha : GLboolean);
  521. Procedure compileShader(shader : TJSWebGLShader);
  522. Procedure compressedTexImage2D(target : GLenum; level : GLint; internalformat : GLenum; width : GLsizei; height : GLsizei; border : GLint; data : TJSTypedArray);
  523. Procedure compressedTexSubImage2D(target : GLenum; level : GLint; xoffset : GLint; yoffset : GLint; width : GLsizei; height : GLsizei; format : GLenum; data : TJSTypedArray);
  524. Procedure copyTexImage2D(target : GLenum; level : GLint; internalformat : GLenum; x : GLint; y : GLint; width : GLsizei; height : GLsizei; border : GLint);
  525. Procedure copyTexSubImage2D(target : GLenum; level : GLint; xoffset : GLint; yoffset : GLint; x : GLint; y : GLint; width : GLsizei; height : GLsizei);
  526. function createBuffer: TJSWebGLBuffer;
  527. function createFramebuffer: TJSWebGLFramebuffer;
  528. function createProgram: TJSWebGLProgram;
  529. function createRenderbuffer: TJSWebGLRenderbuffer;
  530. function createShader(type_ : GLenum): TJSWebGLShader;
  531. function createTexture: TJSWebGLTexture;
  532. Procedure cullFace(mode : GLenum);
  533. Procedure deleteBuffer(buffer : TJSWebGLBuffer);
  534. Procedure deleteFramebuffer(framebuffer : TJSWebGLFramebuffer);
  535. Procedure deleteProgram(program_ : TJSWebGLProgram);
  536. Procedure deleteRenderbuffer(renderbuffer : TJSWebGLRenderbuffer);
  537. Procedure deleteShader(shader : TJSWebGLShader);
  538. Procedure deleteTexture(texture : TJSWebGLTexture);
  539. Procedure depthFunc(func : GLenum);
  540. Procedure depthMask(flag : GLboolean);
  541. Procedure depthRange(zNear : GLclampf; zFar : GLclampf);
  542. Procedure detachShader(program_ : TJSWebGLProgram; shader : TJSWebGLShader);
  543. Procedure disable(cap : GLenum);
  544. Procedure disableVertexAttribArray(index : GLuint);
  545. Procedure drawArrays(mode : GLenum; first : GLint; count : GLsizei);
  546. Procedure drawElements(mode : GLenum; count : GLsizei; type_ : GLenum; offset : GLintptr);
  547. Procedure enable(cap : GLenum);
  548. Procedure enableVertexAttribArray(index : GLuint);
  549. Procedure finish;
  550. Procedure flush;
  551. Procedure framebufferRenderbuffer(target : GLenum; attachment : GLenum; renderbuffertarget : GLenum; renderbuffer : TJSWebGLRenderbuffer);
  552. Procedure framebufferTexture2D(target : GLenum; attachment : GLenum; textarget : GLenum; texture : TJSWebGLTexture; level : GLint);
  553. Procedure frontFace(mode : GLenum);
  554. Procedure generateMipmap(target : GLenum);
  555. function getActiveAttrib(program_ : TJSWebGLProgram; index : GLuint): TJSWebGLActiveInfo;
  556. function getActiveUniform(program_ : TJSWebGLProgram; index : GLuint): TJSWebGLActiveInfo;
  557. function getAttachedShaders(program_ : TJSWebGLProgram): TTJSWebGLShaderDynArray;
  558. function getAttribLocation(program_ : TJSWebGLProgram; name : String): GLint;
  559. function getBufferParameter(target : GLenum; pname : GLenum): JSValue;
  560. function getParameter(pname : GLenum): JSValue;
  561. function getError: GLenum;
  562. function getFramebufferAttachmentParameter(target : GLenum; attachment : GLenum; pname : GLenum): JSValue;
  563. function getProgramParameter(program_ : TJSWebGLProgram; pname : GLenum): JSValue;
  564. function getProgramInfoLog(program_ : TJSWebGLProgram): String;
  565. function getRenderbufferParameter(target : GLenum; pname : GLenum): JSValue;
  566. function getShaderParameter(shader : TJSWebGLShader; pname : GLenum): JSValue;
  567. function getShaderPrecisionFormat(shadertype : GLenum; precisiontype : GLenum): TJSWebGLShaderPrecisionFormat;
  568. function getShaderInfoLog(shader : TJSWebGLShader): String;
  569. function getShaderSource(shader : TJSWebGLShader): String;
  570. function getTexParameter(target : GLenum; pname : GLenum): JSValue;
  571. function getUniform(program_ : TJSWebGLProgram; location : TJSWebGLUniformLocation): JSValue;
  572. function getUniformLocation(program_ : TJSWebGLProgram; name : String): TJSWebGLUniformLocation;
  573. function getVertexAttrib(index : GLuint; pname : GLenum): JSValue;
  574. function getVertexAttribOffset(index : GLuint; pname : GLenum): GLintptr;
  575. Procedure hint(target : GLenum; mode : GLenum);
  576. function isBuffer(buffer : TJSWebGLBuffer): GLboolean;
  577. function isEnabled(cap : GLenum): GLboolean;
  578. function isFramebuffer(framebuffer : TJSWebGLFramebuffer): GLboolean;
  579. function isProgram(program_ : TJSWebGLProgram): GLboolean;
  580. function isRenderbuffer(renderbuffer : TJSWebGLRenderbuffer): GLboolean;
  581. function isShader(shader : TJSWebGLShader): GLboolean;
  582. function isTexture(texture : TJSWebGLTexture): GLboolean;
  583. Procedure lineWidth(width : GLfloat);
  584. Procedure linkProgram(program_ : TJSWebGLProgram);
  585. Procedure pixelStorei(pname : GLenum; param : GLint);
  586. Procedure polygonOffset(factor : GLfloat; units : GLfloat);
  587. Procedure readPixels(x : GLint; y : GLint; width : GLsizei; height : GLsizei; format : GLenum; type_ : GLenum; pixels : TJSTypedArray);
  588. Procedure renderbufferStorage(target : GLenum; internalformat : GLenum; width : GLsizei; height : GLsizei);
  589. Procedure sampleCoverage(value : GLclampf; invert : GLboolean);
  590. Procedure scissor(x : GLint; y : GLint; width : GLsizei; height : GLsizei);
  591. Procedure shaderSource(shader : TJSWebGLShader; source : String);
  592. Procedure stencilFunc(func : GLenum; ref : GLint; mask : GLuint);
  593. Procedure stencilFuncSeparate(face : GLenum; func : GLenum; ref : GLint; mask : GLuint);
  594. Procedure stencilMask(mask : GLuint);
  595. Procedure stencilMaskSeparate(face : GLenum; mask : GLuint);
  596. Procedure stencilOp(fail : GLenum; zfail : GLenum; zpass : GLenum);
  597. Procedure stencilOpSeparate(face : GLenum; fail : GLenum; zfail : GLenum; zpass : GLenum);
  598. Procedure texImage2D(target : GLenum; level : GLint; internalformat : GLint; width : GLsizei; height : GLsizei; border : GLint; format : GLenum; type_ : GLenum; pixels : TJSTypedArray);
  599. Procedure texImage2D(target : GLenum; level : GLint; internalformat : GLint; format : GLenum; type_ : GLenum; source : TexImageSource);
  600. Procedure texParameterf(target : GLenum; pname : GLenum; param : GLfloat);
  601. Procedure texParameteri(target : GLenum; pname : GLenum; param : GLint);
  602. Procedure texSubImage2D(target : GLenum; level : GLint; xoffset : GLint; yoffset : GLint; width : GLsizei; height : GLsizei; format : GLenum; type_ : GLenum; pixels : TJSTypedArray);
  603. Procedure texSubImage2D(target : GLenum; level : GLint; xoffset : GLint; yoffset : GLint; format : GLenum; type_ : GLenum; source : TexImageSource);
  604. Procedure uniform1f(location : TJSWebGLUniformLocation; x : GLfloat);
  605. Procedure uniform2f(location : TJSWebGLUniformLocation; x : GLfloat; y : GLfloat);
  606. Procedure uniform3f(location : TJSWebGLUniformLocation; x : GLfloat; y : GLfloat; z : GLfloat);
  607. Procedure uniform4f(location : TJSWebGLUniformLocation; x : GLfloat; y : GLfloat; z : GLfloat; w : GLfloat);
  608. Procedure uniform1i(location : TJSWebGLUniformLocation; x : GLint);
  609. Procedure uniform2i(location : TJSWebGLUniformLocation; x : GLint; y : GLint);
  610. Procedure uniform3i(location : TJSWebGLUniformLocation; x : GLint; y : GLint; z : GLint);
  611. Procedure uniform4i(location : TJSWebGLUniformLocation; x : GLint; y : GLint; z : GLint; w : GLint);
  612. Procedure uniform1fv(location : TJSWebGLUniformLocation; v : Float32List);
  613. Procedure uniform2fv(location : TJSWebGLUniformLocation; v : Float32List);
  614. Procedure uniform3fv(location : TJSWebGLUniformLocation; v : Float32List);
  615. Procedure uniform4fv(location : TJSWebGLUniformLocation; v : Float32List);
  616. Procedure uniform1iv(location : TJSWebGLUniformLocation; v : Int32List);
  617. Procedure uniform2iv(location : TJSWebGLUniformLocation; v : Int32List);
  618. Procedure uniform3iv(location : TJSWebGLUniformLocation; v : Int32List);
  619. Procedure uniform4iv(location : TJSWebGLUniformLocation; v : Int32List);
  620. Procedure uniformMatrix2fv(location : TJSWebGLUniformLocation; transpose : GLboolean; value : Float32List);
  621. Procedure uniformMatrix3fv(location : TJSWebGLUniformLocation; transpose : GLboolean; value : Float32List);
  622. Procedure uniformMatrix4fv(location : TJSWebGLUniformLocation; transpose : GLboolean; value : Float32List);
  623. Procedure useProgram(program_ : TJSWebGLProgram);
  624. Procedure validateProgram(program_ : TJSWebGLProgram);
  625. Procedure vertexAttrib1f(index : GLuint; x : GLfloat);
  626. Procedure vertexAttrib2f(index : GLuint; x : GLfloat; y : GLfloat);
  627. Procedure vertexAttrib3f(index : GLuint; x : GLfloat; y : GLfloat; z : GLfloat);
  628. Procedure vertexAttrib4f(index : GLuint; x : GLfloat; y : GLfloat; z : GLfloat; w : GLfloat);
  629. Procedure vertexAttrib1fv(index : GLuint; values : Float32List);
  630. Procedure vertexAttrib2fv(index : GLuint; values : Float32List);
  631. Procedure vertexAttrib3fv(index : GLuint; values : Float32List);
  632. Procedure vertexAttrib4fv(index : GLuint; values : Float32List);
  633. Procedure vertexAttribPointer(index : GLuint; size : GLint; type_ : GLenum; normalized : GLboolean; stride : GLsizei; offset : GLintptr);
  634. Procedure viewport(x : GLint; y : GLint; width : GLsizei; height : GLsizei);
  635. Property canvas : TJSHTMLCanvasElement Read Fcanvas;
  636. Property drawingBufferWidth : GLsizei Read FdrawingBufferWidth;
  637. Property drawingBufferHeight : GLsizei Read FdrawingBufferHeight;
  638. end;
  639. { --------------------------------------------------------------------
  640. TJSWebGLRenderingContext
  641. --------------------------------------------------------------------}
  642. TJSWebGLRenderingContext = class external name 'WebGLRenderingContext' (TJSWebGLRenderingContextBase)
  643. Private
  644. Public
  645. end;
  646. { --------------------------------------------------------------------
  647. TJSWebGLContextEvent
  648. --------------------------------------------------------------------}
  649. TJSWebGLContextEvent = class external name 'WebGLContextEvent' (TJSEvent)
  650. Private
  651. FstatusMessage : String; external name 'statusMessage';
  652. Public
  653. Property statusMessage : String Read FstatusMessage;
  654. end;
  655. implementation
  656. end.