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.

2361 lines
59 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: glcltgsh.c
  3. *
  4. * OpenGL client side generic functions.
  5. *
  6. * Created: 11-7-1993
  7. * Author: Hock San Lee [hockl]
  8. *
  9. * 08-Nov-1993 Added functions Pixel, Evaluators, GetString,
  10. * Feedback and Selection functions
  11. * Pierre Tardif, ptar@sgi.com
  12. *
  13. * Copyright (c) 1993 Microsoft Corporation
  14. \**************************************************************************/
  15. /* Generic OpenGL Client using subbatching. Hand coded functions */
  16. #include "precomp.h"
  17. #pragma hdrstop
  18. #include "types.h"
  19. #include "glsbmsg.h"
  20. #include "glsbmsgh.h"
  21. #include "glsrvspt.h"
  22. #include "subbatch.h"
  23. #include "batchinf.h"
  24. #include "glsbcltu.h"
  25. #include "glclt.h"
  26. #include "compsize.h"
  27. #include "glsize.h"
  28. #include "context.h"
  29. #include "global.h"
  30. #include "lighting.h"
  31. void APIENTRY
  32. glcltFogf ( IN GLenum pname, IN GLfloat param )
  33. {
  34. // FOG_ASSERT
  35. if (!RANGE(pname,GL_FOG_INDEX,GL_FOG_MODE))
  36. {
  37. GLSETERROR(GL_INVALID_ENUM);
  38. return;
  39. }
  40. glcltFogfv(pname, &param);
  41. }
  42. void APIENTRY
  43. glcltFogfv ( IN GLenum pname, IN const GLfloat params[] )
  44. {
  45. // FOG_ASSERT
  46. if (!RANGE(pname,GL_FOG_INDEX,GL_FOG_COLOR))
  47. {
  48. GLSETERROR(GL_INVALID_ENUM);
  49. return;
  50. }
  51. GLCLIENT_BEGIN( Fogfv, FOGFV )
  52. pMsg->pname = pname;
  53. pMsg->params[0] = params[0];
  54. if (pname == GL_FOG_COLOR)
  55. {
  56. pMsg->params[1] = params[1];
  57. pMsg->params[2] = params[2];
  58. pMsg->params[3] = params[3];
  59. }
  60. GLCLIENT_END
  61. return;
  62. }
  63. void APIENTRY
  64. glcltFogi ( IN GLenum pname, IN GLint param )
  65. {
  66. GLfloat fParam;
  67. // FOG_ASSERT
  68. if (!RANGE(pname,GL_FOG_INDEX,GL_FOG_MODE))
  69. {
  70. GLSETERROR(GL_INVALID_ENUM);
  71. return;
  72. }
  73. fParam = (GLfloat) param;
  74. glcltFogfv(pname, &fParam);
  75. }
  76. void APIENTRY
  77. glcltFogiv ( IN GLenum pname, IN const GLint params[] )
  78. {
  79. GLfloat fParams[4];
  80. switch (pname)
  81. {
  82. case GL_FOG_INDEX:
  83. case GL_FOG_DENSITY:
  84. case GL_FOG_START:
  85. case GL_FOG_END:
  86. case GL_FOG_MODE:
  87. fParams[0] = (GLfloat) params[0];
  88. break;
  89. case GL_FOG_COLOR:
  90. fParams[0] = __GL_I_TO_FLOAT(params[0]);
  91. fParams[1] = __GL_I_TO_FLOAT(params[1]);
  92. fParams[2] = __GL_I_TO_FLOAT(params[2]);
  93. fParams[3] = __GL_I_TO_FLOAT(params[3]);
  94. break;
  95. }
  96. glcltFogfv(pname, fParams);
  97. }
  98. void APIENTRY
  99. glcltLightf ( IN GLenum light, IN GLenum pname, IN GLfloat param )
  100. {
  101. // LIGHT_SOURCE_ASSERT
  102. if (!RANGE(pname,GL_SPOT_EXPONENT,GL_QUADRATIC_ATTENUATION))
  103. {
  104. GLSETERROR(GL_INVALID_ENUM);
  105. return;
  106. }
  107. glcltLightfv(light, pname, &param);
  108. }
  109. void APIENTRY
  110. glcltLightfv ( IN GLenum light, IN GLenum pname, IN const GLfloat params[] )
  111. {
  112. // LIGHT_SOURCE_ASSERT
  113. if (!RANGE(pname,GL_AMBIENT,GL_QUADRATIC_ATTENUATION))
  114. {
  115. GLSETERROR(GL_INVALID_ENUM);
  116. return;
  117. }
  118. GLCLIENT_BEGIN( Lightfv, LIGHTFV )
  119. pMsg->light = light;
  120. pMsg->pname = pname;
  121. switch (pname)
  122. {
  123. case GL_AMBIENT:
  124. case GL_DIFFUSE:
  125. case GL_SPECULAR:
  126. case GL_POSITION:
  127. pMsg->params[3] = params[3];
  128. case GL_SPOT_DIRECTION:
  129. pMsg->params[2] = params[2];
  130. pMsg->params[1] = params[1];
  131. default:
  132. pMsg->params[0] = params[0];
  133. }
  134. GLCLIENT_END
  135. return;
  136. }
  137. void APIENTRY
  138. glcltLighti ( IN GLenum light, IN GLenum pname, IN GLint param )
  139. {
  140. GLfloat fParam;
  141. // LIGHT_SOURCE_ASSERT
  142. if (!RANGE(pname,GL_SPOT_EXPONENT,GL_QUADRATIC_ATTENUATION))
  143. {
  144. GLSETERROR(GL_INVALID_ENUM);
  145. return;
  146. }
  147. fParam = (GLfloat) param;
  148. glcltLightfv(light, pname, &fParam);
  149. }
  150. void APIENTRY
  151. glcltLightiv ( IN GLenum light, IN GLenum pname, IN const GLint params[] )
  152. {
  153. GLfloat fParams[4];
  154. switch (pname)
  155. {
  156. case GL_AMBIENT:
  157. case GL_DIFFUSE:
  158. case GL_SPECULAR:
  159. fParams[0] = __GL_I_TO_FLOAT(params[0]);
  160. fParams[1] = __GL_I_TO_FLOAT(params[1]);
  161. fParams[2] = __GL_I_TO_FLOAT(params[2]);
  162. fParams[3] = __GL_I_TO_FLOAT(params[3]);
  163. break;
  164. case GL_POSITION:
  165. fParams[3] = (GLfloat) params[3];
  166. case GL_SPOT_DIRECTION:
  167. fParams[2] = (GLfloat) params[2];
  168. fParams[1] = (GLfloat) params[1];
  169. case GL_SPOT_EXPONENT:
  170. case GL_SPOT_CUTOFF:
  171. case GL_CONSTANT_ATTENUATION:
  172. case GL_LINEAR_ATTENUATION:
  173. case GL_QUADRATIC_ATTENUATION:
  174. fParams[0] = (GLfloat) params[0];
  175. break;
  176. }
  177. glcltLightfv(light, pname, fParams);
  178. }
  179. void APIENTRY
  180. glcltLightModelf ( IN GLenum pname, IN GLfloat param )
  181. {
  182. // LIGHT_MODEL_ASSERT
  183. if (!RANGE(pname,GL_LIGHT_MODEL_LOCAL_VIEWER,GL_LIGHT_MODEL_TWO_SIDE))
  184. {
  185. GLSETERROR(GL_INVALID_ENUM);
  186. return;
  187. }
  188. glcltLightModelfv(pname, &param);
  189. }
  190. void APIENTRY
  191. glcltLightModelfv ( IN GLenum pname, IN const GLfloat params[] )
  192. {
  193. // LIGHT_MODEL_ASSERT
  194. if (!RANGE(pname,GL_LIGHT_MODEL_LOCAL_VIEWER,GL_LIGHT_MODEL_AMBIENT))
  195. {
  196. GLSETERROR(GL_INVALID_ENUM);
  197. return;
  198. }
  199. GLCLIENT_BEGIN( LightModelfv, LIGHTMODELFV )
  200. pMsg->pname = pname;
  201. pMsg->params[0] = params[0];
  202. if (pname == GL_LIGHT_MODEL_AMBIENT)
  203. {
  204. pMsg->params[1] = params[1];
  205. pMsg->params[2] = params[2];
  206. pMsg->params[3] = params[3];
  207. }
  208. GLCLIENT_END
  209. return;
  210. }
  211. void APIENTRY
  212. glcltLightModeli ( IN GLenum pname, IN GLint param )
  213. {
  214. GLfloat fParam;
  215. // LIGHT_MODEL_ASSERT
  216. if (!RANGE(pname,GL_LIGHT_MODEL_LOCAL_VIEWER,GL_LIGHT_MODEL_TWO_SIDE))
  217. {
  218. GLSETERROR(GL_INVALID_ENUM);
  219. return;
  220. }
  221. fParam = (GLfloat) param;
  222. glcltLightModelfv(pname, &fParam);
  223. }
  224. void APIENTRY
  225. glcltLightModeliv ( IN GLenum pname, IN const GLint params[] )
  226. {
  227. GLfloat fParams[4];
  228. switch (pname)
  229. {
  230. case GL_LIGHT_MODEL_AMBIENT:
  231. fParams[0] = __GL_I_TO_FLOAT(params[0]);
  232. fParams[1] = __GL_I_TO_FLOAT(params[1]);
  233. fParams[2] = __GL_I_TO_FLOAT(params[2]);
  234. fParams[3] = __GL_I_TO_FLOAT(params[3]);
  235. break;
  236. case GL_LIGHT_MODEL_LOCAL_VIEWER:
  237. case GL_LIGHT_MODEL_TWO_SIDE:
  238. fParams[0] = (GLfloat) params[0];
  239. break;
  240. }
  241. glcltLightModelfv(pname, fParams);
  242. }
  243. void APIENTRY
  244. glcltTexParameterf ( IN GLenum target, IN GLenum pname, IN GLfloat param )
  245. {
  246. // TEX_PARAMETER_ASSERT
  247. if (!RANGE(pname,GL_TEXTURE_MAG_FILTER,GL_TEXTURE_WRAP_T) &&
  248. pname != GL_TEXTURE_PRIORITY)
  249. {
  250. GLSETERROR(GL_INVALID_ENUM);
  251. return;
  252. }
  253. glcltTexParameterfv(target, pname, &param);
  254. }
  255. void APIENTRY
  256. glcltTexParameterfv ( IN GLenum target, IN GLenum pname, IN const GLfloat params[] )
  257. {
  258. switch (pname) {
  259. case GL_TEXTURE_WRAP_S:
  260. case GL_TEXTURE_WRAP_T:
  261. case GL_TEXTURE_MIN_FILTER:
  262. case GL_TEXTURE_MAG_FILTER:
  263. case GL_TEXTURE_BORDER_COLOR:
  264. case GL_TEXTURE_PRIORITY:
  265. break;
  266. default:
  267. GLSETERROR(GL_INVALID_ENUM);
  268. return;
  269. }
  270. GLCLIENT_BEGIN( TexParameterfv, TEXPARAMETERFV )
  271. pMsg->target = target;
  272. pMsg->pname = pname;
  273. pMsg->params[0] = params[0];
  274. if (pname == GL_TEXTURE_BORDER_COLOR)
  275. {
  276. pMsg->params[1] = params[1];
  277. pMsg->params[2] = params[2];
  278. pMsg->params[3] = params[3];
  279. }
  280. GLCLIENT_END
  281. return;
  282. }
  283. void APIENTRY
  284. glcltTexParameteri ( IN GLenum target, IN GLenum pname, IN GLint param )
  285. {
  286. // TEX_PARAMETER_ASSERT
  287. if (!RANGE(pname,GL_TEXTURE_MAG_FILTER,GL_TEXTURE_WRAP_T) &&
  288. pname != GL_TEXTURE_PRIORITY)
  289. {
  290. GLSETERROR(GL_INVALID_ENUM);
  291. return;
  292. }
  293. glcltTexParameteriv(target, pname, &param);
  294. }
  295. void APIENTRY
  296. glcltTexParameteriv ( IN GLenum target, IN GLenum pname, IN const GLint params[] )
  297. {
  298. switch (pname) {
  299. case GL_TEXTURE_WRAP_S:
  300. case GL_TEXTURE_WRAP_T:
  301. case GL_TEXTURE_MIN_FILTER:
  302. case GL_TEXTURE_MAG_FILTER:
  303. case GL_TEXTURE_BORDER_COLOR:
  304. case GL_TEXTURE_PRIORITY:
  305. break;
  306. default:
  307. GLSETERROR(GL_INVALID_ENUM);
  308. return;
  309. }
  310. GLCLIENT_BEGIN( TexParameteriv, TEXPARAMETERIV )
  311. pMsg->target = target;
  312. pMsg->pname = pname;
  313. pMsg->params[0] = params[0];
  314. if (pname == GL_TEXTURE_BORDER_COLOR)
  315. {
  316. pMsg->params[1] = params[1];
  317. pMsg->params[2] = params[2];
  318. pMsg->params[3] = params[3];
  319. }
  320. GLCLIENT_END
  321. return;
  322. }
  323. void APIENTRY
  324. glcltTexEnvf ( IN GLenum target, IN GLenum pname, IN GLfloat param )
  325. {
  326. if (pname != GL_TEXTURE_ENV_MODE)
  327. {
  328. GLSETERROR(GL_INVALID_ENUM);
  329. return;
  330. }
  331. glcltTexEnvfv(target, pname, &param);
  332. }
  333. void APIENTRY
  334. glcltTexEnvfv ( IN GLenum target, IN GLenum pname, IN const GLfloat params[] )
  335. {
  336. if (pname != GL_TEXTURE_ENV_MODE && pname != GL_TEXTURE_ENV_COLOR)
  337. {
  338. GLSETERROR(GL_INVALID_ENUM);
  339. return;
  340. }
  341. GLCLIENT_BEGIN( TexEnvfv, TEXENVFV )
  342. pMsg->target = target;
  343. pMsg->pname = pname;
  344. pMsg->params[0] = params[0];
  345. if (pname == GL_TEXTURE_ENV_COLOR)
  346. {
  347. pMsg->params[1] = params[1];
  348. pMsg->params[2] = params[2];
  349. pMsg->params[3] = params[3];
  350. }
  351. GLCLIENT_END
  352. return;
  353. }
  354. void APIENTRY
  355. glcltTexEnvi ( IN GLenum target, IN GLenum pname, IN GLint param )
  356. {
  357. if (pname != GL_TEXTURE_ENV_MODE)
  358. {
  359. GLSETERROR(GL_INVALID_ENUM);
  360. return;
  361. }
  362. glcltTexEnviv(target, pname, &param);
  363. }
  364. void APIENTRY
  365. glcltTexEnviv ( IN GLenum target, IN GLenum pname, IN const GLint params[] )
  366. {
  367. if (pname != GL_TEXTURE_ENV_MODE && pname != GL_TEXTURE_ENV_COLOR)
  368. {
  369. GLSETERROR(GL_INVALID_ENUM);
  370. return;
  371. }
  372. GLCLIENT_BEGIN( TexEnviv, TEXENVIV )
  373. pMsg->target = target;
  374. pMsg->pname = pname;
  375. pMsg->params[0] = params[0];
  376. if (pname == GL_TEXTURE_ENV_COLOR)
  377. {
  378. pMsg->params[1] = params[1];
  379. pMsg->params[2] = params[2];
  380. pMsg->params[3] = params[3];
  381. }
  382. GLCLIENT_END
  383. return;
  384. }
  385. void APIENTRY
  386. glcltTexGend ( IN GLenum coord, IN GLenum pname, IN GLdouble param )
  387. {
  388. GLfloat fParam;
  389. if (pname != GL_TEXTURE_GEN_MODE)
  390. {
  391. GLSETERROR(GL_INVALID_ENUM);
  392. return;
  393. }
  394. fParam = (GLfloat) param;
  395. glcltTexGenfv(coord, pname, &fParam);
  396. }
  397. void APIENTRY
  398. glcltTexGendv ( IN GLenum coord, IN GLenum pname, IN const GLdouble params[] )
  399. {
  400. GLfloat fParams[4];
  401. switch (pname)
  402. {
  403. case GL_OBJECT_PLANE:
  404. case GL_EYE_PLANE:
  405. fParams[3] = (GLfloat) params[3];
  406. fParams[2] = (GLfloat) params[2];
  407. fParams[1] = (GLfloat) params[1];
  408. // fall through
  409. case GL_TEXTURE_GEN_MODE:
  410. fParams[0] = (GLfloat) params[0];
  411. break;
  412. }
  413. glcltTexGenfv(coord, pname, fParams);
  414. }
  415. void APIENTRY
  416. glcltTexGenf ( IN GLenum coord, IN GLenum pname, IN GLfloat param )
  417. {
  418. if (pname != GL_TEXTURE_GEN_MODE)
  419. {
  420. GLSETERROR(GL_INVALID_ENUM);
  421. return;
  422. }
  423. glcltTexGenfv(coord, pname, &param);
  424. }
  425. void APIENTRY
  426. glcltTexGenfv ( IN GLenum coord, IN GLenum pname, IN const GLfloat params[] )
  427. {
  428. // TEX_GEN_ASSERT
  429. if (!RANGE(pname,GL_TEXTURE_GEN_MODE,GL_EYE_PLANE))
  430. {
  431. GLSETERROR(GL_INVALID_ENUM);
  432. return;
  433. }
  434. GLCLIENT_BEGIN( TexGenfv, TEXGENFV )
  435. pMsg->coord = coord;
  436. pMsg->pname = pname;
  437. pMsg->params[0] = params[0];
  438. if (pname != GL_TEXTURE_GEN_MODE)
  439. {
  440. pMsg->params[1] = params[1];
  441. pMsg->params[2] = params[2];
  442. pMsg->params[3] = params[3];
  443. }
  444. GLCLIENT_END
  445. return;
  446. }
  447. void APIENTRY
  448. glcltTexGeni ( IN GLenum coord, IN GLenum pname, IN GLint param )
  449. {
  450. GLfloat fParam;
  451. if (pname != GL_TEXTURE_GEN_MODE)
  452. {
  453. GLSETERROR(GL_INVALID_ENUM);
  454. return;
  455. }
  456. fParam = (GLfloat) param;
  457. glcltTexGenfv(coord, pname, &fParam);
  458. }
  459. void APIENTRY
  460. glcltTexGeniv ( IN GLenum coord, IN GLenum pname, IN const GLint params[] )
  461. {
  462. GLfloat fParams[4];
  463. switch (pname)
  464. {
  465. case GL_OBJECT_PLANE:
  466. case GL_EYE_PLANE:
  467. fParams[3] = (GLfloat) params[3];
  468. fParams[2] = (GLfloat) params[2];
  469. fParams[1] = (GLfloat) params[1];
  470. // fall through
  471. case GL_TEXTURE_GEN_MODE:
  472. fParams[0] = (GLfloat) params[0];
  473. break;
  474. }
  475. glcltTexGenfv(coord, pname, fParams);
  476. }
  477. void APIENTRY
  478. glcltGetBooleanv ( IN GLenum pname, OUT GLboolean params[] )
  479. {
  480. #ifndef _CLIENTSIDE_
  481. int cArgs;
  482. cArgs = __glGet_size(pname);
  483. if (cArgs == 0)
  484. {
  485. GLSETERROR(GL_INVALID_ENUM);
  486. return;
  487. }
  488. ASSERTOPENGL(cArgs <= 16, "bad get size");
  489. GLCLIENT_BEGIN( GetBooleanv, GETBOOLEANV )
  490. pMsg->pname = pname;
  491. glsbAttention();
  492. while (--cArgs >= 0)
  493. params[cArgs] = pMsg->params[cArgs];
  494. GLCLIENT_END
  495. return;
  496. #else
  497. GLCLIENT_BEGIN( GetBooleanv, GETBOOLEANV )
  498. pMsg->pname = pname;
  499. pMsg->params = params;
  500. glsbAttention();
  501. GLCLIENT_END
  502. return;
  503. #endif
  504. }
  505. void APIENTRY
  506. glcltGetDoublev ( IN GLenum pname, OUT GLdouble params[] )
  507. {
  508. #ifndef _CLIENTSIDE_
  509. int cArgs;
  510. cArgs = __glGet_size(pname);
  511. if (cArgs == 0)
  512. {
  513. GLSETERROR(GL_INVALID_ENUM);
  514. return;
  515. }
  516. ASSERTOPENGL(cArgs <= 16, "bad get size");
  517. GLCLIENT_BEGIN( GetDoublev, GETDOUBLEV )
  518. pMsg->pname = pname;
  519. glsbAttention();
  520. while (--cArgs >= 0)
  521. params[cArgs] = pMsg->params[cArgs];
  522. GLCLIENT_END
  523. return;
  524. #else
  525. GLCLIENT_BEGIN( GetDoublev, GETDOUBLEV )
  526. pMsg->pname = pname;
  527. pMsg->params = params;
  528. glsbAttention();
  529. GLCLIENT_END
  530. return;
  531. #endif
  532. }
  533. void APIENTRY
  534. glcltGetFloatv ( IN GLenum pname, OUT GLfloat params[] )
  535. {
  536. #ifndef _CLIENTSIDE_
  537. int cArgs;
  538. cArgs = __glGet_size(pname);
  539. if (cArgs == 0)
  540. {
  541. GLSETERROR(GL_INVALID_ENUM);
  542. return;
  543. }
  544. ASSERTOPENGL(cArgs <= 16, "bad get size");
  545. GLCLIENT_BEGIN( GetFloatv, GETFLOATV )
  546. pMsg->pname = pname;
  547. glsbAttention();
  548. while (--cArgs >= 0)
  549. params[cArgs] = pMsg->params[cArgs];
  550. GLCLIENT_END
  551. return;
  552. #else
  553. GLCLIENT_BEGIN( GetFloatv, GETFLOATV )
  554. pMsg->pname = pname;
  555. pMsg->params = params;
  556. glsbAttention();
  557. GLCLIENT_END
  558. return;
  559. #endif
  560. }
  561. void APIENTRY
  562. glcltGetIntegerv ( IN GLenum pname, OUT GLint params[] )
  563. {
  564. #ifndef _CLIENTSIDE_
  565. int cArgs;
  566. cArgs = __glGet_size(pname);
  567. if (cArgs == 0)
  568. {
  569. GLSETERROR(GL_INVALID_ENUM);
  570. return;
  571. }
  572. ASSERTOPENGL(cArgs <= 16, "bad get size");
  573. GLCLIENT_BEGIN( GetIntegerv, GETINTEGERV )
  574. pMsg->pname = pname;
  575. glsbAttention();
  576. while (--cArgs >= 0)
  577. params[cArgs] = pMsg->params[cArgs];
  578. GLCLIENT_END
  579. return;
  580. #else
  581. GLCLIENT_BEGIN( GetIntegerv, GETINTEGERV )
  582. pMsg->pname = pname;
  583. pMsg->params = params;
  584. glsbAttention();
  585. GLCLIENT_END
  586. return;
  587. #endif
  588. }
  589. void APIENTRY
  590. glcltGetLightfv ( IN GLenum light, IN GLenum pname, OUT GLfloat params[] )
  591. {
  592. #ifndef _CLIENTSIDE_
  593. // LIGHT_SOURCE_ASSERT
  594. if (!RANGE(pname,GL_AMBIENT,GL_QUADRATIC_ATTENUATION))
  595. {
  596. GLSETERROR(GL_INVALID_ENUM);
  597. return;
  598. }
  599. GLCLIENT_BEGIN( GetLightfv, GETLIGHTFV )
  600. pMsg->light = light;
  601. pMsg->pname = pname;
  602. glsbAttention();
  603. switch (pname)
  604. {
  605. case GL_AMBIENT:
  606. case GL_DIFFUSE:
  607. case GL_SPECULAR:
  608. case GL_POSITION:
  609. params[3] = pMsg->params[3];
  610. case GL_SPOT_DIRECTION:
  611. params[2] = pMsg->params[2];
  612. params[1] = pMsg->params[1];
  613. default:
  614. params[0] = pMsg->params[0];
  615. }
  616. GLCLIENT_END
  617. return;
  618. #else
  619. GLCLIENT_BEGIN( GetLightfv, GETLIGHTFV )
  620. pMsg->light = light;
  621. pMsg->pname = pname;
  622. pMsg->params = params;
  623. glsbAttention();
  624. GLCLIENT_END
  625. return;
  626. #endif
  627. }
  628. void APIENTRY
  629. glcltGetLightiv ( IN GLenum light, IN GLenum pname, OUT GLint params[] )
  630. {
  631. #ifndef _CLIENTSIDE_
  632. // LIGHT_SOURCE_ASSERT
  633. if (!RANGE(pname,GL_AMBIENT,GL_QUADRATIC_ATTENUATION))
  634. {
  635. GLSETERROR(GL_INVALID_ENUM);
  636. return;
  637. }
  638. GLCLIENT_BEGIN( GetLightiv, GETLIGHTIV )
  639. pMsg->light = light;
  640. pMsg->pname = pname;
  641. glsbAttention();
  642. switch (pname)
  643. {
  644. case GL_AMBIENT:
  645. case GL_DIFFUSE:
  646. case GL_SPECULAR:
  647. case GL_POSITION:
  648. params[3] = pMsg->params[3];
  649. case GL_SPOT_DIRECTION:
  650. params[2] = pMsg->params[2];
  651. params[1] = pMsg->params[1];
  652. default:
  653. params[0] = pMsg->params[0];
  654. }
  655. GLCLIENT_END
  656. return;
  657. #else
  658. GLCLIENT_BEGIN( GetLightiv, GETLIGHTIV )
  659. pMsg->light = light;
  660. pMsg->pname = pname;
  661. pMsg->params = params;
  662. glsbAttention();
  663. GLCLIENT_END
  664. return;
  665. #endif
  666. }
  667. void APIENTRY
  668. glcltGetMaterialfv ( IN GLenum face, IN GLenum pname, OUT GLfloat params[] )
  669. {
  670. #ifndef _CLIENTSIDE_
  671. int cArgs;
  672. switch (pname) {
  673. case GL_SHININESS:
  674. cArgs = 1;
  675. break;
  676. case GL_EMISSION:
  677. case GL_AMBIENT:
  678. case GL_DIFFUSE:
  679. case GL_SPECULAR:
  680. cArgs = 4;
  681. break;
  682. case GL_COLOR_INDEXES:
  683. cArgs = 3;
  684. break;
  685. case GL_AMBIENT_AND_DIFFUSE:
  686. default:
  687. GLSETERROR(GL_INVALID_ENUM);
  688. return;
  689. }
  690. GLCLIENT_BEGIN( GetMaterialfv, GETMATERIALFV )
  691. pMsg->face = face;
  692. pMsg->pname = pname;
  693. glsbAttention();
  694. while (--cArgs >= 0)
  695. params[cArgs] = pMsg->params[cArgs];
  696. GLCLIENT_END
  697. return;
  698. #else
  699. GLCLIENT_BEGIN( GetMaterialfv, GETMATERIALFV )
  700. pMsg->face = face;
  701. pMsg->pname = pname;
  702. pMsg->params = params;
  703. glsbAttention();
  704. GLCLIENT_END
  705. return;
  706. #endif
  707. }
  708. void APIENTRY
  709. glcltGetMaterialiv ( IN GLenum face, IN GLenum pname, OUT GLint params[] )
  710. {
  711. #ifndef _CLIENTSIDE_
  712. int cArgs;
  713. switch (pname) {
  714. case GL_SHININESS:
  715. cArgs = 1;
  716. break;
  717. case GL_EMISSION:
  718. case GL_AMBIENT:
  719. case GL_DIFFUSE:
  720. case GL_SPECULAR:
  721. cArgs = 4;
  722. break;
  723. case GL_COLOR_INDEXES:
  724. cArgs = 3;
  725. break;
  726. case GL_AMBIENT_AND_DIFFUSE:
  727. default:
  728. GLSETERROR(GL_INVALID_ENUM);
  729. return;
  730. }
  731. GLCLIENT_BEGIN( GetMaterialiv, GETMATERIALIV )
  732. pMsg->face = face;
  733. pMsg->pname = pname;
  734. glsbAttention();
  735. while (--cArgs >= 0)
  736. params[cArgs] = pMsg->params[cArgs];
  737. GLCLIENT_END
  738. return;
  739. #else
  740. GLCLIENT_BEGIN( GetMaterialiv, GETMATERIALIV )
  741. pMsg->face = face;
  742. pMsg->pname = pname;
  743. pMsg->params = params;
  744. glsbAttention();
  745. GLCLIENT_END
  746. return;
  747. #endif
  748. }
  749. void APIENTRY
  750. glcltGetTexEnvfv ( IN GLenum target, IN GLenum pname, OUT GLfloat params[] )
  751. {
  752. #ifndef _CLIENTSIDE_
  753. if (pname != GL_TEXTURE_ENV_MODE && pname != GL_TEXTURE_ENV_COLOR)
  754. {
  755. GLSETERROR(GL_INVALID_ENUM);
  756. return;
  757. }
  758. GLCLIENT_BEGIN( GetTexEnvfv, GETTEXENVFV )
  759. pMsg->target = target;
  760. pMsg->pname = pname;
  761. glsbAttention();
  762. params[0] = pMsg->params[0];
  763. if (pname == GL_TEXTURE_ENV_COLOR)
  764. {
  765. params[1] = pMsg->params[1];
  766. params[2] = pMsg->params[2];
  767. params[3] = pMsg->params[3];
  768. }
  769. GLCLIENT_END
  770. return;
  771. #else
  772. GLCLIENT_BEGIN( GetTexEnvfv, GETTEXENVFV )
  773. pMsg->target = target;
  774. pMsg->pname = pname;
  775. pMsg->params = params;
  776. glsbAttention();
  777. GLCLIENT_END
  778. return;
  779. #endif
  780. }
  781. void APIENTRY
  782. glcltGetTexEnviv ( IN GLenum target, IN GLenum pname, OUT GLint params[] )
  783. {
  784. #ifndef _CLIENTSIDE_
  785. if (pname != GL_TEXTURE_ENV_MODE && pname != GL_TEXTURE_ENV_COLOR)
  786. {
  787. GLSETERROR(GL_INVALID_ENUM);
  788. return;
  789. }
  790. GLCLIENT_BEGIN( GetTexEnviv, GETTEXENVIV )
  791. pMsg->target = target;
  792. pMsg->pname = pname;
  793. glsbAttention();
  794. params[0] = pMsg->params[0];
  795. if (pname == GL_TEXTURE_ENV_COLOR)
  796. {
  797. params[1] = pMsg->params[1];
  798. params[2] = pMsg->params[2];
  799. params[3] = pMsg->params[3];
  800. }
  801. GLCLIENT_END
  802. return;
  803. #else
  804. GLCLIENT_BEGIN( GetTexEnviv, GETTEXENVIV )
  805. pMsg->target = target;
  806. pMsg->pname = pname;
  807. pMsg->params = params;
  808. glsbAttention();
  809. GLCLIENT_END
  810. return;
  811. #endif
  812. }
  813. void APIENTRY
  814. glcltGetTexGendv ( IN GLenum coord, IN GLenum pname, OUT GLdouble params[] )
  815. {
  816. #ifndef _CLIENTSIDE_
  817. // TEX_GEN_ASSERT
  818. if (!RANGE(pname,GL_TEXTURE_GEN_MODE,GL_EYE_PLANE))
  819. {
  820. GLSETERROR(GL_INVALID_ENUM);
  821. return;
  822. }
  823. GLCLIENT_BEGIN( GetTexGendv, GETTEXGENDV )
  824. pMsg->coord = coord;
  825. pMsg->pname = pname;
  826. glsbAttention();
  827. params[0] = pMsg->params[0];
  828. if (pname != GL_TEXTURE_GEN_MODE)
  829. {
  830. params[1] = pMsg->params[1];
  831. params[2] = pMsg->params[2];
  832. params[3] = pMsg->params[3];
  833. }
  834. GLCLIENT_END
  835. return;
  836. #else
  837. GLCLIENT_BEGIN( GetTexGendv, GETTEXGENDV )
  838. pMsg->coord = coord;
  839. pMsg->pname = pname;
  840. pMsg->params = params;
  841. glsbAttention();
  842. GLCLIENT_END
  843. return;
  844. #endif
  845. }
  846. void APIENTRY
  847. glcltGetTexGenfv ( IN GLenum coord, IN GLenum pname, OUT GLfloat params[] )
  848. {
  849. #ifndef _CLIENTSIDE_
  850. // TEX_GEN_ASSERT
  851. if (!RANGE(pname,GL_TEXTURE_GEN_MODE,GL_EYE_PLANE))
  852. {
  853. GLSETERROR(GL_INVALID_ENUM);
  854. return;
  855. }
  856. GLCLIENT_BEGIN( GetTexGenfv, GETTEXGENFV )
  857. pMsg->coord = coord;
  858. pMsg->pname = pname;
  859. glsbAttention();
  860. params[0] = pMsg->params[0];
  861. if (pname != GL_TEXTURE_GEN_MODE)
  862. {
  863. params[1] = pMsg->params[1];
  864. params[2] = pMsg->params[2];
  865. params[3] = pMsg->params[3];
  866. }
  867. GLCLIENT_END
  868. return;
  869. #else
  870. GLCLIENT_BEGIN( GetTexGenfv, GETTEXGENFV )
  871. pMsg->coord = coord;
  872. pMsg->pname = pname;
  873. pMsg->params = params;
  874. glsbAttention();
  875. GLCLIENT_END
  876. return;
  877. #endif
  878. }
  879. void APIENTRY
  880. glcltGetTexGeniv ( IN GLenum coord, IN GLenum pname, OUT GLint params[] )
  881. {
  882. #ifndef _CLIENTSIDE_
  883. // TEX_GEN_ASSERT
  884. if (!RANGE(pname,GL_TEXTURE_GEN_MODE,GL_EYE_PLANE))
  885. {
  886. GLSETERROR(GL_INVALID_ENUM);
  887. return;
  888. }
  889. GLCLIENT_BEGIN( GetTexGeniv, GETTEXGENIV )
  890. pMsg->coord = coord;
  891. pMsg->pname = pname;
  892. glsbAttention();
  893. params[0] = pMsg->params[0];
  894. if (pname != GL_TEXTURE_GEN_MODE)
  895. {
  896. params[1] = pMsg->params[1];
  897. params[2] = pMsg->params[2];
  898. params[3] = pMsg->params[3];
  899. }
  900. GLCLIENT_END
  901. return;
  902. #else
  903. GLCLIENT_BEGIN( GetTexGeniv, GETTEXGENIV )
  904. pMsg->coord = coord;
  905. pMsg->pname = pname;
  906. pMsg->params = params;
  907. glsbAttention();
  908. GLCLIENT_END
  909. return;
  910. #endif
  911. }
  912. void APIENTRY
  913. glcltGetTexParameterfv ( IN GLenum target, IN GLenum pname, OUT GLfloat params[] )
  914. {
  915. #ifndef _CLIENTSIDE_
  916. switch (pname) {
  917. case GL_TEXTURE_WRAP_S:
  918. case GL_TEXTURE_WRAP_T:
  919. case GL_TEXTURE_MIN_FILTER:
  920. case GL_TEXTURE_MAG_FILTER:
  921. case GL_TEXTURE_BORDER_COLOR:
  922. case GL_TEXTURE_PRIORITY:
  923. case GL_TEXTURE_RESIDENT:
  924. break;
  925. default:
  926. GLSETERROR(GL_INVALID_ENUM);
  927. return;
  928. }
  929. GLCLIENT_BEGIN( GetTexParameterfv, GETTEXPARAMETERFV )
  930. pMsg->target = target;
  931. pMsg->pname = pname;
  932. glsbAttention();
  933. params[0] = pMsg->params[0];
  934. if (pname == GL_TEXTURE_BORDER_COLOR)
  935. {
  936. params[1] = pMsg->params[1];
  937. params[2] = pMsg->params[2];
  938. params[3] = pMsg->params[3];
  939. }
  940. GLCLIENT_END
  941. return;
  942. #else
  943. GLCLIENT_BEGIN( GetTexParameterfv, GETTEXPARAMETERFV )
  944. pMsg->target = target;
  945. pMsg->pname = pname;
  946. pMsg->params = params;
  947. glsbAttention();
  948. GLCLIENT_END
  949. return;
  950. #endif
  951. }
  952. void APIENTRY
  953. glcltGetTexParameteriv ( IN GLenum target, IN GLenum pname, OUT GLint params[] )
  954. {
  955. #ifndef _CLIENTSIDE_
  956. switch (pname) {
  957. case GL_TEXTURE_WRAP_S:
  958. case GL_TEXTURE_WRAP_T:
  959. case GL_TEXTURE_MIN_FILTER:
  960. case GL_TEXTURE_MAG_FILTER:
  961. case GL_TEXTURE_BORDER_COLOR:
  962. case GL_TEXTURE_PRIORITY:
  963. case GL_TEXTURE_RESIDENT:
  964. break;
  965. default:
  966. GLSETERROR(GL_INVALID_ENUM);
  967. return;
  968. }
  969. GLCLIENT_BEGIN( GetTexParameteriv, GETTEXPARAMETERIV )
  970. pMsg->target = target;
  971. pMsg->pname = pname;
  972. glsbAttention();
  973. params[0] = pMsg->params[0];
  974. if (pname == GL_TEXTURE_BORDER_COLOR)
  975. {
  976. params[1] = pMsg->params[1];
  977. params[2] = pMsg->params[2];
  978. params[3] = pMsg->params[3];
  979. }
  980. GLCLIENT_END
  981. return;
  982. #else
  983. GLCLIENT_BEGIN( GetTexParameteriv, GETTEXPARAMETERIV )
  984. pMsg->target = target;
  985. pMsg->pname = pname;
  986. pMsg->params = params;
  987. glsbAttention();
  988. GLCLIENT_END
  989. return;
  990. #endif
  991. }
  992. void APIENTRY
  993. glcltGetTexLevelParameterfv ( IN GLenum target, IN GLint level, IN GLenum pname, OUT GLfloat params[] )
  994. {
  995. #ifndef _CLIENTSIDE_
  996. switch (pname) {
  997. case GL_TEXTURE_WIDTH:
  998. case GL_TEXTURE_HEIGHT:
  999. case GL_TEXTURE_COMPONENTS:
  1000. case GL_TEXTURE_BORDER:
  1001. break;
  1002. default:
  1003. GLSETERROR(GL_INVALID_ENUM);
  1004. return;
  1005. }
  1006. GLCLIENT_BEGIN( GetTexLevelParameterfv, GETTEXLEVELPARAMETERFV )
  1007. pMsg->target = target;
  1008. pMsg->level = level;
  1009. pMsg->pname = pname;
  1010. glsbAttention();
  1011. params[0] = pMsg->params[0];
  1012. GLCLIENT_END
  1013. return;
  1014. #else
  1015. GLCLIENT_BEGIN( GetTexLevelParameterfv, GETTEXLEVELPARAMETERFV )
  1016. pMsg->target = target;
  1017. pMsg->level = level;
  1018. pMsg->pname = pname;
  1019. pMsg->params = params;
  1020. glsbAttention();
  1021. GLCLIENT_END
  1022. return;
  1023. #endif
  1024. }
  1025. void APIENTRY
  1026. glcltGetTexLevelParameteriv ( IN GLenum target, IN GLint level, IN GLenum pname, OUT GLint params[] )
  1027. {
  1028. #ifndef _CLIENTSIDE_
  1029. switch (pname) {
  1030. case GL_TEXTURE_WIDTH:
  1031. case GL_TEXTURE_HEIGHT:
  1032. case GL_TEXTURE_COMPONENTS:
  1033. case GL_TEXTURE_BORDER:
  1034. break;
  1035. default:
  1036. GLSETERROR(GL_INVALID_ENUM);
  1037. return;
  1038. }
  1039. GLCLIENT_BEGIN( GetTexLevelParameteriv, GETTEXLEVELPARAMETERIV )
  1040. pMsg->target = target;
  1041. pMsg->level = level;
  1042. pMsg->pname = pname;
  1043. glsbAttention();
  1044. params[0] = pMsg->params[0];
  1045. GLCLIENT_END
  1046. return;
  1047. #else
  1048. GLCLIENT_BEGIN( GetTexLevelParameteriv, GETTEXLEVELPARAMETERIV )
  1049. pMsg->target = target;
  1050. pMsg->level = level;
  1051. pMsg->pname = pname;
  1052. pMsg->params = params;
  1053. glsbAttention();
  1054. GLCLIENT_END
  1055. return;
  1056. #endif
  1057. }
  1058. /******* Select and Feedback functions ******************************/
  1059. /*
  1060. * Note:
  1061. *
  1062. * The size of the data is not required on the client side.
  1063. * Since calculating the size of the data requires
  1064. * knowledge of the visual type (RGBA/ColorIndex) it is
  1065. * appropriate to let the server calculate it.
  1066. */
  1067. void APIENTRY
  1068. glcltFeedbackBuffer( IN GLsizei size, IN GLenum type, OUT GLfloat buffer[] )
  1069. {
  1070. #ifndef _CLIENTSIDE_
  1071. GLMSGBATCHINFO *pMsgBatchInfo;
  1072. GLMSG_FEEDBACKBUFFER *pMsg;
  1073. ULONG NextOffset;
  1074. /* Set a pointer to the batch information structure */
  1075. pMsgBatchInfo = GLTEB_SHAREDMEMORYSECTION();
  1076. /* This is the first available byte after the message */
  1077. NextOffset = pMsgBatchInfo->NextOffset +
  1078. GLMSG_ALIGN(sizeof(GLMSG_FEEDBACKBUFFER));
  1079. if ( NextOffset > pMsgBatchInfo->MaximumOffset )
  1080. {
  1081. /* No room for the message, flush the batch */
  1082. glsbAttention();
  1083. /* Reset NextOffset */
  1084. NextOffset = pMsgBatchInfo->NextOffset +
  1085. GLMSG_ALIGN(sizeof(GLMSG_FEEDBACKBUFFER));
  1086. }
  1087. /* This is where we will store our message */
  1088. pMsg = (GLMSG_FEEDBACKBUFFER *)( ((BYTE *)pMsgBatchInfo) +
  1089. pMsgBatchInfo->NextOffset);
  1090. /* Set the ProcOffset for this function */
  1091. pMsg->ProcOffset = offsetof(GLSRVSBPROCTABLE, glsrvFeedbackBuffer);
  1092. /* Assign the members in the message */
  1093. pMsg->size = size;
  1094. pMsg->type = type;
  1095. pMsg->bufferOff = (ULONG_PTR)buffer;
  1096. pMsgBatchInfo->NextOffset = NextOffset;
  1097. return;
  1098. #else
  1099. GLCLIENT_BEGIN_LARGE_SET( FeedbackBuffer, FEEDBACKBUFFER, buffer, size, bufferOff )
  1100. pMsg->size = size;
  1101. pMsg->type = type;
  1102. GLCLIENT_END_LARGE_SET
  1103. return;
  1104. #endif // _CLIENTSIDE_
  1105. }
  1106. void APIENTRY
  1107. glcltSelectBuffer( IN GLsizei size, OUT GLuint buffer[] )
  1108. {
  1109. #ifndef _CLIENTSIDE_
  1110. GLMSGBATCHINFO *pMsgBatchInfo;
  1111. GLMSG_SELECTBUFFER *pMsg;
  1112. ULONG NextOffset;
  1113. /* Set a pointer to the batch information structure */
  1114. pMsgBatchInfo = GLTEB_SHAREDMEMORYSECTION();
  1115. /* This is the first available byte after the message */
  1116. NextOffset = pMsgBatchInfo->NextOffset +
  1117. GLMSG_ALIGN(sizeof(GLMSG_SELECTBUFFER));
  1118. if ( NextOffset > pMsgBatchInfo->MaximumOffset )
  1119. {
  1120. /* No room for the message, flush the batch */
  1121. glsbAttention();
  1122. /* Reset NextOffset */
  1123. NextOffset = pMsgBatchInfo->NextOffset +
  1124. GLMSG_ALIGN(sizeof(GLMSG_SELECTBUFFER));
  1125. }
  1126. /* This is where we will store our message */
  1127. pMsg = (GLMSG_SELECTBUFFER *)( ((BYTE *)pMsgBatchInfo) +
  1128. pMsgBatchInfo->NextOffset);
  1129. /* Set the ProcOffset for this function */
  1130. pMsg->ProcOffset = offsetof(GLSRVSBPROCTABLE, glsrvSelectBuffer);
  1131. /* Assign the members in the message */
  1132. pMsg->size = size;
  1133. pMsg->bufferOff = (ULONG_PTR)buffer;
  1134. pMsgBatchInfo->NextOffset = NextOffset;
  1135. return;
  1136. #else
  1137. GLCLIENT_BEGIN_LARGE_SET( SelectBuffer, SELECTBUFFER, buffer, size, bufferOff )
  1138. pMsg->size = size;
  1139. GLCLIENT_END_LARGE_SET
  1140. return;
  1141. #endif // _CLIENTSIDE_
  1142. }
  1143. GLint APIENTRY
  1144. glcltRenderMode( IN GLenum mode )
  1145. {
  1146. GLCLIENT_BEGIN( RenderMode, RENDERMODE )
  1147. pMsg->mode = mode ;
  1148. GLTEB_RETURNVALUE() = 0; // assume error
  1149. glsbAttention();
  1150. return( (GLint)GLTEB_RETURNVALUE() );
  1151. GLCLIENT_END
  1152. }
  1153. const GLubyte * APIENTRY
  1154. glcltGetString( IN GLenum name )
  1155. {
  1156. switch (name)
  1157. {
  1158. case GL_VENDOR:
  1159. return("Microsoft Corporation");
  1160. case GL_RENDERER:
  1161. return("GDI Generic");
  1162. case GL_VERSION:
  1163. // Version numbers
  1164. // WinNT 3.5: 1.0
  1165. // WinNT 3.51: 1.01
  1166. // Win95 beta: 1.015
  1167. // Win95: 1.02
  1168. // WinNT 4.0: 1.1.0
  1169. return("1.1.0");
  1170. case GL_EXTENSIONS:
  1171. #ifdef GL_WIN_swap_hint
  1172. return "GL_WIN_swap_hint"
  1173. #endif
  1174. #ifdef GL_EXT_bgra
  1175. " GL_EXT_bgra"
  1176. #endif
  1177. #ifdef GL_EXT_paletted_texture
  1178. " GL_EXT_paletted_texture"
  1179. #endif
  1180. #ifdef GL_WIN_phong_shading
  1181. " GL_WIN_phong_shading"
  1182. #endif
  1183. #ifdef GL_EXT_flat_paletted_lighting
  1184. " GL_EXT_flat_paletted_lighting"
  1185. #endif
  1186. #ifdef GL_WIN_specular_fog
  1187. " GL_WIN_specular_fog"
  1188. #endif //GL_WIN_specular_fog
  1189. #ifdef GL_WIN_multiple_textures
  1190. " GL_WIN_multiple_textures"
  1191. #endif
  1192. ;
  1193. }
  1194. GLSETERROR(GL_INVALID_ENUM);
  1195. return((const GLubyte *)0);
  1196. }
  1197. /*********** Evaluator functions ************************************/
  1198. // Look in eval.c
  1199. /*********** Pixel Functions ****************************************/
  1200. void APIENTRY
  1201. glcltReadPixels ( IN GLint x,
  1202. IN GLint y,
  1203. IN GLsizei width,
  1204. IN GLsizei height,
  1205. IN GLenum format,
  1206. IN GLenum type,
  1207. OUT GLvoid *pixels
  1208. )
  1209. {
  1210. #ifndef _CLIENTSIDE_
  1211. GLMSGBATCHINFO *pMsgBatchInfo;
  1212. GLMSG_READPIXELS *pMsg;
  1213. ULONG NextOffset;
  1214. /* Set a pointer to the batch information structure */
  1215. pMsgBatchInfo = GLTEB_SHAREDMEMORYSECTION();
  1216. /* Tentative offset, where we may want to place our data */
  1217. /* This is also the first available byte after the message */
  1218. NextOffset = pMsgBatchInfo->NextOffset +
  1219. GLMSG_ALIGN(sizeof(*pMsg));
  1220. if ( NextOffset > pMsgBatchInfo->MaximumOffset )
  1221. {
  1222. /* No room for the message, flush the batch */
  1223. glsbAttention();
  1224. /* Reset NextOffset */
  1225. NextOffset = pMsgBatchInfo->NextOffset +
  1226. GLMSG_ALIGN(sizeof(*pMsg));
  1227. }
  1228. /* This is where we will store our message */
  1229. pMsg = (GLMSG_READPIXELS *)( ((BYTE *)pMsgBatchInfo) +
  1230. pMsgBatchInfo->NextOffset);
  1231. /* Set the ProcOffset for this function */
  1232. pMsg->ProcOffset = offsetof(GLSRVSBPROCTABLE, glsrvReadPixels);
  1233. /* Assign the members in the message as required */
  1234. pMsg->x = x ;
  1235. pMsg->y = y ;
  1236. pMsg->width = width ;
  1237. pMsg->height = height ;
  1238. pMsg->format = format ;
  1239. pMsg->type = type ;
  1240. pMsg->pixelsOff = (ULONG_PTR)pixels ;
  1241. /* Get the batch ready for the next message */
  1242. pMsgBatchInfo->NextOffset = NextOffset;
  1243. glsbAttention();
  1244. return;
  1245. #else
  1246. GLCLIENT_BEGIN_LARGE_GET( ReadPixels, READPIXELS, pixels, width*height, pixelsOff )
  1247. pMsg->x = x ;
  1248. pMsg->y = y ;
  1249. pMsg->width = width ;
  1250. pMsg->height = height ;
  1251. pMsg->format = format ;
  1252. pMsg->type = type ;
  1253. GLCLIENT_END_LARGE_GET
  1254. return;
  1255. #endif // _CLIENTSIDE_
  1256. }
  1257. void APIENTRY
  1258. glcltGetTexImage ( IN GLenum target,
  1259. IN GLint level,
  1260. IN GLenum format,
  1261. IN GLenum type,
  1262. OUT GLvoid *pixels
  1263. )
  1264. {
  1265. #ifndef _CLIENTSIDE_
  1266. GLMSGBATCHINFO *pMsgBatchInfo;
  1267. GLMSG_GETTEXIMAGE *pMsg;
  1268. ULONG NextOffset;
  1269. /* Set a pointer to the batch information structure */
  1270. pMsgBatchInfo = GLTEB_SHAREDMEMORYSECTION();
  1271. /* Tentative offset, where we may want to place our data */
  1272. /* This is also the first available byte after the message */
  1273. NextOffset = pMsgBatchInfo->NextOffset +
  1274. GLMSG_ALIGN(sizeof(*pMsg));
  1275. if ( NextOffset > pMsgBatchInfo->MaximumOffset )
  1276. {
  1277. /* No room for the message, flush the batch */
  1278. glsbAttention();
  1279. /* Reset NextOffset */
  1280. NextOffset = pMsgBatchInfo->NextOffset +
  1281. GLMSG_ALIGN(sizeof(*pMsg));
  1282. }
  1283. /* This is where we will store our message */
  1284. pMsg = (GLMSG_GETTEXIMAGE *)( ((BYTE *)pMsgBatchInfo) +
  1285. pMsgBatchInfo->NextOffset);
  1286. /* Set the ProcOffset for this function */
  1287. pMsg->ProcOffset = offsetof(GLSRVSBPROCTABLE, glsrvGetTexImage);
  1288. /* Assign the members in the message as required */
  1289. pMsg->target = target ;
  1290. pMsg->level = level ;
  1291. pMsg->format = format ;
  1292. pMsg->type = type ;
  1293. pMsg->pixelsOff = (ULONG_PTR)pixels ;
  1294. /* Get the batch ready for the next message */
  1295. pMsgBatchInfo->NextOffset = NextOffset;
  1296. glsbAttention();
  1297. return;
  1298. #else
  1299. GLCLIENT_BEGIN_LARGE_GET( GetTexImage, GETTEXIMAGE, pixels, -1, pixelsOff )
  1300. pMsg->target = target ;
  1301. pMsg->level = level ;
  1302. pMsg->format = format ;
  1303. pMsg->type = type ;
  1304. GLCLIENT_END_LARGE_GET
  1305. return;
  1306. #endif // _CLIENTSIDE_
  1307. }
  1308. void APIENTRY
  1309. glcltDrawPixels ( IN GLsizei width,
  1310. IN GLsizei height,
  1311. IN GLenum format,
  1312. IN GLenum type,
  1313. IN const GLvoid *pixels
  1314. )
  1315. {
  1316. #ifndef _CLIENTSIDE_
  1317. GLMSGBATCHINFO *pMsgBatchInfo;
  1318. GLMSG_DRAWPIXELS *pMsg;
  1319. ULONG NextOffset;
  1320. /* Set a pointer to the batch information structure */
  1321. pMsgBatchInfo = GLTEB_SHAREDMEMORYSECTION();
  1322. /* Tentative offset, where we may want to place our data */
  1323. /* This is also the first available byte after the message */
  1324. NextOffset = pMsgBatchInfo->NextOffset +
  1325. GLMSG_ALIGN(sizeof(*pMsg));
  1326. if ( NextOffset > pMsgBatchInfo->MaximumOffset )
  1327. {
  1328. /* No room for the message, flush the batch */
  1329. glsbAttention();
  1330. /* Reset NextOffset */
  1331. NextOffset = pMsgBatchInfo->NextOffset +
  1332. GLMSG_ALIGN(sizeof(*pMsg));
  1333. }
  1334. /* This is where we will store our message */
  1335. pMsg = (GLMSG_DRAWPIXELS *)( ((BYTE *)pMsgBatchInfo) +
  1336. pMsgBatchInfo->NextOffset);
  1337. /* Set the ProcOffset for this function */
  1338. pMsg->ProcOffset = offsetof(GLSRVSBPROCTABLE, glsrvDrawPixels);
  1339. /* Assign the members in the message as required */
  1340. pMsg->width = width ;
  1341. pMsg->height = height ;
  1342. pMsg->format = format ;
  1343. pMsg->type = type ;
  1344. pMsg->pixelsOff = (ULONG_PTR)pixels ;
  1345. /* Get the batch ready for the next message */
  1346. pMsgBatchInfo->NextOffset = NextOffset;
  1347. glsbAttention();
  1348. return;
  1349. #else
  1350. GLCLIENT_BEGIN_LARGE_SET( DrawPixels, DRAWPIXELS, pixels, width*height, pixelsOff )
  1351. pMsg->width = width ;
  1352. pMsg->height = height ;
  1353. pMsg->format = format ;
  1354. pMsg->type = type ;
  1355. pMsg->_IsDlist = GL_FALSE ;
  1356. GLCLIENT_END_LARGE_SET
  1357. return;
  1358. #endif // _CLIENTSIDE_
  1359. }
  1360. void APIENTRY
  1361. glcltBitmap ( IN GLsizei width,
  1362. IN GLsizei height,
  1363. IN GLfloat xorig,
  1364. IN GLfloat yorig,
  1365. IN GLfloat xmove,
  1366. IN GLfloat ymove,
  1367. IN const GLubyte bitmap[]
  1368. )
  1369. {
  1370. #ifndef _CLIENTSIDE_
  1371. GLMSGBATCHINFO *pMsgBatchInfo;
  1372. GLMSG_BITMAP *pMsg;
  1373. ULONG NextOffset;
  1374. /* Set a pointer to the batch information structure */
  1375. pMsgBatchInfo = GLTEB_SHAREDMEMORYSECTION();
  1376. /* Tentative offset, where we may want to place our data */
  1377. /* This is also the first available byte after the message */
  1378. NextOffset = pMsgBatchInfo->NextOffset +
  1379. GLMSG_ALIGN(sizeof(*pMsg));
  1380. if ( NextOffset > pMsgBatchInfo->MaximumOffset )
  1381. {
  1382. /* No room for the message, flush the batch */
  1383. glsbAttention();
  1384. /* Reset NextOffset */
  1385. NextOffset = pMsgBatchInfo->NextOffset +
  1386. GLMSG_ALIGN(sizeof(*pMsg));
  1387. }
  1388. /* This is where we will store our message */
  1389. pMsg = (GLMSG_BITMAP *)( ((BYTE *)pMsgBatchInfo) +
  1390. pMsgBatchInfo->NextOffset);
  1391. /* Set the ProcOffset for this function */
  1392. pMsg->ProcOffset = offsetof(GLSRVSBPROCTABLE, glsrvBitmap);
  1393. /* Assign the members in the message as required */
  1394. pMsg->width = width ;
  1395. pMsg->height = height ;
  1396. pMsg->xorig = xorig ;
  1397. pMsg->yorig = yorig ;
  1398. pMsg->xmove = xmove ;
  1399. pMsg->ymove = ymove ;
  1400. pMsg->bitmapOff = (ULONG)bitmap ;
  1401. /* Get the batch ready for the next message */
  1402. pMsgBatchInfo->NextOffset = NextOffset;
  1403. glsbAttention();
  1404. return;
  1405. #else
  1406. GLCLIENT_BEGIN_LARGE_SET( Bitmap, BITMAP, bitmap, width*height, bitmapOff )
  1407. pMsg->width = width ;
  1408. pMsg->height = height ;
  1409. pMsg->xorig = xorig ;
  1410. pMsg->yorig = yorig ;
  1411. pMsg->xmove = xmove ;
  1412. pMsg->ymove = ymove ;
  1413. pMsg->_IsDlist = GL_FALSE ;
  1414. GLCLIENT_END_LARGE_SET
  1415. return;
  1416. #endif // _CLIENTSIDE_
  1417. }
  1418. void APIENTRY
  1419. glcltPolygonStipple ( const GLubyte *mask )
  1420. {
  1421. #ifndef _CLIENTSIDE_
  1422. GLMSGBATCHINFO *pMsgBatchInfo;
  1423. GLMSG_POLYGONSTIPPLE *pMsg;
  1424. ULONG NextOffset;
  1425. /* Set a pointer to the batch information structure */
  1426. pMsgBatchInfo = GLTEB_SHAREDMEMORYSECTION();
  1427. /* Tentative offset, where we may want to place our data */
  1428. /* This is also the first available byte after the message */
  1429. NextOffset = pMsgBatchInfo->NextOffset +
  1430. GLMSG_ALIGN(sizeof(*pMsg));
  1431. if ( NextOffset > pMsgBatchInfo->MaximumOffset )
  1432. {
  1433. /* No room for the message, flush the batch */
  1434. glsbAttention();
  1435. /* Reset NextOffset */
  1436. NextOffset = pMsgBatchInfo->NextOffset +
  1437. GLMSG_ALIGN(sizeof(*pMsg));
  1438. }
  1439. /* This is where we will store our message */
  1440. pMsg = (GLMSG_POLYGONSTIPPLE *)( ((BYTE *)pMsgBatchInfo) +
  1441. pMsgBatchInfo->NextOffset);
  1442. /* Set the ProcOffset for this function */
  1443. pMsg->ProcOffset = offsetof(GLSRVSBPROCTABLE, glsrvPolygonStipple);
  1444. /* Assign the members in the message as required */
  1445. pMsg->maskOff = (ULONG)mask;
  1446. /* Get the batch ready for the next message */
  1447. pMsgBatchInfo->NextOffset = NextOffset;
  1448. glsbAttention();
  1449. return;
  1450. #else
  1451. GLCLIENT_BEGIN_LARGE_SET( PolygonStipple, POLYGONSTIPPLE, mask, -1, maskOff )
  1452. pMsg->_IsDlist = GL_FALSE;
  1453. GLCLIENT_END_LARGE_SET
  1454. return;
  1455. #endif // _CLIENTSIDE_
  1456. }
  1457. void APIENTRY
  1458. glcltGetPolygonStipple ( GLubyte mask[] )
  1459. {
  1460. #ifndef _CLIENTSIDE_
  1461. GLMSGBATCHINFO *pMsgBatchInfo;
  1462. GLMSG_GETPOLYGONSTIPPLE *pMsg;
  1463. ULONG NextOffset;
  1464. /* Set a pointer to the batch information structure */
  1465. pMsgBatchInfo = GLTEB_SHAREDMEMORYSECTION();
  1466. /* Tentative offset, where we may want to place our data */
  1467. /* This is also the first available byte after the message */
  1468. NextOffset = pMsgBatchInfo->NextOffset +
  1469. GLMSG_ALIGN(sizeof(*pMsg));
  1470. if ( NextOffset > pMsgBatchInfo->MaximumOffset )
  1471. {
  1472. /* No room for the message, flush the batch */
  1473. glsbAttention();
  1474. /* Reset NextOffset */
  1475. NextOffset = pMsgBatchInfo->NextOffset +
  1476. GLMSG_ALIGN(sizeof(*pMsg));
  1477. }
  1478. /* This is where we will store our message */
  1479. pMsg = (GLMSG_GETPOLYGONSTIPPLE *)( ((BYTE *)pMsgBatchInfo) +
  1480. pMsgBatchInfo->NextOffset);
  1481. /* Set the ProcOffset for this function */
  1482. pMsg->ProcOffset = offsetof(GLSRVSBPROCTABLE, glsrvGetPolygonStipple);
  1483. /* Assign the members in the message as required */
  1484. pMsg->maskOff = (ULONG)mask;
  1485. /* Get the batch ready for the next message */
  1486. pMsgBatchInfo->NextOffset = NextOffset;
  1487. glsbAttention();
  1488. return;
  1489. #else
  1490. GLCLIENT_BEGIN_LARGE_GET( GetPolygonStipple, GETPOLYGONSTIPPLE, mask, -1, maskOff )
  1491. GLCLIENT_END_LARGE_GET
  1492. return;
  1493. #endif // _CLIENTSIDE_
  1494. }
  1495. void APIENTRY
  1496. glcltTexImage1D ( IN GLenum target,
  1497. IN GLint level,
  1498. IN GLint components,
  1499. IN GLsizei width,
  1500. IN GLint border,
  1501. IN GLenum format,
  1502. IN GLenum type,
  1503. IN const GLvoid *pixels
  1504. )
  1505. {
  1506. #ifndef _CLIENTSIDE_
  1507. GLMSGBATCHINFO *pMsgBatchInfo;
  1508. GLMSG_TEXIMAGE1D *pMsg;
  1509. ULONG NextOffset;
  1510. /* Set a pointer to the batch information structure */
  1511. pMsgBatchInfo = GLTEB_SHAREDMEMORYSECTION();
  1512. /* Tentative offset, where we may want to place our data */
  1513. /* This is also the first available byte after the message */
  1514. NextOffset = pMsgBatchInfo->NextOffset +
  1515. GLMSG_ALIGN(sizeof(*pMsg));
  1516. if ( NextOffset > pMsgBatchInfo->MaximumOffset )
  1517. {
  1518. /* No room for the message, flush the batch */
  1519. glsbAttention();
  1520. /* Reset NextOffset */
  1521. NextOffset = pMsgBatchInfo->NextOffset +
  1522. GLMSG_ALIGN(sizeof(*pMsg));
  1523. }
  1524. /* This is where we will store our message */
  1525. pMsg = (GLMSG_TEXIMAGE1D *)( ((BYTE *)pMsgBatchInfo) +
  1526. pMsgBatchInfo->NextOffset);
  1527. /* Set the ProcOffset for this function */
  1528. pMsg->ProcOffset = offsetof(GLSRVSBPROCTABLE, glsrvTexImage1D);
  1529. /* Assign the members in the message as required */
  1530. pMsg->target = target ;
  1531. pMsg->level = level ;
  1532. pMsg->components = components ;
  1533. pMsg->width = width ;
  1534. pMsg->border = border ;
  1535. pMsg->format = format ;
  1536. pMsg->type = type ;
  1537. pMsg->pixelsOff = (ULONG_PTR)pixels ;
  1538. /* Get the batch ready for the next message */
  1539. pMsgBatchInfo->NextOffset = NextOffset;
  1540. glsbAttention();
  1541. return;
  1542. #else
  1543. GLCLIENT_BEGIN_LARGE_SET( TexImage1D, TEXIMAGE1D, pixels, width, pixelsOff )
  1544. pMsg->target = target ;
  1545. pMsg->level = level ;
  1546. pMsg->components = components ;
  1547. pMsg->width = width ;
  1548. pMsg->border = border ;
  1549. pMsg->format = format ;
  1550. pMsg->type = type ;
  1551. pMsg->_IsDlist = GL_FALSE ;
  1552. GLCLIENT_END_LARGE_SET
  1553. return;
  1554. #endif // _CLIENTSIDE_
  1555. }
  1556. void APIENTRY
  1557. glcltTexImage2D ( IN GLenum target,
  1558. IN GLint level,
  1559. IN GLint components,
  1560. IN GLsizei width,
  1561. IN GLsizei height,
  1562. IN GLint border,
  1563. IN GLenum format,
  1564. IN GLenum type,
  1565. IN const GLvoid *pixels
  1566. )
  1567. {
  1568. #ifndef _CLIENTSIDE_
  1569. GLMSGBATCHINFO *pMsgBatchInfo;
  1570. GLMSG_TEXIMAGE2D *pMsg;
  1571. ULONG NextOffset;
  1572. /* Set a pointer to the batch information structure */
  1573. pMsgBatchInfo = GLTEB_SHAREDMEMORYSECTION();
  1574. /* Tentative offset, where we may want to place our data */
  1575. /* This is also the first available byte after the message */
  1576. NextOffset = pMsgBatchInfo->NextOffset +
  1577. GLMSG_ALIGN(sizeof(*pMsg));
  1578. if ( NextOffset > pMsgBatchInfo->MaximumOffset )
  1579. {
  1580. /* No room for the message, flush the batch */
  1581. glsbAttention();
  1582. /* Reset NextOffset */
  1583. NextOffset = pMsgBatchInfo->NextOffset +
  1584. GLMSG_ALIGN(sizeof(*pMsg));
  1585. }
  1586. /* This is where we will store our message */
  1587. pMsg = (GLMSG_TEXIMAGE2D *)( ((BYTE *)pMsgBatchInfo) +
  1588. pMsgBatchInfo->NextOffset);
  1589. /* Set the ProcOffset for this function */
  1590. pMsg->ProcOffset = offsetof(GLSRVSBPROCTABLE, glsrvTexImage2D);
  1591. /* Assign the members in the message as required */
  1592. pMsg->target = target ;
  1593. pMsg->level = level ;
  1594. pMsg->components = components ;
  1595. pMsg->width = width ;
  1596. pMsg->height = height ;
  1597. pMsg->border = border ;
  1598. pMsg->format = format ;
  1599. pMsg->type = type ;
  1600. pMsg->pixelsOff = (ULONG_PTR)pixels ;
  1601. /* Get the batch ready for the next message */
  1602. pMsgBatchInfo->NextOffset = NextOffset;
  1603. glsbAttention();
  1604. return;
  1605. #else
  1606. GLCLIENT_BEGIN_LARGE_SET( TexImage2D, TEXIMAGE2D, pixels, width*height, pixelsOff )
  1607. pMsg->target = target ;
  1608. pMsg->level = level ;
  1609. pMsg->components = components ;
  1610. pMsg->width = width ;
  1611. pMsg->height = height ;
  1612. pMsg->border = border ;
  1613. pMsg->format = format ;
  1614. pMsg->type = type ;
  1615. pMsg->_IsDlist = GL_FALSE ;
  1616. GLCLIENT_END_LARGE_SET
  1617. return;
  1618. #endif // _CLIENTSIDE_
  1619. }
  1620. GLboolean APIENTRY glcltAreTexturesResident(GLsizei n, const GLuint *textures,
  1621. GLboolean *residences)
  1622. {
  1623. GLCLIENT_BEGIN(AreTexturesResident, ARETEXTURESRESIDENT)
  1624. pMsg->n = n;
  1625. pMsg->textures = textures;
  1626. pMsg->residences = residences;
  1627. GLTEB_RETURNVALUE() = 0;
  1628. glsbAttention();
  1629. return (GLboolean)GLTEB_RETURNVALUE();
  1630. GLCLIENT_END
  1631. }
  1632. void APIENTRY glcltBindTexture(GLenum target, GLuint texture)
  1633. {
  1634. GLCLIENT_BEGIN(BindTexture, BINDTEXTURE)
  1635. pMsg->target = target;
  1636. pMsg->texture = texture;
  1637. return;
  1638. GLCLIENT_END
  1639. }
  1640. void APIENTRY glcltCopyTexImage1D(GLenum target, GLint level,
  1641. GLenum internalformat, GLint x, GLint y,
  1642. GLsizei width, GLint border)
  1643. {
  1644. GLCLIENT_BEGIN(CopyTexImage1D, COPYTEXIMAGE1D)
  1645. pMsg->target = target;
  1646. pMsg->level = level;
  1647. pMsg->internalformat = internalformat;
  1648. pMsg->x = x;
  1649. pMsg->y = y;
  1650. pMsg->width = width;
  1651. pMsg->border = border;
  1652. return;
  1653. GLCLIENT_END
  1654. }
  1655. void APIENTRY glcltCopyTexImage2D(GLenum target, GLint level,
  1656. GLenum internalformat, GLint x, GLint y,
  1657. GLsizei width, GLsizei height, GLint border)
  1658. {
  1659. GLCLIENT_BEGIN(CopyTexImage2D, COPYTEXIMAGE2D)
  1660. pMsg->target = target;
  1661. pMsg->level = level;
  1662. pMsg->internalformat = internalformat;
  1663. pMsg->x = x;
  1664. pMsg->y = y;
  1665. pMsg->width = width;
  1666. pMsg->height = height;
  1667. pMsg->border = border;
  1668. return;
  1669. GLCLIENT_END
  1670. }
  1671. void APIENTRY glcltCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset,
  1672. GLint x, GLint y, GLsizei width)
  1673. {
  1674. GLCLIENT_BEGIN(CopyTexSubImage1D, COPYTEXSUBIMAGE1D)
  1675. pMsg->target = target;
  1676. pMsg->level = level;
  1677. pMsg->xoffset = xoffset;
  1678. pMsg->x = x;
  1679. pMsg->y = y;
  1680. pMsg->width = width;
  1681. return;
  1682. GLCLIENT_END
  1683. }
  1684. void APIENTRY glcltCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset,
  1685. GLint yoffset, GLint x, GLint y,
  1686. GLsizei width, GLsizei height)
  1687. {
  1688. GLCLIENT_BEGIN(CopyTexSubImage2D, COPYTEXSUBIMAGE2D)
  1689. pMsg->target = target;
  1690. pMsg->level = level;
  1691. pMsg->xoffset = xoffset;
  1692. pMsg->yoffset = yoffset;
  1693. pMsg->x = x;
  1694. pMsg->y = y;
  1695. pMsg->width = width;
  1696. pMsg->height = height;
  1697. return;
  1698. GLCLIENT_END
  1699. }
  1700. void APIENTRY glcltDeleteTextures(GLsizei n, const GLuint *textures)
  1701. {
  1702. GLCLIENT_BEGIN(DeleteTextures, DELETETEXTURES)
  1703. pMsg->n = n;
  1704. pMsg->textures = textures;
  1705. // Flush pointer
  1706. glsbAttention();
  1707. return;
  1708. GLCLIENT_END
  1709. }
  1710. void APIENTRY glcltGenTextures(GLsizei n, GLuint *textures)
  1711. {
  1712. GLCLIENT_BEGIN(GenTextures, GENTEXTURES)
  1713. pMsg->n = n;
  1714. pMsg->textures = textures;
  1715. glsbAttention();
  1716. return;
  1717. GLCLIENT_END
  1718. }
  1719. GLboolean APIENTRY glcltIsTexture(GLuint texture)
  1720. {
  1721. GLCLIENT_BEGIN(IsTexture, ISTEXTURE)
  1722. pMsg->texture = texture;
  1723. GLTEB_RETURNVALUE() = 0;
  1724. glsbAttention();
  1725. return (GLboolean)GLTEB_RETURNVALUE();
  1726. GLCLIENT_END
  1727. }
  1728. void APIENTRY glcltPrioritizeTextures(GLsizei n, const GLuint *textures,
  1729. const GLclampf *priorities)
  1730. {
  1731. GLCLIENT_BEGIN(PrioritizeTextures, PRIORITIZETEXTURES)
  1732. pMsg->n = n;
  1733. pMsg->textures = textures;
  1734. pMsg->priorities = priorities;
  1735. // Flush pointer
  1736. glsbAttention();
  1737. return;
  1738. GLCLIENT_END
  1739. }
  1740. void APIENTRY glcltTexSubImage1D(GLenum target, GLint level, GLint xoffset,
  1741. GLsizei width, GLenum format, GLenum type,
  1742. const GLvoid *pixels)
  1743. {
  1744. GLCLIENT_BEGIN_LARGE_SET(TexSubImage1D, TEXSUBIMAGE1D, pixels, width,
  1745. pixelsOff )
  1746. pMsg->target = target ;
  1747. pMsg->level = level ;
  1748. pMsg->xoffset = xoffset ;
  1749. pMsg->width = width ;
  1750. pMsg->format = format ;
  1751. pMsg->type = type ;
  1752. pMsg->_IsDlist = GL_FALSE ;
  1753. GLCLIENT_END_LARGE_SET
  1754. return;
  1755. }
  1756. void APIENTRY glcltTexSubImage2D(GLenum target, GLint level, GLint xoffset,
  1757. GLint yoffset, GLsizei width, GLsizei height,
  1758. GLenum format, GLenum type,
  1759. const GLvoid *pixels)
  1760. {
  1761. GLCLIENT_BEGIN_LARGE_SET(TexSubImage2D, TEXSUBIMAGE2D, pixels,
  1762. width*height, pixelsOff )
  1763. pMsg->target = target ;
  1764. pMsg->level = level ;
  1765. pMsg->xoffset = xoffset ;
  1766. pMsg->yoffset = yoffset ;
  1767. pMsg->width = width ;
  1768. pMsg->height = height ;
  1769. pMsg->format = format ;
  1770. pMsg->type = type ;
  1771. pMsg->_IsDlist = GL_FALSE ;
  1772. GLCLIENT_END_LARGE_SET
  1773. return;
  1774. }
  1775. void APIENTRY glcltColorTableEXT(GLenum target, GLenum internalFormat,
  1776. GLsizei width, GLenum format, GLenum type,
  1777. const GLvoid *data)
  1778. {
  1779. GLCLIENT_BEGIN(ColorTableEXT, COLORTABLEEXT)
  1780. pMsg->target = target;
  1781. pMsg->internalFormat = internalFormat;
  1782. pMsg->width = width;
  1783. pMsg->format = format;
  1784. pMsg->type = type;
  1785. pMsg->data = data;
  1786. pMsg->_IsDlist = GL_FALSE;
  1787. // Flush pointer
  1788. glsbAttention();
  1789. return;
  1790. GLCLIENT_END
  1791. }
  1792. void APIENTRY glcltColorSubTableEXT(GLenum target, GLsizei start,
  1793. GLsizei count,
  1794. GLenum format, GLenum type,
  1795. const GLvoid *data)
  1796. {
  1797. GLCLIENT_BEGIN(ColorSubTableEXT, COLORSUBTABLEEXT)
  1798. pMsg->target = target;
  1799. pMsg->start = start;
  1800. pMsg->count = count;
  1801. pMsg->format = format;
  1802. pMsg->type = type;
  1803. pMsg->data = data;
  1804. pMsg->_IsDlist = GL_FALSE;
  1805. // Flush pointer
  1806. glsbAttention();
  1807. return;
  1808. GLCLIENT_END
  1809. }
  1810. void APIENTRY glcltGetColorTableEXT(GLenum target,
  1811. GLenum format, GLenum type, GLvoid *data)
  1812. {
  1813. GLCLIENT_BEGIN(GetColorTableEXT, GETCOLORTABLEEXT)
  1814. pMsg->target = target;
  1815. pMsg->format = format;
  1816. pMsg->type = type;
  1817. pMsg->data = data;
  1818. glsbAttention();
  1819. return;
  1820. GLCLIENT_END
  1821. }
  1822. void APIENTRY glcltGetColorTableParameterivEXT( GLenum target, GLenum pname, GLint *params)
  1823. {
  1824. GLCLIENT_BEGIN(GetColorTableParameterivEXT, GETCOLORTABLEPARAMETERIVEXT)
  1825. pMsg->target = target;
  1826. pMsg->pname = pname;
  1827. pMsg->params = params;
  1828. glsbAttention();
  1829. return;
  1830. GLCLIENT_END
  1831. }
  1832. void APIENTRY glcltGetColorTableParameterfvEXT( GLenum target, GLenum pname, GLfloat *params)
  1833. {
  1834. GLCLIENT_BEGIN(GetColorTableParameterfvEXT, GETCOLORTABLEPARAMETERFVEXT)
  1835. pMsg->target = target;
  1836. pMsg->pname = pname;
  1837. pMsg->params = params;
  1838. glsbAttention();
  1839. return;
  1840. GLCLIENT_END
  1841. }
  1842. void APIENTRY glcltPolygonOffset(GLfloat factor, GLfloat units)
  1843. {
  1844. GLCLIENT_BEGIN(PolygonOffset, POLYGONOFFSET)
  1845. pMsg->factor = factor;
  1846. pMsg->units = units;
  1847. return;
  1848. GLCLIENT_END
  1849. }
  1850. void APIENTRY glcltPushClientAttrib (IN GLbitfield mask)
  1851. {
  1852. __GLclientAttribute **spp;
  1853. __GLclientAttribute *sp;
  1854. __GL_SETUP();
  1855. // Not allowed in begin/end.
  1856. if (gc->paTeb->flags & POLYARRAY_IN_BEGIN)
  1857. {
  1858. GLSETERROR(GL_INVALID_OPERATION);
  1859. return;
  1860. }
  1861. // The pixel store states are currently kept in the server, flush the
  1862. // command buffer to keep client and server in ssync.
  1863. if (mask & GL_CLIENT_PIXEL_STORE_BIT)
  1864. glsbAttention();
  1865. spp = gc->clientAttributes.stackPointer;
  1866. if (spp < &gc->clientAttributes.stack[gc->constants.maxClientAttribStackDepth])
  1867. {
  1868. if (!(sp = *spp))
  1869. {
  1870. sp = (__GLclientAttribute*)
  1871. GCALLOCZ(gc, sizeof(__GLclientAttribute));
  1872. if (NULL == sp)
  1873. return;
  1874. *spp = sp;
  1875. }
  1876. sp->mask = mask;
  1877. gc->clientAttributes.stackPointer = spp + 1;
  1878. if (mask & GL_CLIENT_PIXEL_STORE_BIT)
  1879. {
  1880. sp->pixelPackModes = gc->state.pixel.packModes;
  1881. sp->pixelUnpackModes = gc->state.pixel.unpackModes;
  1882. }
  1883. if (mask & GL_CLIENT_VERTEX_ARRAY_BIT)
  1884. {
  1885. sp->vertexArray = gc->vertexArray;
  1886. }
  1887. }
  1888. else
  1889. {
  1890. GLSETERROR(GL_STACK_OVERFLOW);
  1891. }
  1892. }
  1893. GLuint FASTCALL __glInternalPopClientAttrib(__GLcontext *gc, GLboolean bSync,
  1894. GLboolean destroy)
  1895. {
  1896. __GLclientAttribute **spp;
  1897. __GLclientAttribute *sp;
  1898. GLbitfield mask;
  1899. GLuint dirtyMask = 0;
  1900. spp = gc->clientAttributes.stackPointer;
  1901. if (spp > &gc->clientAttributes.stack[0])
  1902. {
  1903. --spp;
  1904. sp = *spp;
  1905. ASSERTOPENGL(sp != 0, "corrupted client stack");
  1906. mask = sp->mask;
  1907. gc->clientAttributes.stackPointer = spp;
  1908. // If this function is called by client side, flush the command buffer
  1909. // to keep client and server pixel store states in ssync.
  1910. // If it is called by the server side __glDestroyContext() function,
  1911. // do not flush the command buffer!
  1912. if ((mask & GL_CLIENT_PIXEL_STORE_BIT) && bSync)
  1913. glsbAttention();
  1914. if (mask & GL_CLIENT_PIXEL_STORE_BIT)
  1915. {
  1916. gc->state.pixel.packModes = sp->pixelPackModes;
  1917. gc->state.pixel.unpackModes = sp->pixelUnpackModes;
  1918. dirtyMask |= __GL_DIRTY_PIXEL;
  1919. }
  1920. if (mask & GL_CLIENT_VERTEX_ARRAY_BIT)
  1921. {
  1922. gc->vertexArray = sp->vertexArray;
  1923. }
  1924. /*
  1925. ** Clear out mask so that any memory frees done above won't get
  1926. ** re-done when the context is destroyed
  1927. */
  1928. sp->mask = 0;
  1929. }
  1930. else
  1931. {
  1932. GLSETERROR(GL_STACK_UNDERFLOW);
  1933. }
  1934. return dirtyMask;
  1935. }
  1936. void APIENTRY glcltPopClientAttrib (void)
  1937. {
  1938. GLuint dirtyMask;
  1939. __GL_SETUP();
  1940. // Not allowed in begin/end.
  1941. if (gc->paTeb->flags & POLYARRAY_IN_BEGIN)
  1942. {
  1943. GLSETERROR(GL_INVALID_OPERATION);
  1944. return;
  1945. }
  1946. dirtyMask = __glInternalPopClientAttrib(gc, GL_TRUE, GL_FALSE);
  1947. if (dirtyMask)
  1948. {
  1949. // __GL_DELAY_VALIDATE_MASK(gc, dirtyMask);
  1950. gc->beginMode = __GL_NEED_VALIDATE;
  1951. gc->dirtyMask |= dirtyMask;
  1952. }
  1953. }
  1954. #ifdef GL_EXT_flat_paletted_lighting
  1955. void APIPRIVATE __glim_ColorTableParameterivEXT(GLenum target,
  1956. GLenum pname,
  1957. const GLint *params);
  1958. void APIENTRY glColorTableParameterivEXT(GLenum target,
  1959. GLenum pname,
  1960. const GLint *params)
  1961. {
  1962. glsbAttention();
  1963. __glim_ColorTableParameterivEXT(target, pname, params);
  1964. }
  1965. void APIPRIVATE __glim_ColorTableParameterfvEXT(GLenum target,
  1966. GLenum pname,
  1967. const GLfloat *params);
  1968. void APIENTRY glColorTableParameterfvEXT(GLenum target,
  1969. GLenum pname,
  1970. const GLfloat *params)
  1971. {
  1972. glsbAttention();
  1973. __glim_ColorTableParameterfvEXT(target, pname, params);
  1974. }
  1975. #endif // GL_EXT_flat_paletted_lighting
  1976. #ifdef GL_WIN_multiple_textures
  1977. void APIENTRY glcltCurrentTextureIndexWIN
  1978. (GLuint index)
  1979. {
  1980. GLCLIENT_BEGIN(CurrentTextureIndexWIN, CURRENTTEXTUREINDEXWIN)
  1981. pMsg->index = index;
  1982. return;
  1983. GLCLIENT_END
  1984. }
  1985. void APIENTRY glcltBindNthTextureWIN
  1986. (GLuint index, GLenum target, GLuint texture)
  1987. {
  1988. GLCLIENT_BEGIN(BindNthTextureWIN, BINDNTHTEXTUREWIN)
  1989. pMsg->index = index;
  1990. pMsg->target = target;
  1991. pMsg->texture = texture;
  1992. return;
  1993. GLCLIENT_END
  1994. }
  1995. void APIENTRY glcltNthTexCombineFuncWIN
  1996. (GLuint index,
  1997. GLenum leftColorFactor, GLenum colorOp, GLenum rightColorFactor,
  1998. GLenum leftAlphaFactor, GLenum alphaOp, GLenum rightAlphaFactor)
  1999. {
  2000. GLCLIENT_BEGIN(NthTexCombineFuncWIN, NTHTEXCOMBINEFUNCWIN)
  2001. pMsg->index = index;
  2002. pMsg->leftColorFactor = leftColorFactor;
  2003. pMsg->colorOp = colorOp;
  2004. pMsg->rightColorFactor = rightColorFactor;
  2005. pMsg->leftAlphaFactor = leftAlphaFactor;
  2006. pMsg->alphaOp = alphaOp;
  2007. pMsg->rightAlphaFactor = rightAlphaFactor;
  2008. return;
  2009. GLCLIENT_END
  2010. }
  2011. #endif // GL_WIN_multiple_textures