Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/visualization/OpenInventor/src/SoMarkerSet.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  1 //
  2 // ********************************************************************
  3 // * License and Disclaimer                                           *
  4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.                             *
 10 // *                                                                  *
 11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                                                  *
 18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // ********************************************************************
 25 //
 26 
 27 /*----------------------------HEPVis----------------------------------------*/
 28 /*                                                                          */
 29 /* Node:             SoMarkerSet                                            */
 30 /* Author:           Guy Barrand                                            */
 31 /*                                                                          */
 32 /*--------------------------------------------------------------------------*/
 33 
 34 // this :
 35 #include <HEPVis/nodes/SoMarkerSet.h>
 36 
 37 #include <Inventor/errors/SoDebugError.h>
 38 #include <Inventor/misc/SoState.h>
 39 #include <Inventor/actions/SoGLRenderAction.h>
 40 #include <Inventor/nodes/SoPointSet.h>
 41 
 42 #include <Inventor/elements/SoCoordinateElement.h>
 43 #include <Inventor/elements/SoCacheElement.h>
 44 #include <Inventor/elements/SoLazyElement.h>
 45 
 46 #include <HEPVis/SbGL.h>
 47 #include <HEPVis/actions/SoGL2PSAction.h>
 48 
 49 static void drawMarker(SoAction*,int);
 50 static GLubyte* getBitmap(int,int,char []); 
 51 
 52 /* 
 53   "  x  "
 54   "  x  "
 55   "xxxxx"
 56   "  x  "
 57   "  x  "
 58 
 59   Should produce bitmap :
 60   0x20,0x20,0xf8,0x20,0x20
 61 
 62   The rows will be rendered down to top ; first row at bottom, last at top.
 63   In the below, '-' means that glBitmap will move the pointer to next byte.
 64 
 65   32103210 32103210 32103210 32103210 32103210
 66   ..1..--- ..1..--- 11111--- ..1..--- ..1..---
 67 
 68   0x20     0x20     0xf8     0x20     0x20
 69 */
 70 
 71 ///////////////////////////////////////////////////////////////
 72 /// 5 5 ///////////////////////////////////////////////////////
 73 ///////////////////////////////////////////////////////////////
 74 static char plus_5_5[] = {
 75   "  x  "
 76   "  x  "
 77   "xxxxx"
 78   "  x  "
 79   "  x  "
 80 };
 81 static char asterisk_5_5[] = {
 82   "x x x"
 83   " xxx "
 84   "  x  "
 85   " xxx "
 86   "x x x"
 87 };
 88 static char cross_5_5[] = {
 89   "x   x"
 90   " x x "
 91   "  x  "
 92   " x x "
 93   "x   x"
 94 };
 95 static char star_5_5[] = {
 96   "x x x"
 97   " xxx "
 98   "xxxxx"
 99   " xxx "
100   "x x x"
101 };
102 static char circle_line_5_5[] = {
103   " xxx "
104   "x   x"
105   "x   x"
106   "x   x"
107   " xxx "
108 };       
109 static char circle_filled_5_5[] = {
110   " xxx "
111   "xxxxx"
112   "xxxxx"
113   "xxxxx"
114   " xxx "
115 };       
116 static char triangle_up_line_5_5[] = { //OpenGL will draw with y reversed.
117   "xxxxx"
118   " x x "
119   " x x "
120   "  x  "
121   "  x  "
122 };
123 static char triangle_up_filled_5_5[] = {
124   "xxxxx"
125   " xxx "
126   " xxx "
127   "  x  "
128   "  x  "
129 };
130 static char triangle_down_line_5_5[] = {
131   "  x  "
132   "  x  "
133   " x x "
134   " x x "
135   "xxxxx"
136 };
137 static char triangle_down_filled_5_5[] = {
138   "  x  "
139   "  x  "
140   " xxx "
141   " xxx "
142   "xxxxx"
143 };
144 static char david_star_line_5_5[] = {
145   "  x  "
146   "xxxxx"
147   " x x "
148   "xxxxx"
149   "  x  "
150 };       
151 static char david_star_filled_5_5[] = {
152   "  x  "
153   "xxxxx"
154   " xxx "
155   "xxxxx"
156   "  x  "
157 };       
158 static char swiss_cross_line_5_5[] = {
159   " xxx "
160   "xx xx"
161   "x   x"
162   "xx xx"
163   " xxx "
164 };       
165 static char swiss_cross_filled_5_5[] = {
166   " xxx "
167   "xxxxx"
168   "xxxxx"
169   "xxxxx"
170   " xxx "
171 };       
172 static char diamond_line_5_5[] = {
173   "  x  "
174   " x x "
175   "x   x"
176   " x x "
177   "  x  "
178 };
179 static char diamond_filled_5_5[] = {
180   "  x  "
181   " xxx "
182   "xxxxx"
183   " xxx "
184   "  x  "
185 };
186 static char square_line_5_5[] = {
187   "xxxxx"
188   "x   x"
189   "x   x"
190   "x   x"
191   "xxxxx"
192 };
193 static char square_filled_5_5[] = {
194   "xxxxx"
195   "xxxxx"
196   "xxxxx"
197   "xxxxx"
198   "xxxxx"
199 };
200 ///////////////////////////////////////////////////////////////
201 /// 7 7 ///////////////////////////////////////////////////////
202 ///////////////////////////////////////////////////////////////
203 static char plus_7_7[] = {
204   "   x   "
205   "   x   "
206   "   x   "
207   "xxxxxxx"
208   "   x   "
209   "   x   "
210   "   x   "
211 };
212 static char asterisk_7_7[] = {
213   "x  x  x"
214   " x x x "
215   "  xxx  "
216   "   x   "
217   "  xxx  "
218   " x x x "
219   "x  x  x"
220 };
221 static char cross_7_7[] = {
222   "x     x"
223   " x   x "
224   "  xxx  "
225   "   x   "
226   "  xxx  "
227   " x   x "
228   "x     x"
229 };
230 static char star_7_7[] = {
231   "x  x  x"
232   " x x x "
233   "  xxx  "
234   "xxxxxxx"
235   "  xxx  "
236   " x x x "
237   "x  x  x"
238 };
239 static char circle_line_7_7[] = {
240   " xxxxx "
241   "x     x"
242   "x     x"
243   "x     x"
244   "x     x"
245   "x     x"
246   " xxxxx "
247 };       
248 static char circle_filled_7_7[] = {
249   " xxxxx "
250   "xxxxxxx"
251   "xxxxxxx"
252   "xxxxxxx"
253   "xxxxxxx"
254   "xxxxxxx"
255   " xxxxx "
256 };       
257 static char triangle_up_line_7_7[] = { //OpenGL will draw with y reversed.
258   "xxxxxxx"
259   " x   x "
260   " x   x "
261   "  x x  "
262   "  x x  "
263   "   x   "
264   "   x   "
265 };
266 static char triangle_up_filled_7_7[] = {
267   "xxxxxxx"
268   " xxxxx "
269   " xxxxx "
270   "  xxx  "
271   "  xxx  "
272   "   x   "
273   "   x   "
274 };
275 static char triangle_down_line_7_7[] = {
276   "   x   "
277   "   x   "
278   "  x x  "
279   "  x x  "
280   " x   x "
281   " x   x "
282   "xxxxxxx"
283 };
284 static char triangle_down_filled_7_7[] = {
285   "   x   "
286   "   x   "
287   "  xxx  "
288   "  xxx  "
289   " xxxxx "
290   " xxxxx "
291   "xxxxxxx"
292 };
293 static char david_star_line_7_7[] = {
294   "   x   "
295   "xxxxxxx"
296   " x   x "
297   "  x x  "
298   " x   x "
299   "xxxxxxx"
300   "   x   "
301 };       
302 static char david_star_filled_7_7[] = {
303   "   x   "
304   "xxxxxxx"
305   " xxxxx "
306   "  xxx  "
307   " xxxxx "
308   "xxxxxxx"
309   "   x   "
310 };       
311 static char swiss_cross_line_7_7[] = {
312   "  xxx  "
313   "  x x  "
314   "xxx xxx"
315   "x     x"
316   "xxx xxx"
317   "  x x  "
318   "  xxx  "
319 };       
320 static char swiss_cross_filled_7_7[] = {
321   "  xxx  "
322   "  xxx  "
323   "xxxxxxx"
324   "xxxxxxx"
325   "xxxxxxx"
326   "  xxx  "
327   "  xxx  "
328 };       
329 static char diamond_line_7_7[] = {
330   "   x   "
331   "  x x  "
332   " x   x "
333   "x     x"
334   " x   x "
335   "  x x  "
336   "   x   "
337 };
338 static char diamond_filled_7_7[] = {
339   "   x   "
340   "  xxx  "
341   " xxxxx "
342   "xxxxxxx"
343   " xxxxx "
344   "  xxx  "
345   "   x   "
346 };
347 static char square_line_7_7[] = {
348   "xxxxxxx"
349   "x     x"
350   "x     x"
351   "x     x"
352   "x     x"
353   "x     x"
354   "xxxxxxx"
355 };
356 static char square_filled_7_7[] = {
357   "xxxxxxx"
358   "xxxxxxx"
359   "xxxxxxx"
360   "xxxxxxx"
361   "xxxxxxx"
362   "xxxxxxx"
363   "xxxxxxx"
364 };
365 
366 ///////////////////////////////////////////////////////////////
367 /// 9 9 ///////////////////////////////////////////////////////
368 ///////////////////////////////////////////////////////////////
369 static char plus_9_9[] = {
370   "    x    "
371   "    x    "
372   "    x    "
373   "    x    "
374   "xxxxxxxxx"
375   "    x    "
376   "    x    "
377   "    x    "
378   "    x    "
379 };
380 static char asterisk_9_9[] = {
381   "x   x   x"
382   " x  x  x "
383   "  x x x  "
384   "   xxx   "
385   "    x    "
386   "   xxx   "
387   "  x x x  "
388   " x  x  x "
389   "x   x   x"
390 };
391 static char cross_9_9[] = {
392   "x       x"
393   " x     x "
394   "  x   x  "
395   "   x x   "
396   "    x    "
397   "   x x   "
398   "  x   x  "
399   " x     x "
400   "x       x"
401 };
402 static char star_9_9[] = {
403   "x   x   x"
404   " x  x  x "
405   "  x x x  "
406   "   xxx   "
407   "xxxxxxxxx"
408   "   xxx   "
409   "  x x x  "
410   " x  x  x "
411   "x   x   x"
412 };
413 static char circle_line_9_9[] = {
414   "   xxx   "
415   " xx   xx "
416   " x     x "
417   "x       x"
418   "x       x"
419   "x       x"
420   " x     x "
421   " xx   xx "
422   "   xxx   "
423 };       
424 static char circle_filled_9_9[] = {
425   "   xxx   "
426   " xxxxxxx "
427   " xxxxxxx "
428   "xxxxxxxxx"
429   "xxxxxxxxx"
430   "xxxxxxxxx"
431   " xxxxxxx "
432   " xxxxxxx "
433   "   xxx   "
434 };       
435 static char triangle_up_line_9_9[] = { //OpenGL will draw with y reversed.
436   "xxxxxxxxx"
437   " x     x "
438   " x     x "
439   "  x   x  "
440   "  x   x  "
441   "   x x   "
442   "   x x   "
443   "    x    "
444   "    x    "
445 };
446 static char triangle_up_filled_9_9[] = {
447   "xxxxxxxxx"
448   " xxxxxxx "
449   " xxxxxxx "
450   "  xxxxx  "
451   "  xxxxx  "
452   "   xxx   "
453   "   xxx   "
454   "    x    "
455   "    x    "
456 };
457 static char triangle_down_line_9_9[] = {
458   "    x    "
459   "    x    "
460   "   x x   "
461   "   x x   "
462   "  x   x  "
463   "  x   x  "
464   " x     x "
465   " x     x "
466   "xxxxxxxxx"
467 };
468 static char triangle_down_filled_9_9[] = {
469   "    x    "
470   "    x    "
471   "   xxx   "
472   "   xxx   "
473   "  xxxxx  "
474   "  xxxxx  "
475   " xxxxxxx "
476   " xxxxxxx "
477   "xxxxxxxxx"
478 };
479 static char david_star_line_9_9[] = {
480   "    x    "
481   "   x x   "
482   "xxxxxxxxx"
483   " x     x "
484   "  x   x  "
485   " x     x "
486   "xxxxxxxxx"
487   "   x x   "
488   "    x    "
489 };       
490 static char david_star_filled_9_9[] = {
491   "    x    "
492   "   xxx   "
493   "xxxxxxxxx"
494   " xxxxxxx "
495   "  xxxxx  "
496   " xxxxxxx "
497   "xxxxxxxxx"
498   "   xxx   "
499   "    x    "
500 };       
501 static char swiss_cross_line_9_9[] = {
502   "   xxx   "
503   "   x x   "
504   "   x x   "
505   "xxxx xxxx"
506   "x       x"
507   "xxxx xxxx"
508   "   x x   "
509   "   x x   "
510   "   xxx   "
511 };       
512 static char swiss_cross_filled_9_9[] = {
513   "   xxx   "
514   "   xxx   "
515   "   xxx   "
516   "xxxxxxxxx"
517   "xxxxxxxxx"
518   "xxxxxxxxx"
519   "   xxx   "
520   "   xxx   "
521   "   xxx   "
522 };       
523 static char diamond_line_9_9[] = {
524   "    x    "
525   "   x x   "
526   "  x   x  "
527   " x     x "
528   "x       x"
529   " x     x "
530   "  x   x  "
531   "   x x   "
532   "    x    "
533 };
534 static char diamond_filled_9_9[] = {
535   "    x    "
536   "   xxx   "
537   "  xxxxx  "
538   " xxxxxxx "
539   "xxxxxxxxx"
540   " xxxxxxx "
541   "  xxxxx  "
542   "   xxx   "
543   "    x    "
544 };
545 static char square_line_9_9[] = {
546   "xxxxxxxxx"
547   "x       x"
548   "x       x"
549   "x       x"
550   "x       x"
551   "x       x"
552   "x       x"
553   "x       x"
554   "xxxxxxxxx"
555 };
556 static char square_filled_9_9[] = {
557   "xxxxxxxxx"
558   "xxxxxxxxx"
559   "xxxxxxxxx"
560   "xxxxxxxxx"
561   "xxxxxxxxx"
562   "xxxxxxxxx"
563   "xxxxxxxxx"
564   "xxxxxxxxx"
565   "xxxxxxxxx"
566 };
567 
568 static char* sFigures[54] = {
569  plus_5_5,   //0
570  asterisk_5_5,
571  cross_5_5,
572  star_5_5,
573  circle_line_5_5,
574  circle_filled_5_5,
575  triangle_up_line_5_5,
576  triangle_up_filled_5_5,
577  triangle_down_line_5_5,
578  triangle_down_filled_5_5,
579  david_star_line_5_5,
580  david_star_filled_5_5,
581  swiss_cross_line_5_5,
582  swiss_cross_filled_5_5,
583  diamond_line_5_5,
584  diamond_filled_5_5,
585  square_line_5_5,
586  square_filled_5_5, //17
587  plus_7_7,
588  asterisk_7_7,
589  cross_7_7,
590  star_7_7,
591  circle_line_7_7,
592  circle_filled_7_7,
593  triangle_up_line_7_7,
594  triangle_up_filled_7_7,
595  triangle_down_line_7_7,
596  triangle_down_filled_7_7,
597  david_star_line_7_7,
598  david_star_filled_7_7,
599  swiss_cross_line_7_7,
600  swiss_cross_filled_7_7,
601  diamond_line_7_7,
602  diamond_filled_7_7,
603  square_line_7_7,
604  square_filled_7_7, //35
605  plus_9_9,
606  asterisk_9_9,
607  cross_9_9,
608  star_9_9,
609  circle_line_9_9,
610  circle_filled_9_9,
611  triangle_up_line_9_9,
612  triangle_up_filled_9_9,
613  triangle_down_line_9_9,
614  triangle_down_filled_9_9,
615  david_star_line_9_9,
616  david_star_filled_9_9,
617  swiss_cross_line_9_9,
618  swiss_cross_filled_9_9,
619  diamond_line_9_9,
620  diamond_filled_9_9,
621  square_line_9_9,
622  square_filled_9_9 //53
623 };
624 
625 SO_NODE_SOURCE(HEPVis_SoMarkerSet)
626 //////////////////////////////////////////////////////////////////////////////
627 void HEPVis_SoMarkerSet::initClass (
628 )
629 //////////////////////////////////////////////////////////////////////////////
630 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
631 {
632   static bool first = true;
633   if (first) {
634     first = false;
635     SO_NODE_INIT_CLASS(HEPVis_SoMarkerSet,SoPointSet,"PointSet");
636   }
637 }
638 //////////////////////////////////////////////////////////////////////////////
639 HEPVis_SoMarkerSet::HEPVis_SoMarkerSet (
640 )
641 //////////////////////////////////////////////////////////////////////////////
642 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
643 {
644   SO_NODE_CONSTRUCTOR(HEPVis_SoMarkerSet);
645   
646   SO_NODE_ADD_FIELD(markerIndex,(CROSS_5_5));
647 }
648 //////////////////////////////////////////////////////////////////////////////
649 HEPVis_SoMarkerSet::~HEPVis_SoMarkerSet (
650 )
651 //////////////////////////////////////////////////////////////////////////////
652 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
653 {
654 }
655 //////////////////////////////////////////////////////////////////////////////
656 void HEPVis_SoMarkerSet::GLRender (
657  SoGLRenderAction* aAction
658 )
659 //////////////////////////////////////////////////////////////////////////////
660 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
661 {
662   SoState* state = aAction->getState();
663 
664   const SoCoordinateElement* coordinateElement = 
665     SoCoordinateElement::getInstance(state);
666   if(coordinateElement==NULL) return;
667 
668   if(aAction->isOfType(SoGL2PSAction::getClassTypeId())) {
669     SoCacheElement::invalidate(state);
670   }
671 
672   const SbColor& color = SoLazyElement::getDiffuse(aAction->getState(),0);
673   float red,green,blue;
674   color.getValue(red,green,blue);
675 
676   int mark = markerIndex[0];
677 
678   int starti = startIndex.getValue();
679   int pointn = numPoints.getValue();
680   int pointi;
681 
682   glPushAttrib( (GLbitfield)(GL_CURRENT_BIT | GL_ENABLE_BIT));
683   glDisable(GL_LIGHTING);
684   glColor3f(red,green,blue);
685 
686 #ifdef WIN32  
687   //WIN32 : depth test is out over bitmap !
688   glDisable(GL_DEPTH_TEST);
689 #endif
690 
691   glPixelStorei(GL_UNPACK_ALIGNMENT,1);
692   for(pointi=starti;pointi<pointn;pointi++){
693     const SbVec3f& vec = coordinateElement->get3(pointi);
694     glRasterPos3f(vec[0],vec[1],vec[2]);
695     // Do a push, pop to correct a deffect of Mesa-3.1. 
696     // If not, further line drawing will have bad colors.
697     // The glPopAttrib will compell a reinitialisation of
698     // some internal Mesa state.
699     //glPushAttrib(GL_ALL_ATTRIB_BITS);
700     //glPopAttrib();
701     //
702     drawMarker(aAction,mark);
703   }
704 
705   glPopAttrib();
706 }
707 //////////////////////////////////////////////////////////////////////////////
708 void drawMarker(
709  SoAction* aAction
710 ,int aStyle
711 )
712 //////////////////////////////////////////////////////////////////////////////
713 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
714 {
715   GLsizei w = 0,h = 0;
716   GLfloat xorig = 0,yorig = 0;
717   GLfloat xmove = 0,ymove = 0;
718 
719   if((aStyle>=0)&&(aStyle<18)) {
720     w = h = 5;
721     xorig = yorig = 2;
722     GLubyte* bitmap = getBitmap(w,h,sFigures[aStyle]);
723     glBitmap(w,h,xorig,yorig,0.,0.,bitmap);
724     delete [] bitmap;
725   } else if((aStyle>=18)&&(aStyle<36)) {
726     w = h = 7;
727     xorig = yorig = 3;
728     GLubyte* bitmap = getBitmap(w,h,sFigures[aStyle]);
729     glBitmap(w,h,xorig,yorig,0.,0.,bitmap);
730     delete [] bitmap;
731   } else if((aStyle>=36)&&(aStyle<54)) {
732     w = h = 9;
733     xorig = yorig = 4;
734     GLubyte* bitmap = getBitmap(w,h,sFigures[aStyle]);
735     glBitmap(w,h,xorig,yorig,0.,0.,bitmap);
736     delete [] bitmap;
737   } else {
738     return;
739   }
740 
741   if(aAction->isOfType(SoGL2PSAction::getClassTypeId())) {
742     ((SoGL2PSAction*)aAction)->addBitmap(w,h,xorig,yorig,xmove,ymove);
743   }
744 
745 }
746 //////////////////////////////////////////////////////////////////////////////
747 GLubyte* getBitmap(
748  int aW
749 ,int aH
750 ,char aFigure[]
751 ) 
752 //////////////////////////////////////////////////////////////////////////////
753 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
754 {
755   int index = 0;
756   GLubyte* bitmap = new GLubyte[aW * aH + 1];
757   int ichar = 0;
758   int ibit = 0;
759   unsigned char byte = 0;
760   for ( int row = 0; row < aH; row++ ){
761     for ( int col = 0; col < aW; col++){ 
762       unsigned char c = aFigure[ichar];
763       ichar++;
764       if(c==' ') {
765         ibit++;
766       } else { 
767         byte += (1<<(7-ibit));
768         ibit++;
769       }
770       if(ibit==8) {
771         //unsigned char h = byte / 16;
772         //unsigned char l = byte % 16;
773         //printf("0x%x%x\n",h,l);
774         bitmap[index] = byte;
775         index++;
776         ibit = 0;
777         byte = 0;
778       }
779 
780     }
781     if(ibit!=8) { //Jump to next byte.
782       //unsigned char h = byte / 16;
783       //unsigned char l = byte % 16;
784       //printf("0x%x%x\n",h,l);
785       bitmap[index] = byte;
786       index++;
787       ibit = 0;
788       byte = 0;
789     }
790   }
791   return bitmap; 
792 }
793