GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
gsd_prim.c
Go to the documentation of this file.
1 
19 #include <stdlib.h>
20 #include <string.h>
21 
22 #include <grass/config.h>
23 
24 #if defined(OPENGL_X11) || defined(OPENGL_WINDOWS)
25 #include <GL/gl.h>
26 #include <GL/glu.h>
27 #elif defined(OPENGL_AQUA)
28 #include <OpenGL/gl.h>
29 #include <OpenGL/glu.h>
30 #endif
31 
32 #include <grass/gis.h>
33 #include <grass/gstypes.h>
34 #include <grass/glocale.h>
35 
36 #define USE_GL_NORMALIZE
37 
38 #define RED_MASK 0x000000FF
39 #define GRN_MASK 0x0000FF00
40 #define BLU_MASK 0x00FF0000
41 #define ALP_MASK 0xFF000000
42 
43 #define INT_TO_RED(i, r) (r = (i & RED_MASK))
44 #define INT_TO_GRN(i, g) (g = (i & GRN_MASK) >> 8)
45 #define INT_TO_BLU(i, b) (b = (i & BLU_MASK) >> 16)
46 #define INT_TO_ALP(i, a) (a = (i & ALP_MASK) >> 24)
47 
48 #define MAX_OBJS 64
49 /* ^ TMP - move to gstypes */
50 
51 /* define border width (pixels) for viewport check */
52 #define border 15
53 
54 static GLuint ObjList[MAX_OBJS];
55 static int numobjs = 0;
56 
57 static int Shade;
58 
59 static float ogl_light_amb[MAX_LIGHTS][4];
60 static float ogl_light_diff[MAX_LIGHTS][4];
61 static float ogl_light_spec[MAX_LIGHTS][4];
62 static float ogl_light_pos[MAX_LIGHTS][4];
63 static float ogl_mat_amb[4];
64 static float ogl_mat_diff[4];
65 static float ogl_mat_spec[4];
66 static float ogl_mat_emis[4];
67 static float ogl_mat_shin;
68 
74 void gsd_flush(void)
75 {
76  glFlush();
77 
78  return;
79 }
80 
88 void gsd_colormode(int cm)
89 {
90  switch (cm) {
91  case CM_COLOR:
92 
93  glDisable(GL_COLOR_MATERIAL);
94  glDisable(GL_LIGHTING);
95 
96  break;
97  case CM_EMISSION:
98 
99  glColorMaterial(GL_FRONT_AND_BACK, GL_EMISSION);
100  glEnable(GL_COLOR_MATERIAL);
101  glEnable(GL_LIGHTING);
102 
103  break;
104  case CM_DIFFUSE:
105 
106  glColorMaterial(GL_FRONT, GL_DIFFUSE);
107  glEnable(GL_COLOR_MATERIAL);
108  glEnable(GL_LIGHTING);
109 
110  break;
111  case CM_AD:
112 
113  glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);
114  glEnable(GL_COLOR_MATERIAL);
115  glEnable(GL_LIGHTING);
116 
117  break;
118  case CM_NULL:
119 
120  /* OGLXXX
121  * lmcolor: if LMC_NULL, use:
122  * glDisable(GL_COLOR_MATERIAL);
123  * LMC_NULL: use glDisable(GL_COLOR_MATERIAL);
124  */
125  glDisable(GL_COLOR_MATERIAL);
126  glEnable(GL_LIGHTING);
127 
128  break;
129  default:
130 
131  glDisable(GL_COLOR_MATERIAL);
132  break;
133  }
134 
135  return;
136 }
137 
141 void show_colormode(void)
142 {
143  GLint mat;
144 
145  glGetIntegerv(GL_COLOR_MATERIAL_PARAMETER, &mat);
146  G_message(_("Color Material: %d"), mat);
147 
148  return;
149 }
150 
157 void gsd_circ(float x, float y, float rad)
158 {
159  GLUquadricObj *qobj = gluNewQuadric();
160 
161  gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
162  glPushMatrix();
163  glTranslatef(x, y, 0.);
164  gluDisk(qobj, 0., rad, 32, 1);
165  glPopMatrix();
166  gluDeleteQuadric(qobj);
167 
168  return;
169 }
170 
177 void gsd_disc(float x, float y, float z, float rad)
178 {
179  GLUquadricObj *qobj = gluNewQuadric();
180 
181  gluQuadricDrawStyle(qobj, GLU_FILL);
182  glPushMatrix();
183  glTranslatef(x, y, z);
184  gluDisk(qobj, 0., rad, 32, 1);
185  glPopMatrix();
186  gluDeleteQuadric(qobj);
187 
188  return;
189 }
190 
197 void gsd_sphere(float *center, float siz)
198 {
199  static int first = 1;
200  static GLUquadricObj *QOsphere;
201 
202  if (first) {
203  QOsphere = gluNewQuadric();
204 
205  if (QOsphere) {
206  gluQuadricNormals(QOsphere, GLU_SMOOTH); /* default */
207  gluQuadricTexture(QOsphere, GL_FALSE); /* default */
208  gluQuadricOrientation(QOsphere, GLU_OUTSIDE); /* default */
209  gluQuadricDrawStyle(QOsphere, GLU_FILL);
210  }
211 
212  first = 0;
213  }
214 
215  glPushMatrix();
216  glTranslatef(center[0], center[1], center[2]);
217  gluSphere(QOsphere, (double)siz, 24, 24);
218  glPopMatrix();
219 
220  return;
221 }
222 
231 void gsd_zwritemask(unsigned long n)
232 {
233  /* OGLXXX glDepthMask is boolean only */
234  glDepthMask((GLboolean) (n));
235 
236  return;
237 }
238 
244 void gsd_backface(int n)
245 {
246  glCullFace(GL_BACK);
247  (n) ? glEnable(GL_CULL_FACE) : glDisable(GL_CULL_FACE);
248 
249  return;
250 }
251 
257 void gsd_linewidth(short n)
258 {
259  glLineWidth((GLfloat) (n));
260 
261  return;
262 }
263 
267 void gsd_bgnqstrip(void)
268 {
269  glBegin(GL_QUAD_STRIP);
270 
271  return;
272 }
273 
277 void gsd_endqstrip(void)
278 {
279  glEnd();
280 
281  return;
282 }
283 
287 void gsd_bgntmesh(void)
288 {
289  glBegin(GL_TRIANGLE_STRIP);
290 
291  return;
292 }
293 
297 void gsd_endtmesh(void)
298 {
299  glEnd();
300 
301  return;
302 }
303 
307 void gsd_bgntstrip(void)
308 {
309  glBegin(GL_TRIANGLE_STRIP);
310 
311  return;
312 }
313 
317 void gsd_endtstrip(void)
318 {
319  glEnd();
320 
321  return;
322 }
323 
327 void gsd_bgntfan(void)
328 {
329  glBegin(GL_TRIANGLE_FAN);
330 
331  return;
332 }
333 
337 void gsd_endtfan(void)
338 {
339  glEnd();
340 
341  return;
342 }
343 
347 void gsd_swaptmesh(void)
348 {
349  /* OGLXXX
350  * swaptmesh not supported, maybe glBegin(GL_TRIANGLE_FAN)
351  * swaptmesh()
352  */
353 
354  /*DELETED*/;
355 
356  return;
357 }
358 
362 void gsd_bgnpolygon(void)
363 {
364  /* OGLXXX
365  * special cases for polygons:
366  * independant quads: use GL_QUADS
367  * independent triangles: use GL_TRIANGLES
368  */
369  glBegin(GL_POLYGON);
370 
371  return;
372 }
373 
377 void gsd_endpolygon(void)
378 {
379  glEnd();
380 
381  return;
382 }
383 
387 void gsd_bgnline(void)
388 {
389  /* OGLXXX for multiple, independent line segments: use GL_LINES */
390  glBegin(GL_LINE_STRIP);
391  return;
392 }
393 
397 void gsd_endline(void)
398 {
399  glEnd();
400 
401  return;
402 }
403 
409 void gsd_shademodel(int bool)
410 {
411  Shade = bool;
412 
413  if (bool) {
414  glShadeModel(GL_SMOOTH);
415  }
416  else {
417  glShadeModel(GL_FLAT);
418  }
419 
420  return;
421 }
422 
429 {
430  return (Shade);
431 }
432 
436 void gsd_bothbuffer(void)
437 {
438  /* OGLXXX frontbuffer: other possibilities include GL_FRONT_AND_BACK */
439  glDrawBuffer(GL_FRONT_AND_BACK);
440 
441  return;
442 }
443 
450 void gsd_frontbuffer(int bool)
451 {
452  /* OGLXXX frontbuffer: other possibilities include GL_FRONT_AND_BACK */
453  glDrawBuffer((bool) ? GL_FRONT : GL_BACK);
454 
455  return;
456 }
457 
464 void gsd_backbuffer(int bool)
465 {
466  /* OGLXXX backbuffer: other possibilities include GL_FRONT_AND_BACK */
467  glDrawBuffer((bool) ? GL_BACK : GL_FRONT);
468  return;
469 }
470 
474 void gsd_swapbuffers(void)
475 {
476  /* OGLXXX swapbuffers:
477  glXSwapBuffers(*display, window);
478  replace display and window */
479 
480  Swap_func();
481 
482  return;
483 }
484 
488 void gsd_popmatrix(void)
489 {
490  glPopMatrix();
491 
492  return;
493 }
494 
498 void gsd_pushmatrix(void)
499 {
500  glPushMatrix();
501 
502  return;
503 }
504 
512 void gsd_scale(float xs, float ys, float zs)
513 {
514  glScalef(xs, ys, zs);
515 
516  return;
517 }
518 
526 void gsd_translate(float dx, float dy, float dz)
527 {
528  glTranslatef(dx, dy, dz);
529 
530  return;
531 }
532 
541 void gsd_getwindow(int *window, int *viewport, double *modelMatrix,
542  double *projMatrix)
543 {
544  gsd_pushmatrix();
545  gsd_do_scale(1);
546 
547  glGetDoublev(GL_MODELVIEW_MATRIX, modelMatrix);
548  glGetDoublev(GL_PROJECTION_MATRIX, projMatrix);
549  glGetIntegerv(GL_VIEWPORT, viewport);
550  gsd_popmatrix();
551 
552  window[0] = viewport[1] + viewport[3] + border;
553  window[1] = viewport[1] - border;
554  window[2] = viewport[0] - border;
555  window[3] = viewport[0] + viewport[2] + border;
556 
557  return;
558 
559 }
560 
573 int gsd_checkpoint(float pt[4],
574  int window[4],
575  int viewport[4],
576  double modelMatrix[16], double projMatrix[16])
577 {
578  GLdouble fx, fy, fz;
579 
580  gluProject((GLdouble) pt[X], (GLdouble) pt[Y], (GLdouble) pt[Z],
581  modelMatrix, projMatrix, viewport, &fx, &fy, &fz);
582 
583  if (fx < window[2] || fx > window[3]
584  || fy < window[1] || fy > window[0])
585  return 1;
586  else
587  return 0;
588 
589 }
590 
597 void gsd_rot(float angle, char axis)
598 {
599  GLfloat x;
600  GLfloat y;
601  GLfloat z;
602 
603  switch (axis) {
604  case 'x':
605  case 'X':
606 
607  x = 1.0;
608  y = 0.0;
609  z = 0.0;
610 
611  break;
612  case 'y':
613  case 'Y':
614 
615  x = 0.0;
616  y = 1.0;
617  z = 0.0;
618 
619  break;
620  case 'z':
621  case 'Z':
622 
623  x = 0.0;
624  y = 0.0;
625  z = 1.0;
626 
627  break;
628  default:
629 
630  G_warning(_("gsd_rot(): %c is an invalid axis "
631  "specification. Rotation ignored. "
632  "Please advise GRASS developers of this error"), axis);
633  return;
634  }
635 
636  glRotatef((GLfloat) angle, x, y, z);
637 
638  return;
639 }
640 
648 void gsd_litvert_func(float *norm, unsigned long col, float *pt)
649 {
650  glNormal3fv(norm);
651  gsd_color_func(col);
652  glVertex3fv(pt);
653 
654  return;
655 }
656 
664 void gsd_litvert_func2(float *norm, unsigned long col, float *pt)
665 {
666  glNormal3fv(norm);
667  glVertex3fv(pt);
668 
669  return;
670 }
671 
677 void gsd_vert_func(float *pt)
678 {
679  glVertex3fv(pt);
680 
681  return;
682 }
683 
689 void gsd_color_func(unsigned int col)
690 {
691  GLbyte r, g, b, a;
692 
693  /* OGLXXX
694  * cpack: if argument is not a variable
695  * might need to be:
696  * glColor4b(($1)&0xff, ($1)>>8&0xff, ($1)>>16&0xff, ($1)>>24&0xff)
697  */
698  INT_TO_RED(col, r);
699  INT_TO_GRN(col, g);
700  INT_TO_BLU(col, b);
701  INT_TO_ALP(col, a);
702  glColor4ub(r, g, b, a);
703 
704  return;
705 }
706 
711 {
712 
713  glEnable(GL_LIGHTING);
714 
715  /* normal vector renormalization */
716 #ifdef USE_GL_NORMALIZE
717  {
718  glEnable(GL_NORMALIZE);
719  }
720 #endif
721 
722  /* OGLXXX
723  * Ambient:
724  * If this is a light model lmdef, then use
725  * glLightModelf and GL_LIGHT_MODEL_AMBIENT.
726  * Include ALPHA parameter with ambient
727  */
728 
729  /* Default is front face lighting, infinite viewer
730  */
731  ogl_mat_amb[0] = 0.1;
732  ogl_mat_amb[1] = 0.1;
733  ogl_mat_amb[2] = 0.1;
734  ogl_mat_amb[3] = 1.0;
735 
736  ogl_mat_diff[0] = 0.8;
737  ogl_mat_diff[1] = 0.8;
738  ogl_mat_diff[2] = 0.8;
739  ogl_mat_diff[3] = 0.8;
740 
741  ogl_mat_spec[0] = 0.8;
742  ogl_mat_spec[1] = 0.8;
743  ogl_mat_spec[2] = 0.8;
744  ogl_mat_spec[3] = 0.8;
745 
746  ogl_mat_emis[0] = 0.0;
747  ogl_mat_emis[1] = 0.0;
748  ogl_mat_emis[2] = 0.0;
749  ogl_mat_emis[3] = 0.0;
750 
751  ogl_mat_shin = 25.0;
752 
753  /* OGLXXX
754  * attenuation: see glLightf man page: (ignored for infinite lights)
755  * Add GL_LINEAR_ATTENUATION.
756  sgi_lmodel[0] = GL_CONSTANT_ATTENUATION;
757  sgi_lmodel[1] = 1.0;
758  sgi_lmodel[2] = 0.0;
759  sgi_lmodel[3] = ;
760  */
761 
762  /* OGLXXX
763  * lmdef other possibilities include:
764  * glLightf(light, pname, *params);
765  * glLightModelf(pname, param);
766  * Check list numbering.
767  * Translate params as needed.
768  */
769  glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, ogl_mat_amb);
770  glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, ogl_mat_diff);
771  glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, ogl_mat_spec);
772  glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, ogl_mat_emis);
773  glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, ogl_mat_shin);
774 
775  /* OGLXXX lmbind: check object numbering. */
776  /* OGLXXX
777  * lmbind: check object numbering.
778  * Use GL_FRONT in call to glMaterialf.
779  * Use GL_FRONT in call to glMaterialf.
780  if(1) {glCallList(1); glEnable(LMODEL);} else glDisable(LMODEL);
781  if(1) {glCallList(1); glEnable(GL_FRONT);} else glDisable(GL_FRONT);
782  */
783 
784  return;
785 }
786 
794 void gsd_set_material(int set_shin, int set_emis, float sh, float em,
795  int emcolor)
796 {
797  if (set_shin) {
798  ogl_mat_spec[0] = sh;
799  ogl_mat_spec[1] = sh;
800  ogl_mat_spec[2] = sh;
801  ogl_mat_spec[3] = sh;
802 
803  glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, ogl_mat_spec);
804 
805  ogl_mat_shin = 60. + (int)(sh * 68.);
806 
807  glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, ogl_mat_shin);
808  }
809 
810  if (set_emis) {
811  ogl_mat_emis[0] = (em * (emcolor & 0x0000FF)) / 255.;
812  ogl_mat_emis[1] = (em * ((emcolor & 0x00FF00) >> 8)) / 255.;
813  ogl_mat_emis[2] = (em * ((emcolor & 0xFF0000) >> 16)) / 255.;
814 
815  glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, ogl_mat_emis);
816  }
817 
818  return;
819 }
820 
827 void gsd_deflight(int num, struct lightdefs *vals)
828 {
829  if (num > 0 && num <= MAX_LIGHTS) {
830  ogl_light_pos[num - 1][0] = vals->position[X];
831  ogl_light_pos[num - 1][1] = vals->position[Y];
832  ogl_light_pos[num - 1][2] = vals->position[Z];
833  ogl_light_pos[num - 1][3] = vals->position[W];
834 
835  glLightfv(GL_LIGHT0 + num, GL_POSITION, ogl_light_pos[num - 1]);
836 
837  ogl_light_diff[num - 1][0] = vals->color[0];
838  ogl_light_diff[num - 1][1] = vals->color[1];
839  ogl_light_diff[num - 1][2] = vals->color[2];
840  ogl_light_diff[num - 1][3] = .3;
841 
842  glLightfv(GL_LIGHT0 + num, GL_DIFFUSE, ogl_light_diff[num - 1]);
843 
844  ogl_light_amb[num - 1][0] = vals->ambient[0];
845  ogl_light_amb[num - 1][1] = vals->ambient[1];
846  ogl_light_amb[num - 1][2] = vals->ambient[2];
847  ogl_light_amb[num - 1][3] = .3;
848 
849  glLightfv(GL_LIGHT0 + num, GL_AMBIENT, ogl_light_amb[num - 1]);
850 
851  ogl_light_spec[num - 1][0] = vals->color[0];
852  ogl_light_spec[num - 1][1] = vals->color[1];
853  ogl_light_spec[num - 1][2] = vals->color[2];
854  ogl_light_spec[num - 1][3] = .3;
855 
856  glLightfv(GL_LIGHT0 + num, GL_SPECULAR, ogl_light_spec[num - 1]);
857  }
858 
859  return;
860 }
861 
868 void gsd_switchlight(int num, int on)
869 {
870  short defin;
871 
872  defin = on ? num : 0;
873 
874  if (defin) {
875  glEnable(GL_LIGHT0 + num);
876  }
877  else {
878  glDisable(GL_LIGHT0 + num);
879  }
880 
881  return;
882 }
883 
893 int gsd_getimage(unsigned char **pixbuf, unsigned int *xsize,
894  unsigned int *ysize)
895 {
896  GLuint l, r, b, t;
897 
898  /* OGLXXX
899  * get GL_VIEWPORT:
900  * You can probably do better than this.
901  */
902  GLint tmp[4];
903 
904  glGetIntegerv(GL_VIEWPORT, tmp);
905  l = tmp[0];
906  r = tmp[0] + tmp[2] - 1;
907  b = tmp[1];
908  t = tmp[1] + tmp[3] - 1;
909 
910  *xsize = r - l + 1;
911  *ysize = t - b + 1;
912 
913  *pixbuf = (unsigned char *)G_malloc((*xsize) * (*ysize) * 4); /* G_fatal_error */
914 
915  if (!*pixbuf)
916  return (0);
917 
918  glReadBuffer(GL_FRONT);
919 
920  /* OGLXXX lrectread: see man page for glReadPixels */
921  glReadPixels(l, b, (r) - (l) + 1, (t) - (b) + 1, GL_RGBA,
922  GL_UNSIGNED_BYTE, *pixbuf);
923 
924  return (1);
925 }
926 
935 int gsd_getViewport(GLint tmp[4], GLint num[2])
936 {
937 
938  /* Save current viewport to tmp */
939  glGetIntegerv(GL_VIEWPORT, tmp);
940  glGetIntegerv(GL_MAX_VIEWPORT_DIMS, num);
941 
942  return (1);
943 }
944 
951 int gsd_writeView(unsigned char **pixbuf, unsigned int xsize,
952  unsigned int ysize)
953 {
954 
955  /* Malloc Buffer for image */
956  *pixbuf = (unsigned char *)G_malloc(xsize * ysize * 4); /* G_fatal_error */
957  if (!*pixbuf) {
958  return (0);
959  }
960 
961  /* Read image buffer */
962  glReadBuffer(GL_FRONT);
963 
964  /* Read Pixels into Buffer */
965  glReadPixels(0, 0, xsize, ysize, GL_RGBA, GL_UNSIGNED_BYTE, *pixbuf);
966  return (1);
967 }
968 
974 void gsd_blend(int yesno)
975 {
976  if (yesno) {
977  glEnable(GL_BLEND);
978  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
979  }
980  else {
981  glDisable(GL_BLEND);
982  glBlendFunc(GL_ONE, GL_ZERO);
983  }
984 
985  return;
986 }
987 
994 void gsd_def_clipplane(int num, double *params)
995 {
996  int wason = 0;
997 
998  /* OGLXXX see man page for glClipPlane equation */
999  if (glIsEnabled(GL_CLIP_PLANE0 + (num))) {
1000  wason = 1;
1001  }
1002 
1003  glClipPlane(GL_CLIP_PLANE0 + (num), params);
1004 
1005  if (wason) {
1006  glEnable(GL_CLIP_PLANE0 + (num));
1007  }
1008  else {
1009  glDisable(GL_CLIP_PLANE0 + (num));
1010  }
1011 
1012  return;
1013 }
1014 
1021 void gsd_set_clipplane(int num, int able)
1022 {
1023  /* OGLXXX see man page for glClipPlane equation */
1024  if (able) {
1025  glEnable(GL_CLIP_PLANE0 + (num));
1026  }
1027  else {
1028  glDisable(GL_CLIP_PLANE0 + (num));
1029  }
1030 
1031  return;
1032 }
1033 
1039 void gsd_finish(void)
1040 {
1041  return;
1042 }
1043 
1057 void gsd_viewport(int l, int r, int b, int t)
1058 {
1059  /* Screencoord */
1060  glViewport(l, b, r, t);
1061 
1062  return;
1063 }
1064 
1074 int gsd_makelist(void)
1075 {
1076  int i;
1077 
1078  if (numobjs) {
1079  if (numobjs < MAX_OBJS) {
1080  numobjs++;
1081 
1082  return (numobjs);
1083  }
1084 
1085  return (-1);
1086  }
1087  else {
1088  ObjList[0] = glGenLists(MAX_OBJS);
1089 
1090  for (i = 1; i < MAX_OBJS; i++) {
1091  ObjList[i] = ObjList[0] + i;
1092  }
1093  numobjs = 1;
1094 
1095  return (numobjs);
1096  }
1097 
1098 }
1099 
1106 void gsd_bgnlist(int listno, int do_draw)
1107 {
1108  if (do_draw) {
1109  glNewList(ObjList[listno], GL_COMPILE_AND_EXECUTE);
1110  }
1111  else {
1112  glNewList(ObjList[listno], GL_COMPILE);
1113  }
1114 
1115  return;
1116 }
1117 
1121 void gsd_endlist(void)
1122 {
1123  glEndList();
1124 
1125  return;
1126 }
1127 
1134 void gsd_deletelist(GLuint listno, int range)
1135 {
1136  unsigned int i;
1137 
1138  for (i = 1; i < MAX_OBJS; i++) {
1139  if (i == listno) {
1140  glDeleteLists(ObjList[i], 1);
1141  numobjs--;
1142  if (numobjs < 1)
1143  numobjs = 1;
1144  return;
1145  }
1146  }
1147 }
1148 
1154 void gsd_calllist(int listno)
1155 {
1156  glCallList(ObjList[listno]);
1157 
1158  return;
1159 }
1160 
1161 
1167 void gsd_calllists(int listno)
1168 {
1169  int i;
1170 
1171  gsd_pushmatrix();
1172  for (i = 1; i < MAX_OBJS; i++) {
1173  glCallList(ObjList[i]);
1174  glFlush();
1175  }
1176  gsd_popmatrix();
1177 
1178  gsd_call_label();
1179 
1180  return;
1181 }
void gsd_zwritemask(unsigned long n)
Write out z-mask.
Definition: gsd_prim.c:231
void gsd_endtstrip(void)
ADD.
Definition: gsd_prim.c:317
void gsd_calllist(int listno)
ADD.
Definition: gsd_prim.c:1154
int l
Definition: dataquad.c:292
float b
Definition: named_colr.c:8
void gsd_endlist(void)
End list.
Definition: gsd_prim.c:1121
void gsd_endqstrip(void)
ADD.
Definition: gsd_prim.c:277
void gsd_bgntmesh(void)
ADD.
Definition: gsd_prim.c:287
void gsd_circ(float x, float y, float rad)
ADD.
Definition: gsd_prim.c:157
void gsd_def_clipplane(int num, double *params)
Define clip plane.
Definition: gsd_prim.c:994
void gsd_do_scale(int doexag)
Set current scale.
Definition: gsd_views.c:355
#define INT_TO_ALP(i, a)
Definition: gsd_prim.c:46
void gsd_sphere(float *center, float siz)
ADD.
Definition: gsd_prim.c:197
int gsd_makelist(void)
ADD.
Definition: gsd_prim.c:1074
float r
Definition: named_colr.c:8
void gsd_bgnpolygon(void)
Delimit the vertices of a primitive or a group of like primitives.
Definition: gsd_prim.c:362
void gsd_set_material(int set_shin, int set_emis, float sh, float em, int emcolor)
Set material.
Definition: gsd_prim.c:794
long num
Definition: g3dcats.c:93
#define Y(x)
Definition: display/draw.c:246
void gsd_colormode(int cm)
Set color mode.
Definition: gsd_prim.c:88
#define INT_TO_RED(i, r)
Definition: gsd_prim.c:43
#define X(y)
Definition: display/draw.c:248
void gsd_color_func(unsigned int col)
Set current color.
Definition: gsd_prim.c:689
int y
Definition: plot.c:34
void gsd_endtmesh(void)
ADD.
Definition: gsd_prim.c:297
void gsd_translate(float dx, float dy, float dz)
Multiply the current matrix by a translation matrix.
Definition: gsd_prim.c:526
void gsd_finish(void)
Finish.
Definition: gsd_prim.c:1039
void gsd_litvert_func(float *norm, unsigned long col, float *pt)
Set the current normal vector &amp; specify vertex.
Definition: gsd_prim.c:648
void gsd_shademodel(int bool)
Set shaded model.
Definition: gsd_prim.c:409
void gsd_call_label(void)
Call display list and draw defined labels – called from gsd_prim (gsd_call_lists) ...
Definition: gsd_label.c:122
void gsd_swaptmesh(void)
ADD.
Definition: gsd_prim.c:347
void gsd_bgntfan(void)
ADD.
Definition: gsd_prim.c:327
void gsd_pushmatrix(void)
Push the current matrix stack.
Definition: gsd_prim.c:498
void gsd_bgnqstrip(void)
ADD.
Definition: gsd_prim.c:267
#define INT_TO_GRN(i, g)
Definition: gsd_prim.c:44
#define MAX_OBJS
Definition: gsd_prim.c:48
void gsd_backface(int n)
ADD.
Definition: gsd_prim.c:244
void gsd_bgnlist(int listno, int do_draw)
ADD.
Definition: gsd_prim.c:1106
void gsd_backbuffer(int bool)
Specify which color buffers are to be drawn into.
Definition: gsd_prim.c:464
void gsd_endline(void)
End line.
Definition: gsd_prim.c:397
void G_message(const char *msg,...)
Print a message to stderr.
Definition: lib/gis/error.c:74
void gsd_switchlight(int num, int on)
Switch light on/off.
Definition: gsd_prim.c:868
tuple window
Definition: tools.py:543
void gsd_endtfan(void)
ADD.
Definition: gsd_prim.c:337
int gsd_checkpoint(float pt[4], int window[4], int viewport[4], double modelMatrix[16], double projMatrix[16])
ADD.
Definition: gsd_prim.c:573
void gsd_getwindow(int *window, int *viewport, double *modelMatrix, double *projMatrix)
Get viewport.
Definition: gsd_prim.c:541
#define INT_TO_BLU(i, b)
Definition: gsd_prim.c:45
void gsd_deletelist(GLuint listno, int range)
Delete list.
Definition: gsd_prim.c:1134
float g
Definition: named_colr.c:8
void gsd_disc(float x, float y, float z, float rad)
ADD.
Definition: gsd_prim.c:177
void gsd_rot(float angle, char axis)
ADD.
Definition: gsd_prim.c:597
int
Definition: g3dcolor.c:48
void gsd_swapbuffers(void)
Swap buffers.
Definition: gsd_prim.c:474
void gsd_blend(int yesno)
Specify pixel arithmetic.
Definition: gsd_prim.c:974
void gsd_litvert_func2(float *norm, unsigned long col, float *pt)
ADD.
Definition: gsd_prim.c:664
#define border
Definition: gsd_prim.c:52
int first
Definition: form/open.c:25
void gsd_frontbuffer(int bool)
Specify which color buffers are to be drawn into.
Definition: gsd_prim.c:450
void gsd_vert_func(float *pt)
ADD.
Definition: gsd_prim.c:677
void gsd_viewport(int l, int r, int b, int t)
Set the viewport.
Definition: gsd_prim.c:1057
void gsd_init_lightmodel(void)
Initialize model light.
Definition: gsd_prim.c:710
void gsd_endpolygon(void)
Delimit the vertices of a primitive or a group of like primitives.
Definition: gsd_prim.c:377
G_warning("category support for [%s] in mapset [%s] %s", name, mapset, type)
void show_colormode(void)
Print color mode to stderr.
Definition: gsd_prim.c:141
tuple axis
Definition: tools.py:1597
void gsd_bgntstrip(void)
ADD.
Definition: gsd_prim.c:307
void gsd_linewidth(short n)
Set width of rasterized lines.
Definition: gsd_prim.c:257
void(* Swap_func)()
Definition: GSX.c:22
void gsd_bothbuffer(void)
ADD.
Definition: gsd_prim.c:436
void gsd_flush(void)
Mostly for flushing drawing commands accross a network.
Definition: gsd_prim.c:74
int gsd_getimage(unsigned char **pixbuf, unsigned int *xsize, unsigned int *ysize)
Get image of current GL screen.
Definition: gsd_prim.c:893
int gsd_getViewport(GLint *, GLint *)
void gsd_popmatrix(void)
Pop the current matrix stack.
Definition: gsd_prim.c:488
int gsd_getshademodel(void)
Get shaded model.
Definition: gsd_prim.c:428
int gsd_writeView(unsigned char **pixbuf, unsigned int xsize, unsigned int ysize)
Write view.
Definition: gsd_prim.c:951
tuple range
Definition: tools.py:1406
void gsd_deflight(int num, struct lightdefs *vals)
Define light.
Definition: gsd_prim.c:827
void gsd_scale(float xs, float ys, float zs)
Multiply the current matrix by a general scaling matrix.
Definition: gsd_prim.c:512
void gsd_bgnline(void)
Begin line.
Definition: gsd_prim.c:387
int n
Definition: dataquad.c:291
void gsd_calllists(int listno)
ADD.
Definition: gsd_prim.c:1167
void gsd_set_clipplane(int num, int able)
Set clip plane.
Definition: gsd_prim.c:1021