Files Classes Functions Hierarchy
00001 #ifndef GOBJ_H 00002 #define GOBJ_H 00003 00004 00005 #include <gobjbase.h> 00006 00007 00008 /* 00009 Brief : wrap OpenGL calls in objects for an OO graphics library. 00010 00011 Intro 00012 ----- 00013 00014 This technique converts a modular/procedual API 00015 into an object oriented API by wrapping the OpenGL calls 00016 in objects. The input to the function become members of 00017 that object. Returned data are pointer references. 00018 00019 This is an extension to OpenGL in the sense that if OpenGL 00020 changes the changes are mirrored in the OpenGL objects. 00021 So programmers familiar with OpenGL will 00022 understand because essentially you write out OpenGL. 00023 00024 By using a stack(see gobjContainer) you can insert 00025 objects and execute the code at a later date. So what are 00026 normally function calls to OpenGL are instead objects 00027 pushed to the end of a stack. By executing the stack 00028 from start to end is equivalent to the hard coded calling 00029 of the OpenGL functions in the same order. 00030 00031 Since this stack can be compiled to a display list it 00032 can generally be made efficient. 00033 00034 The other way is deriving from gobj and writing OpenGL 00035 code in draw() which is generally how graphics is written. 00036 00037 So the scene is really a stack or vector of gobj's. gobj 00038 is the base graphics class. 00039 00040 This library is primitive - gobj does not have a copy 00041 constructor for memory management. Instead a call back 00042 is used - see graphicsImmediateDeferred.h . This is 00043 the hardest part of the library to come to grips with, 00044 because we intuitively would build a stack, then move 00045 the code accross when we need it, but without deep copy 00046 you need to write a callback function which pushes the 00047 code when its called - hence creating the copy then. 00048 00049 00050 Performance 00051 ----------- 00052 Whenever I encountered a graphics problem with this there 00053 is always some technique to make it work out. Performance 00054 is not an issue because it can be addressed. 00055 00056 graphicsImmediateDeferred.h was designed for graphics 00057 processing which changes infrequently 00058 00059 How to use this library 00060 ----------------------- 00061 Become familiar with gobj and gobjContainer. 00062 00063 By pushing gobjContainers into the global gobjContainer 00064 stack and having a pointer to them simply delete their 00065 contents and draw the new updated state when convenient. 00066 00067 Then you can use other techniques such as indexing into 00068 the vector to remember positions, saving pointers pointing 00069 into the stack,... 00070 */ 00071 00072 00073 class gobjglColor3f : public gobj 00074 { 00075 public: 00076 00077 00079 float x; 00081 float y; 00083 float z; 00084 00085 gobjglColor3f 00086 ( 00087 floatc x_, 00088 floatc y_, 00089 floatc z_ 00090 ) 00091 : x(x_), y(y_), z(z_) {} 00093 gobjglColor3f(stringc & arg); 00095 boolc serializeInverse(stringc & arg); 00096 00097 /* 00098 template< typename T > 00099 gobjglColor3f(T const & pt) 00100 : x(pt.x), y(pt.y), z(pt.z) {} 00101 */ 00102 00103 void draw() 00104 { GOBJDEBUGCODE glColor3f(x,y,z); } 00105 }; 00106 00107 00108 class gobjglColor3d : public gobj 00109 { 00110 public: 00111 00113 GLdouble x; 00115 GLdouble y; 00117 GLdouble z; 00118 00119 gobjglColor3d() 00120 : x(0), y(0), z(0) {} 00121 00122 gobjglColor3d 00123 ( 00124 GLdouble x_, 00125 GLdouble y_, 00126 GLdouble z_ 00127 ) 00128 : x(x_), y(y_), z(z_) {} 00129 00130 template< typename T > 00131 gobjglColor3d(T const & pt) 00132 : x(pt.x), y(pt.y), z(pt.z) {} 00133 00134 void draw() 00135 { GOBJDEBUGCODE glColor3d(x,y,z); } 00136 }; 00137 00138 00139 class gobjglColor4f : public gobj 00140 { 00141 public: 00142 00143 float x; 00144 float y; 00145 float z; 00146 float a; 00147 00148 gobjglColor4f 00149 ( 00150 floatc x_, 00151 floatc y_, 00152 floatc z_, 00153 floatc a_ 00154 ) 00155 : x(x_), y(y_), z(z_), a(a_) {} 00156 00157 void draw() 00158 { GOBJDEBUGCODE glColor4f(x,y,z,a); } 00159 }; 00160 00161 00162 class gobjglColor4d : public gobj 00163 { 00164 public: 00165 00166 typedef GLdouble W; 00167 00168 W x; 00169 W y; 00170 W z; 00171 W a; 00172 00173 gobjglColor4d 00174 ( 00175 W const x_, 00176 W const y_, 00177 W const z_, 00178 W const a_ 00179 ) 00180 : x(x_), y(y_), z(z_), a(a_) {} 00181 00182 void set( W const x_, W const y_, W const z_, W const a_) 00183 { x=x_; y=y_; z=z_; a=a_; } 00184 00185 void draw() 00186 { GOBJDEBUGCODE glColor4d(x,y,z,a); } 00187 }; 00188 00189 // <TODO> Compiler seems to be experiencing unusual behaviour. 00190 // This code is failing. 00191 // targetcolor = new gobjglColor3ub(0,255,0); 00192 // targetcolor->x = 34; 00193 // cout << SHOW(targetcolor->x) << endl; 00194 class gobjglColor3ub : public gobj, public point3<GLubyte> 00195 { 00196 public: 00197 00198 typedef GLubyte W; 00199 00200 gobjglColor3ub( W const x_, W const y_, W const z_ ) 00201 : point3<W>(x_,y_,z_) {} 00202 00203 void set( W const x_, W const y_, W const z_) 00204 { x=x_; y=y_; z=z_; } 00205 00206 void draw() 00207 { GOBJDEBUGCODE glColor3ub(x,y,z); } 00208 }; 00209 00210 class gobjglColor4ub : public gobj 00211 { 00212 public: 00213 00214 typedef GLubyte W; 00215 00216 W x; 00217 W y; 00218 W z; 00219 W a; 00220 00221 gobjglColor4ub 00222 ( 00223 W const x_, 00224 W const y_, 00225 W const z_, 00226 W const a_ 00227 ) 00228 : x(x_), y(y_), z(z_), a(a_) {} 00229 00230 void set( W const x_, W const y_, W const z_, W const a_) 00231 { x=x_; y=y_; z=z_; a=a_; } 00232 00233 void draw() 00234 { GOBJDEBUGCODE glColor4ub(x,y,z,a); } 00235 }; 00236 00237 00238 class gobjglRasterPos2f : public gobj 00239 { 00240 public: 00241 00242 float x, y; 00243 00244 gobjglRasterPos2f(floatc x_, floatc y_) 00245 : x(x_), y(y_) {} 00246 gobjglRasterPos2f(point2<float> const & p) 00247 : x(p.x), y(p.y) {} 00248 00249 void draw() 00250 { GOBJDEBUGCODE glRasterPos2f(x,y); } 00251 00252 }; 00253 00254 class gobjglRasterPos2i : public gobj 00255 { 00256 public: 00257 00258 GLint x, y; 00259 00260 gobjglRasterPos2i(GLint const x_, GLint const y_) 00261 : x(x_), y(y_) {} 00262 gobjglRasterPos2i(point2<GLint> const & p) 00263 : x(p.x), y(p.y) {} 00264 00265 void draw() 00266 { GOBJDEBUGCODE glRasterPos2i(x,y); } 00267 00268 }; 00269 00270 class gobjglRasterPos3f : public gobj 00271 { 00272 public: 00273 00275 float x; 00277 float y; 00279 float z; 00280 00281 gobjglRasterPos3f 00282 ( 00283 floatc x_, 00284 floatc y_, 00285 floatc z_ 00286 ) 00287 : x(x_), y(y_), z(z_) {} 00288 gobjglRasterPos3f(point3<float> const & p) 00289 : x(p.x), y(p.y), z(p.z) {} 00290 00291 void draw() 00292 { GOBJDEBUGCODE glRasterPos3f(x,y,z); } 00293 00294 }; 00295 00296 class gobjglBegin : public gobj 00297 { 00298 public: 00299 00300 GLenum mode; 00301 00302 gobjglBegin(GLenum mode_) 00303 : mode(mode_) {} 00305 gobjglBegin(stringc & arg); 00307 boolc serializeInverse(stringc & arg); 00308 00309 void draw() 00310 { GOBJDEBUGCODE glBegin(mode); } 00311 }; 00312 00313 class gobjglEnd : public gobj 00314 { 00315 public: 00316 void draw() 00317 { GOBJDEBUGCODE glEnd(); } 00318 }; 00319 00320 class gobjglVertex2f : public gobj 00321 { 00322 public: 00323 00325 float x; 00326 00328 float y; 00329 00330 gobjglVertex2f 00331 ( 00332 floatc x_, 00333 floatc y_ 00334 ) 00335 : x(x_), y(y_) {} 00336 00337 gobjglVertex2f 00338 ( 00339 point2<float> const x 00340 ) 00341 : x(x.x), y(x.y) {} 00342 00343 gobjglVertex2f 00344 ( 00345 point2<double> const x 00346 ) 00347 : x(x.x), y(x.y) {} 00348 00349 void draw() 00350 { GOBJDEBUGCODE glVertex2f(x,y); } 00351 }; 00352 00361 class gobjglVertex2d : public gobj 00362 { 00363 public: 00364 00366 GLdouble x; 00368 GLdouble y; 00369 00371 gobjglVertex2d 00372 ( 00373 doublec x_, 00374 doublec y_ 00375 ) 00376 : x(x_), y(y_) {} 00377 00379 gobjglVertex2d 00380 ( 00381 point2<float> const x 00382 ) 00383 : x(x.x), y(x.y) {} 00384 00386 gobjglVertex2d 00387 ( 00388 point2<double> const x 00389 ) 00390 : x(x.x), y(x.y) {} 00391 00393 void draw() 00394 { GOBJDEBUGCODE glVertex2d(x,y); } 00395 }; 00396 00397 00401 class gobjglLoadIdentity : public gobj 00402 { 00403 public: 00404 00406 void draw() 00407 { GOBJDEBUGCODE glLoadIdentity(); } 00408 }; 00409 00421 class gobjglPushMatrix : public gobj 00422 { 00423 public: 00424 void draw() 00425 { GOBJDEBUGCODE glPushMatrix(); } 00426 }; 00427 00431 class gobjglPopMatrix : public gobj 00432 { 00433 public: 00434 void draw() 00435 { GOBJDEBUGCODE glPopMatrix(); } 00436 }; 00437 00448 class gobjglEnable : public gobj 00449 { 00450 public: 00451 00453 GLenum capability; 00454 00456 gobjglEnable(GLenum capability_) 00457 : capability(capability_) {} 00458 00460 void draw() 00461 { GOBJDEBUGCODE glEnable(capability); } 00462 }; 00463 00471 class gobjglDisable : public gobj 00472 { 00473 public: 00474 00477 GLenum capability; 00478 00480 gobjglDisable(GLenum capability_) 00481 : capability(capability_) {} 00483 gobjglDisable(stringc & arg); 00485 boolc serializeInverse(stringc & arg); 00486 00488 void draw() 00489 { GOBJDEBUGCODE glDisable(capability); } 00490 }; 00491 00512 class gobjglPushAttrib : public gobj 00513 { 00514 public: 00515 00516 GLbitfield mask; 00517 00519 gobjglPushAttrib(GLbitfield mask_) 00520 : mask(mask_) {} 00521 00522 gobjglPushAttrib(stringc & arg); 00523 00525 boolc serializeInverse(stringc & arg); 00526 00528 void draw() 00529 { GOBJDEBUGCODE glPushAttrib(mask); } 00530 }; 00531 00536 class gobjglPopAttrib : public gobj 00537 { 00538 public: 00540 void draw() 00541 { GOBJDEBUGCODE glPopAttrib(); } 00542 }; 00543 00544 class gobjglRotatef : public gobj 00545 { 00546 public: 00547 00548 GLfloat theta; 00549 GLfloat x; 00550 GLfloat y; 00551 GLfloat z; 00552 00553 gobjglRotatef 00554 ( 00555 GLfloat const theta_, 00556 GLfloat const x_, 00557 GLfloat const y_, 00558 GLfloat const z_ 00559 ) 00560 : theta(theta_), x(x_), y(y_), z(z_) {} 00561 00562 void draw() 00563 { GOBJDEBUGCODE glRotatef(theta,x,y,z); } 00564 }; 00565 00566 class gobjglRotated : public gobj 00567 { 00568 public: 00569 00570 GLdouble theta; 00571 GLdouble x; 00572 GLdouble y; 00573 GLdouble z; 00574 00575 gobjglRotated 00576 ( 00577 GLdouble const theta_, 00578 GLdouble const x_, 00579 GLdouble const y_, 00580 GLdouble const z_ 00581 ) 00582 : theta(theta_), x(x_), y(y_), z(z_) {} 00583 00584 void draw() 00585 { GOBJDEBUGCODE glRotated(theta,x,y,z); } 00586 }; 00587 00588 class gobjglTranslatef : public gobj 00589 { 00590 public: 00591 00592 GLfloat x; 00593 GLfloat y; 00594 GLfloat z; 00595 00596 gobjglTranslatef 00597 ( 00598 GLfloat const x_, 00599 GLfloat const y_, 00600 GLfloat const z_ 00601 ) 00602 : x(x_), y(y_), z(z_) {} 00603 00604 gobjglTranslatef 00605 ( 00606 point3<float> const & p 00607 ) 00608 : x(p.x), y(p.y), z(p.z) {} 00609 00610 gobjglTranslatef 00611 ( 00612 point3<double> const & p 00613 ) 00614 : x(p.x), y(p.y), z(p.z) {} 00615 00616 void draw() 00617 { GOBJDEBUGCODE glTranslatef(x,y,z); } 00618 }; 00619 00620 class gobjglTranslated : public gobj 00621 { 00622 public: 00623 00624 GLdouble x; 00625 GLdouble y; 00626 GLdouble z; 00627 00628 gobjglTranslated 00629 ( 00630 GLdouble const x_, 00631 GLdouble const y_, 00632 GLdouble const z_ 00633 ) 00634 : x(x_), y(y_), z(z_) {} 00635 00636 gobjglTranslated 00637 ( 00638 point3<float> const & p 00639 ) 00640 : x(p.x), y(p.y), z(p.z) {} 00641 00642 gobjglTranslated 00643 ( 00644 point3<double> const & p 00645 ) 00646 : x(p.x), y(p.y), z(p.z) {} 00647 00648 void draw() 00649 { GOBJDEBUGCODE glTranslated(x,y,z); } 00650 }; 00651 00652 class gobjglVertex3f : public gobj 00653 { 00654 public: 00655 00656 float x; 00657 float y; 00658 float z; 00659 00660 gobjglVertex3f 00661 ( 00662 floatc x_, 00663 floatc y_, 00664 floatc z_ 00665 ) 00666 : x(x_), y(y_), z(z_) {} 00667 00668 gobjglVertex3f 00669 ( 00670 point3<float> const & x 00671 ) 00672 : x(x.x), y(x.y), z(x.z) {} 00673 00674 gobjglVertex3f 00675 ( 00676 point3<double> const & x 00677 ) 00678 : x(x.x), y(x.y), z(x.z) {} 00679 00680 gobjglVertex3f 00681 ( 00682 point2<float> const & x 00683 ) 00684 : x(x.x), y(x.y), z(0.0) {} 00685 00686 gobjglVertex3f 00687 ( 00688 point2<double> const & x 00689 ) 00690 : x(x.x), y(x.y), z(0.0) {} 00691 00693 gobjglVertex3f(stringc & arg); 00694 00696 boolc serializeInverse(stringc & arg); 00697 00698 void draw() 00699 { GOBJDEBUGCODE glVertex3f(x,y,z); } 00700 00701 00702 }; 00703 00704 class gobjglVertex3d : public gobj 00705 { 00706 public: 00707 00708 GLdouble x; 00709 GLdouble y; 00710 GLdouble z; 00711 00712 gobjglVertex3d 00713 ( 00714 doublec x_, 00715 doublec y_, 00716 doublec z_ 00717 ) 00718 : x(x_), y(y_), z(z_) {} 00719 00720 gobjglVertex3d 00721 ( 00722 point3<float> const & x 00723 ) 00724 : x(x.x), y(x.y), z(x.z) {} 00725 00726 gobjglVertex3d 00727 ( 00728 point3<double> const & x 00729 ) 00730 : x(x.x), y(x.y), z(x.z) {} 00731 00732 gobjglVertex3d 00733 ( 00734 point2<float> const & x 00735 ) 00736 : x(x.x), y(x.y), z(0.0) {} 00737 00738 gobjglVertex3d 00739 ( 00740 point2<double> const & x 00741 ) 00742 : x(x.x), y(x.y), z(0.0) {} 00743 00744 void draw() 00745 { GOBJDEBUGCODE glVertex3d(x,y,z); } 00746 }; 00747 00748 class gobjglNormal3f : public gobj 00749 { 00750 public: 00751 00752 point3<float> p; 00753 00754 gobjglNormal3f 00755 ( 00756 floatc x_, 00757 floatc y_, 00758 floatc z_ 00759 ) 00760 : p( point3<float>(x_,y_,z_) ) {} 00761 00762 gobjglNormal3f( point3<float> const & p_) 00763 : p(p_) {} 00764 00765 gobjglNormal3f( point3<double> const & p_) 00766 : p(p_.x,p_.y,p_.z) {} 00767 00768 void draw() 00769 { GOBJDEBUGCODE glNormal3f(p.x,p.y,p.z); } 00770 }; 00771 00772 class gobjglutSolidCube : public gobj 00773 { 00774 public: 00775 00776 GLdouble size; 00777 00778 gobjglutSolidCube(GLdouble size_); 00779 00780 void draw(); 00781 }; 00782 00783 class gobjglutWireCube : public gobj 00784 { 00785 public: 00786 00787 GLdouble size; 00788 00789 gobjglutWireCube(GLdouble size_); 00790 00791 void draw(); 00792 }; 00793 00794 class gobjglutSolidCone : public gobj 00795 { 00796 public: 00797 00798 GLdouble base; 00799 GLdouble height; 00800 GLint slices; 00801 GLint stacks; 00802 00803 gobjglutSolidCone 00804 ( 00805 GLdouble base_, 00806 GLdouble height_, 00807 GLint slices_, 00808 GLint stacks_ 00809 ); 00810 00811 void draw(); 00812 }; 00813 00814 class gobjglutWireCone : public gobj 00815 { 00816 public: 00817 00818 GLdouble base; 00819 GLdouble height; 00820 GLint slices; 00821 GLint stacks; 00822 00823 gobjglutWireCone 00824 ( 00825 GLdouble base_, 00826 GLdouble height_, 00827 GLint slices_, 00828 GLint stacks_ 00829 ); 00830 00831 void draw(); 00832 }; 00833 00834 class gobjglutSolidTeapot : public gobj 00835 { 00836 public: 00837 00838 GLdouble size; 00839 00840 gobjglutSolidTeapot(GLdouble size_); 00841 00842 void draw(); 00843 }; 00844 00845 class gobjglutWireTeapot : public gobj 00846 { 00847 public: 00848 00849 GLdouble size; 00850 00851 gobjglutWireTeapot(GLdouble size_); 00852 00853 void draw(); 00854 }; 00855 00856 class gobjglutSolidSphere : public gobj 00857 { 00858 public: 00859 00860 GLdouble radius; 00861 GLint slices; 00862 GLint stacks; 00863 00864 gobjglutSolidSphere 00865 ( 00866 GLdouble radius_, 00867 GLint slices_, 00868 GLint stacks_ 00869 ); 00870 00871 void draw(); 00872 }; 00873 00874 class gobjglutWireSphere : public gobj 00875 { 00876 public: 00877 00878 GLdouble radius; 00879 GLint slices; 00880 GLint stacks; 00881 00882 gobjglutWireSphere 00883 ( 00884 GLdouble radius_, 00885 GLint slices_, 00886 GLint stacks_ 00887 ); 00888 00889 void draw(); 00890 }; 00891 00892 class gobjglutSolidDodecahedron : public gobj 00893 { 00894 public: 00895 00896 gobjglutSolidDodecahedron() {} 00897 void draw() 00898 { GOBJDEBUGCODE glutSolidDodecahedron(); } 00899 }; 00900 00901 class gobjglutSolidTetrahedron: public gobj 00902 { 00903 public: 00904 00905 gobjglutSolidTetrahedron() {} 00906 void draw() 00907 { GOBJDEBUGCODE glutSolidTetrahedron(); } 00908 }; 00909 00910 class gobjglutSolidIcosahedron: public gobj 00911 { 00912 public: 00913 00914 gobjglutSolidIcosahedron() {} 00915 void draw() 00916 { GOBJDEBUGCODE glutSolidIcosahedron(); } 00917 }; 00918 00919 class gobjglutSolidOctahedron: public gobj 00920 { 00921 public: 00922 00923 gobjglutSolidOctahedron() {} 00924 void draw() 00925 { GOBJDEBUGCODE glutSolidOctahedron(); } 00926 }; 00927 00928 class gobjglutWireDodecahedron : public gobj 00929 { 00930 public: 00931 00932 gobjglutWireDodecahedron() {} 00933 void draw() 00934 { GOBJDEBUGCODE glutWireDodecahedron(); } 00935 }; 00936 00937 class gobjglutWireTetrahedron: public gobj 00938 { 00939 public: 00940 00941 gobjglutWireTetrahedron() {} 00942 void draw() 00943 { GOBJDEBUGCODE glutWireTetrahedron(); } 00944 }; 00945 00946 class gobjglutWireIcosahedron: public gobj 00947 { 00948 public: 00949 00950 gobjglutWireIcosahedron() {} 00951 void draw() 00952 { GOBJDEBUGCODE glutWireIcosahedron(); } 00953 }; 00954 00955 class gobjglutWireOctahedron: public gobj 00956 { 00957 public: 00958 00959 gobjglutWireOctahedron() {} 00960 void draw() 00961 { GOBJDEBUGCODE glutWireOctahedron(); } 00962 }; 00963 00964 /* 00965 \brief Solid donut. 00966 */ 00967 class gobjglutSolidTorus : public gobj 00968 { 00969 public: 00970 00971 GLdouble innerRadius; 00972 GLdouble outerRadius; 00973 GLint nsides; 00974 GLint rings; 00975 00976 gobjglutSolidTorus 00977 ( 00978 GLdouble innerRadius_, 00979 GLdouble outerRadius_, 00980 GLint nsides_, 00981 GLint rings_ 00982 ); 00983 00984 void draw(); 00985 }; 00986 00987 /* 00988 \brief Wire donut. 00989 */ 00990 class gobjglutWireTorus : public gobj 00991 { 00992 public: 00993 00994 GLdouble innerRadius; 00995 GLdouble outerRadius; 00996 GLint nsides; 00997 GLint rings; 00998 00999 gobjglutWireTorus 01000 ( 01001 GLdouble innerRadius_, 01002 GLdouble outerRadius_, 01003 GLint nsides_, 01004 GLint rings_ 01005 ); 01006 01007 void draw(); 01008 }; 01009 01013 class gobjglLineStipple : public gobj 01014 { 01015 public: 01016 01019 GLint factor; 01020 GLushort pattern; 01021 01022 gobjglLineStipple(GLint factor_, GLushort pattern_) 01023 : factor(factor_), pattern(pattern_) {} 01024 01025 void draw() 01026 { GOBJDEBUGCODE glLineStipple(factor,pattern); } 01027 }; 01028 01040 class gobjglBlendFunc : public gobj 01041 { 01042 public: 01043 01044 GLenum sfactor; 01045 GLenum dfactor; 01046 01047 gobjglBlendFunc(GLenum sfactor_, GLenum dfactor_) 01048 : sfactor(sfactor_), dfactor(dfactor_) {} 01049 01050 void draw() 01051 { GOBJDEBUGCODE glBlendFunc(sfactor,dfactor); } 01052 }; 01053 01054 class gobjglGenLists : public gobj 01055 { 01056 public: 01057 01058 GLuint listName; 01059 GLsizei range; 01060 01061 gobjglGenLists(GLsizei range_=1) 01062 : range(range_) {} 01063 01064 void draw() 01065 { GOBJDEBUGCODE listName = glGenLists(range); } 01066 01067 }; 01068 01069 class gobjglNewList : public gobj 01070 { 01071 01072 GLuint list; 01073 GLenum mode; 01074 01075 gobjglNewList(GLuint list_, GLenum mode_) 01076 : list(list_), mode(mode_) {} 01077 01078 void draw() 01079 { GOBJDEBUGCODE if (list!=0) glNewList(list,mode); } 01080 01081 }; 01082 01083 class gobjglEndList : public gobj 01084 { 01085 public: 01086 01087 void draw() 01088 { GOBJDEBUGCODE glEndList(); } 01089 }; 01090 01091 class gobjglMatrixMode : public gobj 01092 { 01093 public: 01094 01095 GLenum mode; 01096 01097 gobjglMatrixMode( GLenum mode_ ) 01098 : mode(mode_) {} 01099 01100 void draw() 01101 { GOBJDEBUGCODE glMatrixMode(mode); } 01102 }; 01103 01104 class gobjglLoadMatrixf : public gobj 01105 { 01106 public: 01107 01108 GLfloat const * matrix; 01109 01110 gobjglLoadMatrixf( GLfloat const * matrix_ ) 01111 : matrix(matrix_) {} 01112 01113 void draw() 01114 { GOBJDEBUGCODE glLoadMatrixf(matrix); } 01115 }; 01116 01117 class gobjglLoadMatrixd : public gobj 01118 { 01119 public: 01120 01121 GLdouble const * matrix; 01122 01123 gobjglLoadMatrixd( GLdouble const * matrix_ ) 01124 : matrix(matrix_) {} 01125 01126 void draw() 01127 { GOBJDEBUGCODE glLoadMatrixd(matrix); } 01128 }; 01129 01130 class gobjglMultMatrixf : public gobj 01131 { 01132 public: 01133 01134 GLfloat const * matrix; 01135 01136 gobjglMultMatrixf( GLfloat const * matrix_ ) 01137 : matrix(matrix_) {} 01138 01139 void draw() 01140 { GOBJDEBUGCODE glMultMatrixf(matrix); } 01141 }; 01142 01143 class gobjglMultMatrixd : public gobj 01144 { 01145 public: 01146 01147 GLdouble const * matrix; 01148 01149 gobjglMultMatrixd( GLdouble const * matrix_ ) 01150 : matrix(matrix_) {} 01151 01152 void draw() 01153 { GOBJDEBUGCODE glMultMatrixd(matrix); } 01154 }; 01155 01156 class gobjglOrtho : public gobj 01157 { 01158 public: 01159 01160 GLdouble left; 01161 GLdouble right; 01162 GLdouble bottom; 01163 GLdouble top; 01164 GLdouble near; 01165 GLdouble far; 01166 01167 gobjglOrtho 01168 ( 01169 GLdouble const left_, 01170 GLdouble const right_, 01171 GLdouble const bottom_, 01172 GLdouble const top_, 01173 GLdouble const near_, 01174 GLdouble const far_ 01175 ) 01176 : left(left_), right(right_), bottom(bottom_), top(top_), 01177 near(near_), far(far_) {} 01178 01179 void draw() 01180 { GOBJDEBUGCODE glOrtho(left,right,bottom,top,near,far); } 01181 }; 01182 01183 class gobjglViewport : public gobj 01184 { 01185 public: 01186 01187 GLint x; 01188 GLint y; 01189 GLsizei width; 01190 GLsizei height; 01191 01192 gobjglViewport 01193 ( 01194 GLint x_, 01195 GLint y_, 01196 GLsizei width_, 01197 GLsizei height_ 01198 ) 01199 : x(x_), y(y_), width(width_), height(height_) {} 01200 01201 void draw() 01202 { GOBJDEBUGCODE glViewport(x,y,width,height); } 01203 }; 01204 01205 class gobjglDepthRange : public gobj 01206 { 01207 public: 01208 01209 GLclampd near; 01210 GLclampd far; 01211 01212 gobjglDepthRange(GLclampd near_, GLclampd far_) 01213 : near(near_), far(far_) {} 01214 01215 void draw() 01216 { GOBJDEBUGCODE glDepthRange(near,far); } 01217 }; 01218 01219 class gobjglClipPlane : public gobj 01220 { 01221 public: 01222 01223 GLenum plane; 01224 GLdouble const * equation; 01225 01226 gobjglClipPlane 01227 ( 01228 GLenum plane_, 01229 GLdouble const * equation_ 01230 ) 01231 : plane(plane_), equation(equation_) {} 01232 01233 void draw() 01234 { GOBJDEBUGCODE glClipPlane(plane,equation); } 01235 }; 01236 01237 01238 class gobjgluNewQuadric : public gobj 01239 { 01240 public: 01241 01242 GLUquadricObj* qobj; 01243 01244 void draw() 01245 { GOBJDEBUGCODE qobj = gluNewQuadric(); } 01246 }; 01247 01248 class gobjgluDeleteQuadric : public gobj 01249 { 01250 public: 01251 01252 GLUquadricObj* & qobj; 01253 01254 gobjgluDeleteQuadric(GLUquadricObj * & qobj_) 01255 : qobj(qobj_) {} 01256 01257 void draw() 01258 { GOBJDEBUGCODE gluDeleteQuadric(qobj); } 01259 }; 01260 01261 class gobjgluQuadricOrientation : public gobj 01262 { 01263 public: 01264 01265 GLUquadricObj* & qobj; 01266 01267 GLenum orientation; 01268 01269 gobjgluQuadricOrientation(GLUquadricObj * & qobj_, GLenum orientation_) 01270 : qobj(qobj_), orientation(orientation_) {} 01271 01272 void draw() 01273 { GOBJDEBUGCODE gluQuadricOrientation(qobj,orientation); } 01274 }; 01275 01276 class gobjgluQuadricNormals : public gobj 01277 { 01278 public: 01279 01280 GLUquadricObj* & qobj; 01281 01282 GLenum normals; 01283 01284 gobjgluQuadricNormals(GLUquadricObj* qobj_, GLenum normals_) 01285 : qobj(qobj_), normals(normals_) {} 01286 01287 void draw() 01288 { GOBJDEBUGCODE gluQuadricNormals(qobj,normals); } 01289 01290 }; 01291 01292 class gobjgluQuadricTexture : public gobj 01293 { 01294 public: 01295 01296 GLUquadricObj * & qobj; 01297 01298 GLboolean textureCoords; 01299 01300 gobjgluQuadricTexture 01301 ( 01302 GLUquadricObj * & qobj_, 01303 GLboolean textureCoords_ 01304 ) 01305 : qobj(qobj_), textureCoords(textureCoords_) {} 01306 01307 void draw() 01308 { GOBJDEBUGCODE gluQuadricTexture(qobj,textureCoords); } 01309 }; 01310 01327 class gobjgluSphere : public gobj 01328 { 01329 public: 01330 01331 GLUquadricObj* & qobj; 01332 01333 GLdouble radius; 01334 01335 GLint slices; 01336 01337 GLint stacks; 01338 01339 gobjgluSphere 01340 ( 01341 GLUquadricObj * & qobj_, 01342 GLdouble radius_, 01343 GLint slices_, 01344 GLint stacks_ 01345 ) : qobj(qobj_), radius(radius_), slices(slices_), 01346 stacks(stacks_) {} 01347 01348 void draw() 01349 { GOBJDEBUGCODE gluSphere(qobj,radius,slices,stacks); } 01350 }; 01351 01368 class gobjgluCylinder : public gobj 01369 { 01370 public: 01371 01372 GLUquadricObj * & qobj; 01373 01374 GLdouble baseRadius; 01375 01376 GLdouble topRadius; 01377 01378 GLdouble height; 01379 01380 GLint slices; 01381 01382 GLint stacks; 01383 01384 gobjgluCylinder 01385 ( 01386 GLUquadricObj * & qobj_, 01387 GLdouble baseRadius_, 01388 GLdouble topRadius_, 01389 GLdouble height_, 01390 GLint slices_, 01391 GLint stacks_ 01392 ) 01393 : qobj(qobj_), baseRadius(baseRadius_), 01394 topRadius(topRadius_), height(height_), 01395 slices(slices_), stacks(stacks_) {} 01396 01397 void draw() 01398 { GOBJDEBUGCODE gluCylinder(qobj,baseRadius,topRadius,height,slices,stacks); } 01399 }; 01400 01417 class gobjgluDisk : public gobj 01418 { 01419 public: 01420 01421 GLUquadricObj * & qobj; 01422 01423 GLdouble innerRadius; 01424 01425 GLdouble outerRadius; 01426 01427 GLint slices; 01428 01429 GLint rings; 01430 01431 gobjgluDisk 01432 ( 01433 GLUquadricObj * & qobj_, 01434 GLdouble innerRadius_, 01435 GLdouble outerRadius_, 01436 GLint slices_, 01437 GLint rings_ 01438 ) 01439 : qobj(qobj_), innerRadius(innerRadius_), 01440 outerRadius(outerRadius_), slices(slices_), 01441 rings(rings_) {} 01442 01443 void draw() 01444 { GOBJDEBUGCODE gluDisk(qobj,innerRadius,outerRadius,slices,rings); } 01445 }; 01446 01463 class gobjgluPartialDisk : public gobj 01464 { 01465 public: 01466 01467 GLUquadricObj * & qobj; 01468 01469 GLdouble innerRadius; 01470 01471 GLdouble outerRadius; 01472 01473 GLint slices; 01474 01475 GLint rings; 01476 01477 GLdouble startAngle; 01478 01479 GLdouble sweepAngle; 01480 01481 gobjgluPartialDisk 01482 ( 01483 GLUquadricObj * & qobj_, 01484 GLdouble innerRadius_, 01485 GLdouble outerRadius_, 01486 GLint slices_, 01487 GLint rings_, 01488 GLdouble startAngle_, 01489 GLdouble sweepAngle_ 01490 ) 01491 : qobj(qobj_), innerRadius(innerRadius_), 01492 outerRadius(outerRadius_), slices(slices_), 01493 startAngle(startAngle_), sweepAngle(sweepAngle_) {} 01494 01495 void draw() 01496 { GOBJDEBUGCODE gluPartialDisk(qobj,innerRadius,outerRadius,slices,rings, 01497 startAngle,sweepAngle); } 01498 }; 01499 01500 class gobjgluOrtho2D : public gobj 01501 { 01502 public: 01503 01504 GLdouble left; 01505 GLdouble right; 01506 GLdouble bottom; 01507 GLdouble top; 01508 01509 gobjgluOrtho2D 01510 ( 01511 GLdouble const left_, 01512 GLdouble const right_, 01513 GLdouble const bottom_, 01514 GLdouble const top_ 01515 ) 01516 : left(left_), right(right_), bottom(bottom_), top(top_) {} 01517 01518 void draw() 01519 { GOBJDEBUGCODE gluOrtho2D(left,right,bottom,top); } 01520 }; 01521 01522 class gobjgluPerspective : public gobj 01523 { 01524 public: 01525 01526 GLdouble fovy; 01527 GLdouble aspect; 01528 GLdouble near; 01529 GLdouble far; 01530 01531 gobjgluPerspective 01532 ( 01533 GLdouble const fovy_, 01534 GLdouble const aspect_, 01535 GLdouble const near_, 01536 GLdouble const far_ 01537 ) 01538 : fovy(fovy_), aspect(aspect_), near(near_), far(far_) 01539 {} 01540 01541 void draw() 01542 { GOBJDEBUGCODE gluPerspective(fovy,aspect,near,far); } 01543 }; 01544 01545 class gobjglFlush : public gobj 01546 { 01547 public: 01548 01549 void draw() 01550 { GOBJDEBUGCODE glFlush(); } 01551 01552 }; 01553 01554 class gobjglClear : public gobj 01555 { 01556 public: 01557 01558 GLbitfield mask; 01559 01560 gobjglClear(GLbitfield mask_) 01561 : mask(mask_) {} 01562 01563 void draw() 01564 { GOBJDEBUGCODE glClear(mask); } 01565 }; 01566 01567 class gobjglClearColor : public gobj 01568 { 01569 public: 01570 01571 GLclampf red; 01572 GLclampf green; 01573 GLclampf blue; 01574 GLclampf alpha; 01575 01576 gobjglClearColor 01577 ( 01578 GLclampf red_, 01579 GLclampf green_, 01580 GLclampf blue_, 01581 GLclampf alpha_ 01582 ) 01583 : red(red_), green(green_), blue(blue_), alpha(alpha_) {} 01584 01585 gobjglClearColor(point3<double> const & p) 01586 : red(p.x), green(p.y), blue(p.z), alpha(0.0) {} 01587 01588 void draw() 01589 { GOBJDEBUGCODE glClearColor(red,green,blue,alpha); } 01590 01591 }; 01592 01593 class gobjglClearIndex : public gobj 01594 { 01595 public: 01596 01597 GLfloat index; 01598 01599 gobjglClearIndex(GLfloat index_) 01600 : index(index_) {} 01601 01602 void draw() 01603 { GOBJDEBUGCODE glClearIndex(index); } 01604 01605 }; 01606 01607 class gobjglClearDepth : public gobj 01608 { 01609 public: 01610 01611 GLclampd depth; 01612 01613 gobjglClearDepth(GLclampd depth_) 01614 : depth(depth_) {} 01615 01616 void draw() 01617 { GOBJDEBUGCODE glClearDepth(depth); } 01618 01619 }; 01620 01621 class gobjglClearStencil : public gobj 01622 { 01623 public: 01624 01625 // ??? on name 01626 GLint stencil; 01627 01628 gobjglClearStencil(GLint stencil_) 01629 : stencil(stencil_) {} 01630 01631 void draw() 01632 { GOBJDEBUGCODE glClearStencil(stencil); } 01633 01634 }; 01635 01636 class gobjglClearAccum : public gobj 01637 { 01638 public: 01639 01640 GLfloat red; 01641 GLfloat green; 01642 GLfloat blue; 01643 GLfloat alpha; 01644 01645 gobjglClearAccum 01646 ( 01647 GLfloat red_, 01648 GLfloat green_, 01649 GLfloat blue_, 01650 GLfloat alpha_ 01651 ) 01652 : red(red_), green(green_), blue(blue_), alpha(alpha_) {} 01653 01654 void draw() 01655 { GOBJDEBUGCODE glClearAccum(red,green,blue,alpha); } 01656 01657 }; 01658 01659 01660 01661 #endif 01662 01663
1.5.8