qopenglfunctions_es2.sip 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815
  1. // qopenglfunctions_es2.sip generated by MetaSIP
  2. //
  3. // This file is part of the QtOpenGL Python extension module.
  4. //
  5. // Copyright (c) 2026 Riverbank Computing Limited <info@riverbankcomputing.com>
  6. //
  7. // This file is part of PyQt6.
  8. //
  9. // This file may be used under the terms of the GNU General Public License
  10. // version 3.0 as published by the Free Software Foundation and appearing in
  11. // the file LICENSE included in the packaging of this file. Please review the
  12. // following information to ensure the GNU General Public License version 3.0
  13. // requirements will be met: http://www.gnu.org/copyleft/gpl.html.
  14. //
  15. // If you do not wish to use this file under the terms of the GPL version 3.0
  16. // then you may purchase a commercial license. For more information contact
  17. // info@riverbankcomputing.com.
  18. //
  19. // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  20. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  21. %If (PyQt_OpenGL_ES2)
  22. class QOpenGLFunctions_ES2 : public QAbstractOpenGLFunctions
  23. {
  24. %TypeHeaderCode
  25. #include <qopenglfunctions_es2.h>
  26. %End
  27. public:
  28. QOpenGLFunctions_ES2();
  29. bool initializeOpenGLFunctions();
  30. void glActiveTexture(GLenum texture);
  31. void glAttachShader(GLuint program, GLuint shader);
  32. void glBindAttribLocation(GLuint program, GLuint index, const GLchar *name);
  33. void glBindBuffer(GLenum target, GLuint buffer);
  34. void glBindFramebuffer(GLenum target, GLuint framebuffer);
  35. void glBindRenderbuffer(GLenum target, GLuint renderbuffer);
  36. void glBindTexture(GLenum target, GLuint texture);
  37. void glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
  38. void glBlendEquation(GLenum mode);
  39. void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
  40. void glBlendFunc(GLenum sfactor, GLenum dfactor);
  41. void glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
  42. void glBufferData(GLenum target, GLsizeiptr size, SIP_PYOBJECT data /TypeHint="PYQT_OPENGL_ARRAY"/, GLenum usage);
  43. %MethodCode
  44. const GLvoid *array;
  45. if (a2 == Py_None)
  46. array = 0;
  47. else
  48. array = qpyopengl_value_array(&sipError, a2, GL_UNSIGNED_BYTE, sipSelf);
  49. if (sipError == sipErrorNone)
  50. sipCpp->glBufferData(a0, a1, array, a3);
  51. %End
  52. void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, SIP_PYOBJECT data /TypeHint="PYQT_OPENGL_ARRAY"/);
  53. %MethodCode
  54. const GLvoid *array;
  55. if (a3 == Py_None)
  56. array = 0;
  57. else
  58. array = qpyopengl_value_array(&sipError, a3, GL_UNSIGNED_BYTE, sipSelf);
  59. if (sipError == sipErrorNone)
  60. sipCpp->glBufferSubData(a0, a1, a2, array);
  61. %End
  62. GLenum glCheckFramebufferStatus(GLenum target);
  63. void glClear(GLbitfield mask);
  64. void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
  65. void glClearDepthf(GLclampf depth);
  66. void glClearStencil(GLint s);
  67. void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
  68. void glCompileShader(GLuint shader);
  69. void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, SIP_PYOBJECT data /TypeHint="PYQT_OPENGL_ARRAY"/);
  70. %MethodCode
  71. const GLvoid *array = qpyopengl_value_array(&sipError, a7, GL_UNSIGNED_BYTE,
  72. sipSelf);
  73. if (sipError == sipErrorNone)
  74. sipCpp->glCompressedTexImage2D(a0, a1, a2, a3, a4, a5, a6, array);
  75. %End
  76. void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, SIP_PYOBJECT data /TypeHint="PYQT_OPENGL_ARRAY"/);
  77. %MethodCode
  78. const GLvoid *array = qpyopengl_value_array(&sipError, a8, GL_UNSIGNED_BYTE,
  79. sipSelf);
  80. if (sipError == sipErrorNone)
  81. sipCpp->glCompressedTexSubImage2D(a0, a1, a2, a3, a4, a5, a6, a7, array);
  82. %End
  83. void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
  84. void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
  85. GLuint glCreateProgram();
  86. GLuint glCreateShader(GLenum type);
  87. void glCullFace(GLenum mode);
  88. void glDeleteBuffers(GLsizei n, SIP_PYOBJECT buffers /TypeHint="PYQT_OPENGL_ARRAY"/);
  89. %MethodCode
  90. const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_UNSIGNED_INT,
  91. sipSelf);
  92. if (sipError == sipErrorNone)
  93. sipCpp->glDeleteBuffers(a0, reinterpret_cast<const GLuint *>(array));
  94. %End
  95. void glDeleteFramebuffers(GLsizei n, SIP_PYOBJECT framebuffers);
  96. %MethodCode
  97. const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_UNSIGNED_INT,
  98. sipSelf);
  99. if (sipError == sipErrorNone)
  100. sipCpp->glDeleteFramebuffers(a0, reinterpret_cast<const GLuint *>(array));
  101. %End
  102. void glDeleteProgram(GLuint program);
  103. void glDeleteRenderbuffers(GLsizei n, SIP_PYOBJECT renderbuffers);
  104. %MethodCode
  105. const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_UNSIGNED_INT,
  106. sipSelf);
  107. if (sipError == sipErrorNone)
  108. sipCpp->glDeleteRenderbuffers(a0, reinterpret_cast<const GLuint *>(array));
  109. %End
  110. void glDeleteShader(GLuint shader);
  111. void glDeleteTextures(GLsizei n, SIP_PYOBJECT textures /TypeHint="PYQT_OPENGL_ARRAY"/);
  112. %MethodCode
  113. const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_UNSIGNED_INT,
  114. sipSelf);
  115. if (sipError == sipErrorNone)
  116. sipCpp->glDeleteTextures(a0, reinterpret_cast<const GLuint *>(array));
  117. %End
  118. void glDepthFunc(GLenum func);
  119. void glDepthMask(GLboolean flag);
  120. void glDepthRangef(GLclampf zNear, GLclampf zFar);
  121. void glDetachShader(GLuint program, GLuint shader);
  122. void glDisable(GLenum cap);
  123. void glDisableVertexAttribArray(GLuint index);
  124. void glDrawArrays(GLenum mode, GLint first, GLsizei count);
  125. void glDrawElements(GLenum mode, GLsizei count, GLenum type, SIP_PYOBJECT indices /TypeHint="PYQT_OPENGL_ARRAY"/);
  126. %MethodCode
  127. const GLvoid *array = qpyopengl_value_array(&sipError, a3, a2, sipSelf);
  128. if (sipError == sipErrorNone)
  129. sipCpp->glDrawElements(a0, a1, a2, array);
  130. %End
  131. void glEnable(GLenum cap);
  132. void glEnableVertexAttribArray(GLuint index);
  133. void glFinish();
  134. void glFlush();
  135. void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
  136. void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
  137. void glFrontFace(GLenum mode);
  138. void glGenBuffers(GLsizei n, SIP_PYOBJECT *buffers /TypeHint="Union[int, Tuple[int, ...]]"/);
  139. %MethodCode
  140. GLuint *params = new GLuint[a0];
  141. sipCpp->glGenBuffers(a0, params);
  142. a1 = qpyopengl_from_GLuint(&sipIsErr, params, a0);
  143. delete[] params;
  144. %End
  145. void glGenerateMipmap(GLenum target);
  146. void glGenFramebuffers(GLsizei n, SIP_PYOBJECT framebuffers /TypeHint="Union[int, Tuple[int, ...]]"/);
  147. %MethodCode
  148. GLuint *params = new GLuint[a0];
  149. sipCpp->glGenFramebuffers(a0, params);
  150. a1 = qpyopengl_from_GLuint(&sipIsErr, params, a0);
  151. delete[] params;
  152. %End
  153. void glGenRenderbuffers(GLsizei n, SIP_PYOBJECT *renderbuffers /TypeHint="Union[int, Tuple[int, ...]]"/);
  154. %MethodCode
  155. GLuint *params = new GLuint[a0];
  156. sipCpp->glGenRenderbuffers(a0, params);
  157. a1 = qpyopengl_from_GLuint(&sipIsErr, params, a0);
  158. delete[] params;
  159. %End
  160. void glGenTextures(GLsizei n, SIP_PYOBJECT textures /TypeHint="Union[int, Tuple[int, ...]]"/);
  161. %MethodCode
  162. GLuint *params = new GLuint[a0];
  163. sipCpp->glGenTextures(a0, params);
  164. a1 = qpyopengl_from_GLuint(&sipIsErr, params, a0);
  165. delete[] params;
  166. %End
  167. SIP_PYOBJECT glGetActiveAttrib(GLuint program, GLuint index) /TypeHint="Tuple[str, int, int]"/;
  168. %MethodCode
  169. GLint bufsize;
  170. sipCpp->glGetProgramiv(a0, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &bufsize);
  171. GLchar *name = new GLchar[bufsize];
  172. GLint size;
  173. GLenum type;
  174. sipCpp->glGetActiveAttrib(a0, a1, bufsize, 0, &size, &type, name);
  175. sipRes = Py_BuildValue("siI", name, size, type);
  176. if (!sipRes)
  177. sipIsErr = 1;
  178. delete[] name;
  179. %End
  180. SIP_PYOBJECT glGetActiveUniform(GLuint program, GLuint index) /TypeHint="Tuple[str, int, int]"/;
  181. %MethodCode
  182. GLint bufsize;
  183. sipCpp->glGetProgramiv(a0, GL_ACTIVE_UNIFORM_MAX_LENGTH, &bufsize);
  184. GLchar *name = new GLchar[bufsize];
  185. GLint size;
  186. GLenum type;
  187. sipCpp->glGetActiveUniform(a0, a1, bufsize, 0, &size, &type, name);
  188. sipRes = Py_BuildValue("siI", name, size, type);
  189. if (!sipRes)
  190. sipIsErr = 1;
  191. delete[] name;
  192. %End
  193. SIP_PYOBJECT glGetAttachedShaders(GLuint program) /TypeHint="Tuple[int, ...]"/;
  194. %MethodCode
  195. GLint nr_shaders;
  196. sipCpp->glGetProgramiv(a0, GL_ATTACHED_SHADERS, &nr_shaders);
  197. if (nr_shaders < 1)
  198. {
  199. sipRes = PyTuple_New(0);
  200. }
  201. else
  202. {
  203. GLuint *shaders = new GLuint[nr_shaders];
  204. sipCpp->glGetAttachedShaders(a0, nr_shaders, 0, shaders);
  205. sipRes = PyTuple_New(nr_shaders);
  206. if (sipRes)
  207. {
  208. for (GLint i = 0; i < nr_shaders; ++i)
  209. {
  210. PyObject *itm = PyLong_FromLong(shaders[i]);
  211. if (!itm)
  212. {
  213. Py_DECREF(sipRes);
  214. sipRes = 0;
  215. break;
  216. }
  217. PyTuple_SetItem(sipRes, i, itm);
  218. }
  219. }
  220. delete[] shaders;
  221. }
  222. if (!sipRes)
  223. sipIsErr = 1;
  224. %End
  225. int glGetAttribLocation(GLuint program, const GLchar *name);
  226. void glGetBooleanv(GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[bool, Tuple[bool, ...]]"/);
  227. %MethodCode
  228. GLboolean fixed_params[16], *params;
  229. GLint nr_params;
  230. GLenum query;
  231. nr_params = qpyopengl_get(a0, &query);
  232. if (nr_params == 0)
  233. {
  234. sipCpp->glGetIntegerv(query, &nr_params);
  235. params = new GLboolean[nr_params];
  236. }
  237. else
  238. {
  239. params = fixed_params;
  240. }
  241. sipCpp->glGetBooleanv(a0, params);
  242. a1 = qpyopengl_from_GLboolean(&sipIsErr, params, nr_params);
  243. if (params != fixed_params)
  244. delete[] params;
  245. %End
  246. void glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params);
  247. GLenum glGetError();
  248. void glGetFloatv(GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[float, Tuple[float, ...]]"/);
  249. %MethodCode
  250. GLfloat fixed_params[16], *params;
  251. GLint nr_params;
  252. GLenum query;
  253. nr_params = qpyopengl_get(a0, &query);
  254. if (nr_params == 0)
  255. {
  256. sipCpp->glGetIntegerv(query, &nr_params);
  257. params = new GLfloat[nr_params];
  258. }
  259. else
  260. {
  261. params = fixed_params;
  262. }
  263. sipCpp->glGetFloatv(a0, params);
  264. a1 = qpyopengl_from_GLfloat(&sipIsErr, params, nr_params);
  265. if (params != fixed_params)
  266. delete[] params;
  267. %End
  268. void glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params);
  269. void glGetIntegerv(GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[int, Tuple[int, ...]]"/);
  270. %MethodCode
  271. GLint fixed_params[16], *params;
  272. GLint nr_params;
  273. GLenum query;
  274. nr_params = qpyopengl_get(a0, &query);
  275. if (nr_params == 0)
  276. {
  277. sipCpp->glGetIntegerv(query, &nr_params);
  278. params = new GLint[nr_params];
  279. }
  280. else
  281. {
  282. params = fixed_params;
  283. }
  284. sipCpp->glGetIntegerv(a0, params);
  285. a1 = qpyopengl_from_GLint(&sipIsErr, params, nr_params);
  286. if (params != fixed_params)
  287. delete[] params;
  288. %End
  289. void glGetProgramiv(GLuint program, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[int, Tuple[int, int, int]]"/);
  290. %MethodCode
  291. GLint params[3];
  292. Py_ssize_t nr_params;
  293. switch (a1)
  294. {
  295. #if defined(GL_COMPUTE_LOCAL_WORK_SIZE)
  296. case GL_COMPUTE_LOCAL_WORK_SIZE:
  297. nr_params = 3;
  298. break;
  299. #endif
  300. default:
  301. nr_params = 1;
  302. }
  303. sipCpp->glGetProgramiv(a0, a1, params);
  304. a2 = qpyopengl_from_GLint(&sipIsErr, params, nr_params);
  305. %End
  306. SIP_PYOBJECT glGetProgramInfoLog(GLuint program) /TypeHint="bytes"/;
  307. %MethodCode
  308. GLint bufsize;
  309. sipCpp->glGetProgramiv(a0, GL_INFO_LOG_LENGTH, &bufsize);
  310. if (bufsize > 0)
  311. {
  312. GLchar *log = new GLchar[bufsize];
  313. sipCpp->glGetProgramInfoLog(a0, bufsize, 0, log);
  314. sipRes = PyBytes_FromString(log);
  315. delete[] log;
  316. }
  317. else
  318. {
  319. sipRes = PyBytes_FromString("");
  320. }
  321. %End
  322. void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params);
  323. void glGetShaderiv(GLuint shader, GLenum pname, GLint *params);
  324. SIP_PYOBJECT glGetShaderInfoLog(GLuint shader) /TypeHint="bytes"/;
  325. %MethodCode
  326. GLint bufsize;
  327. sipCpp->glGetShaderiv(a0, GL_INFO_LOG_LENGTH, &bufsize);
  328. if (bufsize > 0)
  329. {
  330. GLchar *log = new GLchar[bufsize];
  331. sipCpp->glGetShaderInfoLog(a0, bufsize, 0, log);
  332. sipRes = PyBytes_FromString(log);
  333. delete[] log;
  334. }
  335. else
  336. {
  337. sipRes = PyBytes_FromString("");
  338. }
  339. %End
  340. SIP_PYOBJECT glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype) /TypeHint="Tuple[Tuple[int, int], int]"/;
  341. %MethodCode
  342. GLint range[2], precision;
  343. sipCpp->glGetShaderPrecisionFormat(a0, a1, range, &precision);
  344. sipRes = Py_BuildValue("(ii)i", (int)range[0], (int)range[1], (int)precision);
  345. if (!sipRes)
  346. sipIsErr = 1;
  347. %End
  348. SIP_PYOBJECT glGetShaderSource(GLuint shader) /TypeHint="bytes"/;
  349. %MethodCode
  350. GLint bufsize;
  351. sipCpp->glGetShaderiv(a0, GL_SHADER_SOURCE_LENGTH, &bufsize);
  352. if (bufsize > 0)
  353. {
  354. GLchar *source = new GLchar[bufsize];
  355. sipCpp->glGetShaderSource(a0, bufsize, 0, source);
  356. sipRes = PyBytes_FromString(source);
  357. delete[] source;
  358. }
  359. else
  360. {
  361. sipRes = PyBytes_FromString("");
  362. }
  363. %End
  364. const char *glGetString(GLenum name);
  365. %MethodCode
  366. sipRes = reinterpret_cast<const char *>(sipCpp->glGetString(a0));
  367. %End
  368. void glGetTexParameterfv(GLenum target, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[float, Tuple[float, float, float, float]]"/);
  369. %MethodCode
  370. GLfloat params[4];
  371. Py_ssize_t nr_params;
  372. switch (a1)
  373. {
  374. #if defined(GL_TEXTURE_SWIZZLE_RGBA) || defined(GL_TEXTURE_BORDER_COLOR)
  375. #if defined(GL_TEXTURE_SWIZZLE_RGBA)
  376. case GL_TEXTURE_SWIZZLE_RGBA:
  377. #endif
  378. #if defined(GL_TEXTURE_BORDER_COLOR)
  379. case GL_TEXTURE_BORDER_COLOR:
  380. #endif
  381. nr_params = 4;
  382. break;
  383. #endif
  384. default:
  385. nr_params = 1;
  386. }
  387. sipCpp->glGetTexParameterfv(a0, a1, params);
  388. a2 = qpyopengl_from_GLfloat(&sipIsErr, params, nr_params);
  389. %End
  390. void glGetTexParameteriv(GLenum target, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[int, Tuple[int, int, int, int]]"/);
  391. %MethodCode
  392. GLint params[4];
  393. Py_ssize_t nr_params;
  394. switch (a1)
  395. {
  396. #if defined(GL_TEXTURE_SWIZZLE_RGBA) || defined(GL_TEXTURE_BORDER_COLOR)
  397. #if defined(GL_TEXTURE_SWIZZLE_RGBA)
  398. case GL_TEXTURE_SWIZZLE_RGBA:
  399. #endif
  400. #if defined(GL_TEXTURE_BORDER_COLOR)
  401. case GL_TEXTURE_BORDER_COLOR:
  402. #endif
  403. nr_params = 4;
  404. break;
  405. #endif
  406. default:
  407. nr_params = 1;
  408. }
  409. sipCpp->glGetTexParameteriv(a0, a1, params);
  410. a2 = qpyopengl_from_GLint(&sipIsErr, params, nr_params);
  411. %End
  412. int glGetUniformLocation(GLuint program, const GLchar *name);
  413. void glGetVertexAttribfv(GLuint index, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[float, Tuple[float, float, float, float]]"/);
  414. %MethodCode
  415. GLfloat params[4];
  416. Py_ssize_t nr_params;
  417. switch (a1)
  418. {
  419. case GL_CURRENT_VERTEX_ATTRIB:
  420. nr_params = 4;
  421. break;
  422. default:
  423. nr_params = 1;
  424. }
  425. sipCpp->glGetVertexAttribfv(a0, a1, params);
  426. a2 = qpyopengl_from_GLfloat(&sipIsErr, params, nr_params);
  427. %End
  428. void glGetVertexAttribiv(GLuint index, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[int, Tuple[int, int, int, int]]"/);
  429. %MethodCode
  430. GLint params[4];
  431. Py_ssize_t nr_params;
  432. switch (a1)
  433. {
  434. case GL_CURRENT_VERTEX_ATTRIB:
  435. nr_params = 4;
  436. break;
  437. default:
  438. nr_params = 1;
  439. }
  440. sipCpp->glGetVertexAttribiv(a0, a1, params);
  441. a2 = qpyopengl_from_GLint(&sipIsErr, params, nr_params);
  442. %End
  443. void glHint(GLenum target, GLenum mode);
  444. GLboolean glIsBuffer(GLuint buffer);
  445. GLboolean glIsEnabled(GLenum cap);
  446. GLboolean glIsFramebuffer(GLuint framebuffer);
  447. GLboolean glIsProgram(GLuint program);
  448. GLboolean glIsRenderbuffer(GLuint renderbuffer);
  449. GLboolean glIsShader(GLuint shader);
  450. GLboolean glIsTexture(GLuint texture);
  451. void glLineWidth(GLfloat width);
  452. void glLinkProgram(GLuint program);
  453. void glPixelStorei(GLenum pname, GLint param);
  454. void glPolygonOffset(GLfloat factor, GLfloat units);
  455. SIP_PYOBJECT glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type) /TypeHint="Union[Tuple[float, ...], Tuple[int, ...]]"/;
  456. %MethodCode
  457. int components;
  458. switch (a4)
  459. {
  460. case GL_RGB:
  461. {
  462. components = 3;
  463. break;
  464. }
  465. case GL_RGBA:
  466. {
  467. components = 4;
  468. break;
  469. }
  470. case GL_ALPHA:
  471. {
  472. components = 1;
  473. break;
  474. }
  475. default:
  476. components = 0;
  477. }
  478. Py_ssize_t length = components * a2 * a3;
  479. switch (a5)
  480. {
  481. // TODO: Implement array convertors for these formats.
  482. case GL_UNSIGNED_SHORT_5_6_5:
  483. case GL_UNSIGNED_SHORT_4_4_4_4:
  484. case GL_UNSIGNED_SHORT_5_5_5_1:
  485. case GL_UNSIGNED_BYTE:
  486. default:
  487. sipIsErr = 1;
  488. PyErr_SetString(PyExc_ValueError, "pixel data format not supported");
  489. }
  490. %End
  491. void glReleaseShaderCompiler();
  492. void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
  493. void glSampleCoverage(GLclampf value, GLboolean invert);
  494. void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
  495. void glStencilFunc(GLenum func, GLint ref, GLuint mask);
  496. void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
  497. void glStencilMask(GLuint mask);
  498. void glStencilMaskSeparate(GLenum face, GLuint mask);
  499. void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
  500. void glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
  501. void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, SIP_PYOBJECT pixels /TypeHint="PYQT_OPENGL_ARRAY"/);
  502. %MethodCode
  503. const GLvoid *array = qpyopengl_value_array(&sipError, a8, a7, sipSelf);
  504. if (sipError == sipErrorNone)
  505. sipCpp->glTexImage2D(a0, a1, a2, a3, a4, a5, a6, a7, array);
  506. %End
  507. void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
  508. void glTexParameterfv(GLenum target, GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/);
  509. %MethodCode
  510. const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf);
  511. if (sipError == sipErrorNone)
  512. sipCpp->glTexParameterfv(a0, a1, reinterpret_cast<const GLfloat *>(array));
  513. %End
  514. void glTexParameteri(GLenum target, GLenum pname, GLint param);
  515. void glTexParameteriv(GLenum target, GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/);
  516. %MethodCode
  517. const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf);
  518. if (sipError == sipErrorNone)
  519. sipCpp->glTexParameteriv(a0, a1, reinterpret_cast<const GLint *>(array));
  520. %End
  521. void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, SIP_PYOBJECT pixels /TypeHint="PYQT_OPENGL_ARRAY"/);
  522. %MethodCode
  523. const GLvoid *array = qpyopengl_value_array(&sipError, a8, a7, sipSelf);
  524. if (sipError == sipErrorNone)
  525. sipCpp->glTexSubImage2D(a0, a1, a2, a3, a4, a5, a6, a7, array);
  526. %End
  527. void glUniform1f(GLint location, GLfloat x);
  528. void glUniform1fv(GLint location, GLsizei count, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/);
  529. %MethodCode
  530. const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf);
  531. if (sipError == sipErrorNone)
  532. sipCpp->glUniform1fv(a0, a1, reinterpret_cast<const GLfloat *>(array));
  533. %End
  534. void glUniform1i(GLint location, GLint x);
  535. void glUniform1iv(GLint location, GLsizei count, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/);
  536. %MethodCode
  537. const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf);
  538. if (sipError == sipErrorNone)
  539. sipCpp->glUniform1iv(a0, a1, reinterpret_cast<const GLint *>(array));
  540. %End
  541. void glUniform2f(GLint location, GLfloat x, GLfloat y);
  542. void glUniform2fv(GLint location, GLsizei count, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/);
  543. %MethodCode
  544. const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf);
  545. if (sipError == sipErrorNone)
  546. sipCpp->glUniform2fv(a0, a1, reinterpret_cast<const GLfloat *>(array));
  547. %End
  548. void glUniform2i(GLint location, GLint x, GLint y);
  549. void glUniform2iv(GLint location, GLsizei count, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/);
  550. %MethodCode
  551. const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf);
  552. if (sipError == sipErrorNone)
  553. sipCpp->glUniform2iv(a0, a1, reinterpret_cast<const GLint *>(array));
  554. %End
  555. void glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z);
  556. void glUniform3fv(GLint location, GLsizei count, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/);
  557. %MethodCode
  558. const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf);
  559. if (sipError == sipErrorNone)
  560. sipCpp->glUniform3fv(a0, a1, reinterpret_cast<const GLfloat *>(array));
  561. %End
  562. void glUniform3i(GLint location, GLint x, GLint y, GLint z);
  563. void glUniform3iv(GLint location, GLsizei count, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/);
  564. %MethodCode
  565. const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf);
  566. if (sipError == sipErrorNone)
  567. sipCpp->glUniform3iv(a0, a1, reinterpret_cast<const GLint *>(array));
  568. %End
  569. void glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
  570. void glUniform4fv(GLint location, GLsizei count, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/);
  571. %MethodCode
  572. const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf);
  573. if (sipError == sipErrorNone)
  574. sipCpp->glUniform4fv(a0, a1, reinterpret_cast<const GLfloat *>(array));
  575. %End
  576. void glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w);
  577. void glUniform4iv(GLint location, GLsizei count, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/);
  578. %MethodCode
  579. const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf);
  580. if (sipError == sipErrorNone)
  581. sipCpp->glUniform4iv(a0, a1, reinterpret_cast<const GLint *>(array));
  582. %End
  583. void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/);
  584. %MethodCode
  585. const GLvoid *array = qpyopengl_value_array(&sipError, a3, GL_FLOAT, sipSelf);
  586. if (sipError == sipErrorNone)
  587. sipCpp->glUniformMatrix2fv(a0, a1, a2,
  588. reinterpret_cast<const GLfloat *>(array));
  589. %End
  590. void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/);
  591. %MethodCode
  592. const GLvoid *array = qpyopengl_value_array(&sipError, a3, GL_FLOAT, sipSelf);
  593. if (sipError == sipErrorNone)
  594. sipCpp->glUniformMatrix3fv(a0, a1, a2,
  595. reinterpret_cast<const GLfloat *>(array));
  596. %End
  597. void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/);
  598. %MethodCode
  599. const GLvoid *array = qpyopengl_value_array(&sipError, a3, GL_FLOAT, sipSelf);
  600. if (sipError == sipErrorNone)
  601. sipCpp->glUniformMatrix4fv(a0, a1, a2,
  602. reinterpret_cast<const GLfloat *>(array));
  603. %End
  604. void glUseProgram(GLuint program);
  605. void glValidateProgram(GLuint program);
  606. void glVertexAttrib1f(GLuint indx, GLfloat x);
  607. void glVertexAttrib1fv(GLuint indx, SIP_PYOBJECT values /TypeHint="PYQT_OPENGL_ARRAY"/);
  608. %MethodCode
  609. const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_FLOAT, sipSelf);
  610. if (sipError == sipErrorNone)
  611. sipCpp->glVertexAttrib1fv(a0, reinterpret_cast<const GLfloat *>(array));
  612. %End
  613. void glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y);
  614. void glVertexAttrib2fv(GLuint indx, SIP_PYOBJECT values /TypeHint="PYQT_OPENGL_ARRAY"/);
  615. %MethodCode
  616. const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_FLOAT, sipSelf);
  617. if (sipError == sipErrorNone)
  618. sipCpp->glVertexAttrib2fv(a0, reinterpret_cast<const GLfloat *>(array));
  619. %End
  620. void glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z);
  621. void glVertexAttrib3fv(GLuint indx, SIP_PYOBJECT values /TypeHint="PYQT_OPENGL_ARRAY"/);
  622. %MethodCode
  623. const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_FLOAT, sipSelf);
  624. if (sipError == sipErrorNone)
  625. sipCpp->glVertexAttrib3fv(a0, reinterpret_cast<const GLfloat *>(array));
  626. %End
  627. void glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
  628. void glVertexAttrib4fv(GLuint indx, SIP_PYOBJECT values /TypeHint="PYQT_OPENGL_ARRAY"/);
  629. %MethodCode
  630. const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_FLOAT, sipSelf);
  631. if (sipError == sipErrorNone)
  632. sipCpp->glVertexAttrib4fv(a0, reinterpret_cast<const GLfloat *>(array));
  633. %End
  634. void glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, SIP_PYOBJECT ptr /TypeHint="PYQT_OPENGL_BOUND_ARRAY"/);
  635. %MethodCode
  636. const GLvoid *array = qpyopengl_value_array_cached(&sipError, a5, a2, sipSelf,
  637. "VertexAttribPointer", a0);
  638. if (sipError == sipErrorNone)
  639. sipCpp->glVertexAttribPointer(a0, a1, a2, a3, a4, array);
  640. %End
  641. void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
  642. };
  643. %End