Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

885 lines
21 KiB

  1. /****************************************************************************\
  2. *
  3. * Client side vertex array
  4. *
  5. * History
  6. * 16-Jan-1995 mikeke Created
  7. *
  8. \****************************************************************************/
  9. #include "precomp.h"
  10. #pragma hdrstop
  11. #include <stdio.h>
  12. #include "compsize.h"
  13. #include "glsize.h"
  14. /****************************************************************************/
  15. #if DBG
  16. // The WARNING_NOOP macro will output the debug message once only.
  17. // If we have output a warning before, the new warnings are ignored.
  18. static int cWarningNoop = 0;
  19. #define WARNING_NOOP(str) \
  20. { \
  21. if (!cWarningNoop++) \
  22. DbgPrint("%s(%d): " str,__FILE__,__LINE__); \
  23. }
  24. #else
  25. #define WARNING_NOOP(str)
  26. #endif // DBG
  27. /****************************************************************************/
  28. PFNCLTVECTOR ppfnvTexCoord[32] = {
  29. NULL,
  30. NULL,
  31. (PFNCLTVECTOR)glTexCoord1sv,
  32. NULL,
  33. (PFNCLTVECTOR)glTexCoord1iv,
  34. NULL,
  35. (PFNCLTVECTOR)glTexCoord1fv,
  36. (PFNCLTVECTOR)glTexCoord1dv,
  37. NULL,
  38. NULL,
  39. (PFNCLTVECTOR)glTexCoord2sv,
  40. NULL,
  41. (PFNCLTVECTOR)glTexCoord2iv,
  42. NULL,
  43. (PFNCLTVECTOR)glTexCoord2fv,
  44. (PFNCLTVECTOR)glTexCoord2dv,
  45. NULL,
  46. NULL,
  47. (PFNCLTVECTOR)glTexCoord3sv,
  48. NULL,
  49. (PFNCLTVECTOR)glTexCoord3iv,
  50. NULL,
  51. (PFNCLTVECTOR)glTexCoord3fv,
  52. (PFNCLTVECTOR)glTexCoord3dv,
  53. NULL,
  54. NULL,
  55. (PFNCLTVECTOR)glTexCoord4sv,
  56. NULL,
  57. (PFNCLTVECTOR)glTexCoord4iv,
  58. NULL,
  59. (PFNCLTVECTOR)glTexCoord4fv,
  60. (PFNCLTVECTOR)glTexCoord4dv,
  61. };
  62. PFNCLTVECTOR ppfnvVertex[32] = {
  63. NULL,
  64. NULL,
  65. NULL,
  66. NULL,
  67. NULL,
  68. NULL,
  69. NULL,
  70. NULL,
  71. NULL,
  72. NULL,
  73. (PFNCLTVECTOR)glVertex2sv,
  74. NULL,
  75. (PFNCLTVECTOR)glVertex2iv,
  76. NULL,
  77. (PFNCLTVECTOR)glVertex2fv,
  78. (PFNCLTVECTOR)glVertex2dv,
  79. NULL,
  80. NULL,
  81. (PFNCLTVECTOR)glVertex3sv,
  82. NULL,
  83. (PFNCLTVECTOR)glVertex3iv,
  84. NULL,
  85. (PFNCLTVECTOR)glVertex3fv,
  86. (PFNCLTVECTOR)glVertex3dv,
  87. NULL,
  88. NULL,
  89. (PFNCLTVECTOR)glVertex4sv,
  90. NULL,
  91. (PFNCLTVECTOR)glVertex4iv,
  92. NULL,
  93. (PFNCLTVECTOR)glVertex4fv,
  94. (PFNCLTVECTOR)glVertex4dv,
  95. };
  96. PFNCLTVECTOR ppfnvIndex[32] = {
  97. NULL,
  98. NULL,
  99. (PFNCLTVECTOR)glIndexsv,
  100. NULL,
  101. (PFNCLTVECTOR)glIndexiv,
  102. NULL,
  103. (PFNCLTVECTOR)glIndexfv,
  104. (PFNCLTVECTOR)glIndexdv,
  105. NULL,
  106. NULL,
  107. NULL,
  108. NULL,
  109. NULL,
  110. NULL,
  111. NULL,
  112. NULL,
  113. NULL,
  114. NULL,
  115. NULL,
  116. NULL,
  117. NULL,
  118. NULL,
  119. NULL,
  120. NULL,
  121. NULL,
  122. NULL,
  123. NULL,
  124. NULL,
  125. NULL,
  126. NULL,
  127. NULL,
  128. NULL,
  129. };
  130. PFNCLTVECTOR ppfnvEdgeFlag[32] = {
  131. NULL,
  132. (PFNCLTVECTOR)glEdgeFlagv,
  133. NULL,
  134. NULL,
  135. NULL,
  136. NULL,
  137. NULL,
  138. NULL,
  139. NULL,
  140. NULL,
  141. NULL,
  142. NULL,
  143. NULL,
  144. NULL,
  145. NULL,
  146. NULL,
  147. NULL,
  148. NULL,
  149. NULL,
  150. NULL,
  151. NULL,
  152. NULL,
  153. NULL,
  154. NULL,
  155. NULL,
  156. NULL,
  157. NULL,
  158. NULL,
  159. NULL,
  160. NULL,
  161. NULL,
  162. NULL,
  163. };
  164. PFNCLTVECTOR ppfnvColor[32] = {
  165. NULL,
  166. NULL,
  167. NULL,
  168. NULL,
  169. NULL,
  170. NULL,
  171. NULL,
  172. NULL,
  173. NULL,
  174. NULL,
  175. NULL,
  176. NULL,
  177. NULL,
  178. NULL,
  179. NULL,
  180. NULL,
  181. (PFNCLTVECTOR)glColor3bv,
  182. (PFNCLTVECTOR)glColor3ubv,
  183. (PFNCLTVECTOR)glColor3sv,
  184. (PFNCLTVECTOR)glColor3usv,
  185. (PFNCLTVECTOR)glColor3iv,
  186. (PFNCLTVECTOR)glColor3uiv,
  187. (PFNCLTVECTOR)glColor3fv,
  188. (PFNCLTVECTOR)glColor3dv,
  189. (PFNCLTVECTOR)glColor4bv,
  190. (PFNCLTVECTOR)glColor4ubv,
  191. (PFNCLTVECTOR)glColor4sv,
  192. (PFNCLTVECTOR)glColor4usv,
  193. (PFNCLTVECTOR)glColor4iv,
  194. (PFNCLTVECTOR)glColor4uiv,
  195. (PFNCLTVECTOR)glColor4fv,
  196. (PFNCLTVECTOR)glColor4dv,
  197. };
  198. PFNCLTVECTOR ppfnvNormal[32] = {
  199. NULL,
  200. NULL,
  201. NULL,
  202. NULL,
  203. NULL,
  204. NULL,
  205. NULL,
  206. NULL,
  207. NULL,
  208. NULL,
  209. NULL,
  210. NULL,
  211. NULL,
  212. NULL,
  213. NULL,
  214. NULL,
  215. (PFNCLTVECTOR)glNormal3bv,
  216. NULL,
  217. (PFNCLTVECTOR)glNormal3sv,
  218. NULL,
  219. (PFNCLTVECTOR)glNormal3iv,
  220. NULL,
  221. (PFNCLTVECTOR)glNormal3fv,
  222. (PFNCLTVECTOR)glNormal3dv,
  223. NULL,
  224. NULL,
  225. NULL,
  226. NULL,
  227. NULL,
  228. NULL,
  229. NULL,
  230. NULL,
  231. };
  232. /****************************************************************************/
  233. static void cltSetupArrayPointer(
  234. PCLTARRAYPOINTER pap,
  235. PFNCLTVECTOR* ppfnVector)
  236. {
  237. GLint itype;
  238. switch (pap->type) {
  239. case GL_BYTE: itype = 0; break;
  240. case GL_UNSIGNED_BYTE: itype = 1; break;
  241. case GL_SHORT: itype = 2; break;
  242. case GL_UNSIGNED_SHORT: itype = 3; break;
  243. case GL_INT: itype = 4; break;
  244. case GL_UNSIGNED_INT: itype = 5; break;
  245. case GL_FLOAT: itype = 6; break;
  246. case GL_DOUBLE_EXT: itype = 7; break;
  247. }
  248. if (pap->stride != 0) {
  249. pap->ibytes = pap->stride;
  250. } else {
  251. pap->ibytes = __GLTYPESIZE(pap->type) * pap->size;
  252. }
  253. pap->pfn = ppfnVector[itype + (pap->size - 1) * 8];
  254. }
  255. /****************************************************************************/
  256. void APIENTRY glsimVertexPointerEXT(
  257. GLint size,
  258. GLenum type,
  259. GLsizei stride,
  260. GLsizei count,
  261. const GLvoid* pointer)
  262. {
  263. PLRC plrc = GLTEB_CLTCURRENTRC();
  264. if (plrc == NULL) {
  265. WARNING_NOOP("GL Noop:glVertexPointerEXT\n");
  266. return;
  267. }
  268. if (size < 2 || size > 4 || stride < 0 || count < 0) {
  269. GLSETERROR(GL_INVALID_VALUE);
  270. return;
  271. }
  272. switch (type) {
  273. case GL_SHORT: break;
  274. case GL_INT: break;
  275. case GL_FLOAT: break;
  276. case GL_DOUBLE_EXT: break;
  277. default:
  278. GLSETERROR(GL_INVALID_ENUM);
  279. return;
  280. }
  281. plrc->apVertex.size = size ;
  282. plrc->apVertex.type = type ;
  283. plrc->apVertex.stride = stride ;
  284. plrc->apVertex.count = count ;
  285. plrc->apVertex.pointer = (GLbyte*)pointer;
  286. cltSetupArrayPointer(&(plrc->apVertex), ppfnvVertex);
  287. }
  288. void APIENTRY glsimColorPointerEXT(
  289. GLint size,
  290. GLenum type,
  291. GLsizei stride,
  292. GLsizei count,
  293. const GLvoid* pointer)
  294. {
  295. PLRC plrc = GLTEB_CLTCURRENTRC();
  296. if (plrc == NULL) {
  297. WARNING_NOOP("GL Noop:glColorPointerEXT\n");
  298. return;
  299. }
  300. if (size < 3 || size > 4 || stride < 0 || count < 0) {
  301. GLSETERROR(GL_INVALID_VALUE);
  302. return;
  303. }
  304. switch (type) {
  305. case GL_BYTE: break;
  306. case GL_UNSIGNED_BYTE: break;
  307. case GL_SHORT: break;
  308. case GL_UNSIGNED_SHORT: break;
  309. case GL_INT: break;
  310. case GL_UNSIGNED_INT: break;
  311. case GL_FLOAT: break;
  312. case GL_DOUBLE_EXT: break;
  313. default:
  314. GLSETERROR(GL_INVALID_ENUM);
  315. return;
  316. }
  317. plrc->apColor.size = size ;
  318. plrc->apColor.type = type ;
  319. plrc->apColor.stride = stride ;
  320. plrc->apColor.count = count ;
  321. plrc->apColor.pointer = (GLbyte*)pointer;
  322. cltSetupArrayPointer(&(plrc->apColor), ppfnvColor);
  323. }
  324. void APIENTRY glsimTexCoordPointerEXT(
  325. GLint size,
  326. GLenum type,
  327. GLsizei stride,
  328. GLsizei count,
  329. const GLvoid* pointer)
  330. {
  331. PLRC plrc = GLTEB_CLTCURRENTRC();
  332. if (plrc == NULL) {
  333. WARNING_NOOP("GL Noop:glTexCoordPointerEXT\n");
  334. return;
  335. }
  336. if (size < 1 || size > 4 || stride < 0 || count < 0) {
  337. GLSETERROR(GL_INVALID_VALUE);
  338. return;
  339. }
  340. switch (type) {
  341. case GL_SHORT: break;
  342. case GL_INT: break;
  343. case GL_FLOAT: break;
  344. case GL_DOUBLE_EXT: break;
  345. default:
  346. GLSETERROR(GL_INVALID_ENUM);
  347. return;
  348. }
  349. plrc->apTexCoord.size = size ;
  350. plrc->apTexCoord.type = type ;
  351. plrc->apTexCoord.stride = stride ;
  352. plrc->apTexCoord.count = count ;
  353. plrc->apTexCoord.pointer = (GLbyte*)pointer;
  354. cltSetupArrayPointer(&(plrc->apTexCoord), ppfnvTexCoord);
  355. }
  356. void APIENTRY glsimNormalPointerEXT(
  357. GLenum type,
  358. GLsizei stride,
  359. GLsizei count,
  360. const GLvoid* pointer)
  361. {
  362. PLRC plrc = GLTEB_CLTCURRENTRC();
  363. if (plrc == NULL) {
  364. WARNING_NOOP("GL Noop:glNormalPointerEXT\n");
  365. return;
  366. }
  367. if (stride < 0 || count < 0) {
  368. GLSETERROR(GL_INVALID_VALUE);
  369. return;
  370. }
  371. switch (type) {
  372. case GL_BYTE: break;
  373. case GL_SHORT: break;
  374. case GL_INT: break;
  375. case GL_FLOAT: break;
  376. case GL_DOUBLE_EXT: break;
  377. default:
  378. GLSETERROR(GL_INVALID_ENUM);
  379. return;
  380. }
  381. plrc->apNormal.size = 3 ;
  382. plrc->apNormal.type = type ;
  383. plrc->apNormal.stride = stride ;
  384. plrc->apNormal.count = count ;
  385. plrc->apNormal.pointer = (GLbyte*)pointer;
  386. cltSetupArrayPointer(&(plrc->apNormal), ppfnvNormal);
  387. }
  388. void APIENTRY glsimIndexPointerEXT(
  389. GLenum type,
  390. GLsizei stride,
  391. GLsizei count,
  392. const GLvoid* pointer)
  393. {
  394. PLRC plrc = GLTEB_CLTCURRENTRC();
  395. if (plrc == NULL) {
  396. WARNING_NOOP("GL Noop:glIndexPointerEXT\n");
  397. return;
  398. }
  399. if (stride < 0 || count < 0) {
  400. GLSETERROR(GL_INVALID_VALUE);
  401. return;
  402. }
  403. switch (type) {
  404. case GL_SHORT: break;
  405. case GL_INT: break;
  406. case GL_FLOAT: break;
  407. case GL_DOUBLE_EXT: break;
  408. default:
  409. GLSETERROR(GL_INVALID_ENUM);
  410. return;
  411. }
  412. plrc->apIndex.size = 1 ;
  413. plrc->apIndex.type = type ;
  414. plrc->apIndex.stride = stride ;
  415. plrc->apIndex.count = count ;
  416. plrc->apIndex.pointer = (GLbyte*)pointer;
  417. cltSetupArrayPointer(&(plrc->apIndex), ppfnvIndex);
  418. }
  419. void APIENTRY glsimEdgeFlagPointerEXT(
  420. GLsizei stride,
  421. GLsizei count,
  422. const GLboolean* pointer)
  423. {
  424. PLRC plrc = GLTEB_CLTCURRENTRC();
  425. if (plrc == NULL) {
  426. WARNING_NOOP("GL Noop:glEdgeFlagPointerEXT\n");
  427. return;
  428. }
  429. if (stride < 0 || count < 0) {
  430. GLSETERROR(GL_INVALID_VALUE);
  431. return;
  432. }
  433. plrc->apEdgeFlag.size = 1;
  434. plrc->apEdgeFlag.type = GL_UNSIGNED_BYTE;
  435. plrc->apEdgeFlag.stride = stride ;
  436. plrc->apEdgeFlag.count = count ;
  437. plrc->apEdgeFlag.pointer = (GLbyte*)pointer;
  438. cltSetupArrayPointer(&(plrc->apEdgeFlag), ppfnvEdgeFlag);
  439. }
  440. /****************************************************************************/
  441. #define CALLARRAYPOINTER(ap) \
  442. if ((ap).fEnabled) \
  443. (((ap).pfn)((ap).pointer + i * (ap).ibytes))
  444. void APIENTRY glsimArrayElementEXT(
  445. GLint i)
  446. {
  447. PLRC plrc = GLTEB_CLTCURRENTRC();
  448. if (plrc == NULL) {
  449. WARNING_NOOP("GL Noop:glArrayElementEXT\n");
  450. return;
  451. }
  452. CALLARRAYPOINTER(plrc->apNormal);
  453. CALLARRAYPOINTER(plrc->apColor);
  454. CALLARRAYPOINTER(plrc->apIndex);
  455. CALLARRAYPOINTER(plrc->apTexCoord);
  456. CALLARRAYPOINTER(plrc->apEdgeFlag);
  457. CALLARRAYPOINTER(plrc->apVertex);
  458. }
  459. /****************************************************************************/
  460. void APIENTRY glsimArrayElementArrayEXT(
  461. GLenum mode,
  462. GLsizei count,
  463. const GLvoid* pi)
  464. {
  465. int i;
  466. switch(mode) {
  467. case GL_POINTS:
  468. case GL_LINE_STRIP:
  469. case GL_LINE_LOOP:
  470. case GL_LINES:
  471. case GL_TRIANGLE_STRIP:
  472. case GL_TRIANGLE_FAN:
  473. case GL_TRIANGLES:
  474. case GL_QUAD_STRIP:
  475. case GL_QUADS:
  476. case GL_POLYGON:
  477. break;
  478. default:
  479. GLSETERROR(GL_INVALID_ENUM);
  480. return;
  481. }
  482. if (count < 0) {
  483. GLSETERROR(GL_INVALID_VALUE);
  484. return;
  485. }
  486. glBegin(mode);
  487. for (i = 0; i < count; i++) {
  488. glsimArrayElementEXT(((GLint *)pi)[i]);
  489. }
  490. glEnd();
  491. }
  492. /****************************************************************************/
  493. void APIENTRY glsimDrawArraysEXT(
  494. GLenum mode,
  495. GLint first,
  496. GLsizei count)
  497. {
  498. int i;
  499. PLRC plrc = GLTEB_CLTCURRENTRC();
  500. if (plrc == NULL) {
  501. WARNING_NOOP("GL Noop:glDrawArrayEXT\n");
  502. return;
  503. }
  504. switch(mode) {
  505. case GL_POINTS:
  506. case GL_LINE_STRIP:
  507. case GL_LINE_LOOP:
  508. case GL_LINES:
  509. case GL_TRIANGLE_STRIP:
  510. case GL_TRIANGLE_FAN:
  511. case GL_TRIANGLES:
  512. case GL_QUAD_STRIP:
  513. case GL_QUADS:
  514. case GL_POLYGON:
  515. break;
  516. default:
  517. GLSETERROR(GL_INVALID_ENUM);
  518. return;
  519. }
  520. if (count < 0) {
  521. GLSETERROR(GL_INVALID_VALUE);
  522. return;
  523. }
  524. glBegin(mode);
  525. for (i = 0; i < count; i++) {
  526. glsimArrayElementEXT(first + i);
  527. }
  528. glEnd();
  529. }
  530. /****************************************************************************/
  531. void APIENTRY glsimGetPointervEXT(
  532. GLenum pname,
  533. void** params)
  534. {
  535. PLRC plrc = GLTEB_CLTCURRENTRC();
  536. if (plrc == NULL) {
  537. WARNING_NOOP("GL Noop:glGetPointerEXT\n");
  538. return;
  539. }
  540. switch (pname) {
  541. case GL_VERTEX_ARRAY_POINTER_EXT: *params = plrc->apVertex.pointer ; return;
  542. case GL_NORMAL_ARRAY_POINTER_EXT: *params = plrc->apNormal.pointer ; return;
  543. case GL_COLOR_ARRAY_POINTER_EXT: *params = plrc->apColor.pointer ; return;
  544. case GL_INDEX_ARRAY_POINTER_EXT: *params = plrc->apIndex.pointer ; return;
  545. case GL_TEXTURE_COORD_ARRAY_POINTER_EXT: *params = plrc->apTexCoord.pointer; return;
  546. case GL_EDGE_FLAG_ARRAY_POINTER_EXT: *params = plrc->apEdgeFlag.pointer; return;
  547. default:
  548. GLSETERROR(GL_INVALID_ENUM);
  549. return;
  550. }
  551. }
  552. /****************************************************************************/
  553. GLubyte* EXTENSIONSTRING = "GL_EXT_vertex_array";
  554. const GLubyte * APIENTRY VArrayGetString( IN GLenum name )
  555. {
  556. PLRC plrc = GLTEB_CLTCURRENTRC();
  557. GLubyte *psz;
  558. if (plrc == NULL) {
  559. WARNING_NOOP("GL Noop:glGetString\n");
  560. return 0;
  561. }
  562. psz = (GLubyte*)plrc->pfnGetString(name);
  563. if (name == GL_EXTENSIONS) {
  564. // The vertex array extension string is already in the generic GetString.
  565. if (!plrc->dhrc)
  566. return psz;
  567. if (psz == NULL) {
  568. return EXTENSIONSTRING;
  569. }
  570. if (plrc->pszExtensions == NULL) {
  571. plrc->pszExtensions = (GLubyte*)LOCALALLOC(LPTR, strlen(psz) + strlen(EXTENSIONSTRING) + 2);
  572. sprintf(plrc->pszExtensions, "%s %s", EXTENSIONSTRING, psz);
  573. }
  574. return plrc->pszExtensions;
  575. }
  576. return psz;
  577. }
  578. /****************************************************************************/
  579. void APIENTRY VArrayEnable(
  580. IN GLenum cap)
  581. {
  582. PLRC plrc = GLTEB_CLTCURRENTRC();
  583. if (plrc == NULL) {
  584. WARNING_NOOP("GL Noop:glEnable\n");
  585. return;
  586. }
  587. switch (cap) {
  588. case GL_NORMAL_ARRAY_EXT: plrc->apNormal.fEnabled = TRUE; return;
  589. case GL_COLOR_ARRAY_EXT: plrc->apColor.fEnabled = TRUE; return;
  590. case GL_INDEX_ARRAY_EXT: plrc->apIndex.fEnabled = TRUE; return;
  591. case GL_TEXTURE_COORD_ARRAY_EXT: plrc->apTexCoord.fEnabled = TRUE; return;
  592. case GL_EDGE_FLAG_ARRAY_EXT: plrc->apEdgeFlag.fEnabled = TRUE; return;
  593. case GL_VERTEX_ARRAY_EXT: plrc->apVertex.fEnabled = TRUE; return;
  594. }
  595. plrc->pfnEnable(cap);
  596. }
  597. /****************************************************************************/
  598. void APIENTRY VArrayDisable(
  599. IN GLenum cap)
  600. {
  601. PLRC plrc = GLTEB_CLTCURRENTRC();
  602. if (plrc == NULL) {
  603. WARNING_NOOP("GL Noop:glDisable\n");
  604. return;
  605. }
  606. switch (cap) {
  607. case GL_NORMAL_ARRAY_EXT: plrc->apNormal.fEnabled = FALSE; return;
  608. case GL_COLOR_ARRAY_EXT: plrc->apColor.fEnabled = FALSE; return;
  609. case GL_INDEX_ARRAY_EXT: plrc->apIndex.fEnabled = FALSE; return;
  610. case GL_TEXTURE_COORD_ARRAY_EXT: plrc->apTexCoord.fEnabled = FALSE; return;
  611. case GL_EDGE_FLAG_ARRAY_EXT: plrc->apEdgeFlag.fEnabled = FALSE; return;
  612. case GL_VERTEX_ARRAY_EXT: plrc->apVertex.fEnabled = FALSE; return;
  613. }
  614. plrc->pfnDisable(cap);
  615. }
  616. /****************************************************************************/
  617. GLboolean APIENTRY VArrayIsEnabled(
  618. IN GLenum cap)
  619. {
  620. PLRC plrc = GLTEB_CLTCURRENTRC();
  621. if (plrc == NULL) {
  622. WARNING_NOOP("GL Noop:glIsEnabled\n");
  623. return 0;
  624. }
  625. switch (cap) {
  626. case GL_NORMAL_ARRAY_EXT: return plrc->apNormal.fEnabled;
  627. case GL_COLOR_ARRAY_EXT: return plrc->apColor.fEnabled;
  628. case GL_INDEX_ARRAY_EXT: return plrc->apIndex.fEnabled;
  629. case GL_TEXTURE_COORD_ARRAY_EXT: return plrc->apTexCoord.fEnabled;
  630. case GL_EDGE_FLAG_ARRAY_EXT: return plrc->apEdgeFlag.fEnabled;
  631. case GL_VERTEX_ARRAY_EXT: return plrc->apVertex.fEnabled;
  632. }
  633. return plrc->pfnIsEnabled(cap);
  634. }
  635. /****************************************************************************/
  636. BOOL VArrayGetIntegerInternal(
  637. PLRC plrc,
  638. GLenum cap,
  639. GLint *pi)
  640. {
  641. switch (cap) {
  642. case GL_NORMAL_ARRAY_EXT: *pi = plrc->apNormal.fEnabled; return TRUE;
  643. case GL_COLOR_ARRAY_EXT: *pi = plrc->apColor.fEnabled; return TRUE;
  644. case GL_INDEX_ARRAY_EXT: *pi = plrc->apIndex.fEnabled; return TRUE;
  645. case GL_TEXTURE_COORD_ARRAY_EXT: *pi = plrc->apTexCoord.fEnabled; return TRUE;
  646. case GL_EDGE_FLAG_ARRAY_EXT: *pi = plrc->apEdgeFlag.fEnabled; return TRUE;
  647. case GL_VERTEX_ARRAY_EXT: *pi = plrc->apVertex.fEnabled; return TRUE;
  648. case GL_VERTEX_ARRAY_SIZE_EXT: *pi = plrc->apVertex.size ; return TRUE;
  649. case GL_VERTEX_ARRAY_TYPE_EXT: *pi = plrc->apVertex.type ; return TRUE;
  650. case GL_VERTEX_ARRAY_STRIDE_EXT: *pi = plrc->apVertex.stride; return TRUE;
  651. case GL_VERTEX_ARRAY_COUNT_EXT: *pi = plrc->apVertex.count ; return TRUE;
  652. case GL_NORMAL_ARRAY_TYPE_EXT: *pi = plrc->apNormal.type ; return TRUE;
  653. case GL_NORMAL_ARRAY_STRIDE_EXT: *pi = plrc->apNormal.stride; return TRUE;
  654. case GL_NORMAL_ARRAY_COUNT_EXT: *pi = plrc->apNormal.count ; return TRUE;
  655. case GL_COLOR_ARRAY_SIZE_EXT: *pi = plrc->apColor.size ; return TRUE;
  656. case GL_COLOR_ARRAY_TYPE_EXT: *pi = plrc->apColor.type ; return TRUE;
  657. case GL_COLOR_ARRAY_STRIDE_EXT: *pi = plrc->apColor.stride; return TRUE;
  658. case GL_COLOR_ARRAY_COUNT_EXT: *pi = plrc->apColor.count ; return TRUE;
  659. case GL_INDEX_ARRAY_TYPE_EXT: *pi = plrc->apIndex.type ; return TRUE;
  660. case GL_INDEX_ARRAY_STRIDE_EXT: *pi = plrc->apIndex.stride; return TRUE;
  661. case GL_INDEX_ARRAY_COUNT_EXT: *pi = plrc->apIndex.count ; return TRUE;
  662. case GL_TEXTURE_COORD_ARRAY_SIZE_EXT: *pi = plrc->apTexCoord.size ; return TRUE;
  663. case GL_TEXTURE_COORD_ARRAY_TYPE_EXT: *pi = plrc->apTexCoord.type ; return TRUE;
  664. case GL_TEXTURE_COORD_ARRAY_STRIDE_EXT: *pi = plrc->apTexCoord.stride; return TRUE;
  665. case GL_TEXTURE_COORD_ARRAY_COUNT_EXT: *pi = plrc->apTexCoord.count ; return TRUE;
  666. case GL_EDGE_FLAG_ARRAY_STRIDE_EXT: *pi = plrc->apEdgeFlag.stride; return TRUE;
  667. case GL_EDGE_FLAG_ARRAY_COUNT_EXT: *pi = plrc->apEdgeFlag.count ; return TRUE;
  668. }
  669. return FALSE;
  670. }
  671. /****************************************************************************/
  672. void APIENTRY VArrayGetBooleanv(
  673. IN GLenum pname,
  674. OUT GLboolean params[])
  675. {
  676. PLRC plrc = GLTEB_CLTCURRENTRC();
  677. GLint glint;
  678. if (plrc == NULL) {
  679. WARNING_NOOP("GL Noop:glGetBooleanv\n");
  680. return;
  681. }
  682. if (VArrayGetIntegerInternal(plrc, pname, &glint)) {
  683. params[0] = glint ? 1 : 0;
  684. return;
  685. }
  686. plrc->pfnGetBooleanv(pname, params);
  687. }
  688. /****************************************************************************/
  689. void APIENTRY VArrayGetDoublev(
  690. IN GLenum pname,
  691. OUT GLdouble params[])
  692. {
  693. PLRC plrc = GLTEB_CLTCURRENTRC();
  694. GLint glint;
  695. if (plrc == NULL) {
  696. WARNING_NOOP("GL Noop:glGetDoublev\n");
  697. return;
  698. }
  699. if (VArrayGetIntegerInternal(plrc, pname, &glint)) {
  700. params[0] = (GLdouble)glint;
  701. return;
  702. }
  703. plrc->pfnGetDoublev(pname, params);
  704. }
  705. /****************************************************************************/
  706. void APIENTRY VArrayGetFloatv(
  707. IN GLenum pname,
  708. OUT GLfloat params[])
  709. {
  710. PLRC plrc = GLTEB_CLTCURRENTRC();
  711. GLint glint;
  712. if (plrc == NULL) {
  713. WARNING_NOOP("GL Noop:glGetFloatv\n");
  714. return;
  715. }
  716. if (VArrayGetIntegerInternal(plrc, pname, &glint)) {
  717. params[0] = (GLfloat)glint;
  718. return;
  719. }
  720. plrc->pfnGetFloatv(pname, params);
  721. }
  722. /****************************************************************************/
  723. void APIENTRY VArrayGetIntegerv(
  724. IN GLenum pname,
  725. OUT GLint params[])
  726. {
  727. PLRC plrc = GLTEB_CLTCURRENTRC();
  728. GLint glint;
  729. if (plrc == NULL) {
  730. WARNING_NOOP("GL Noop:glGetIntegerv\n");
  731. return;
  732. }
  733. if (VArrayGetIntegerInternal(plrc, pname, &glint)) {
  734. params[0] = glint;
  735. return;
  736. }
  737. plrc->pfnGetIntegerv(pname, params);
  738. }