GLU 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
  2. *
  3. * This library is open source and may be redistributed and/or modified under
  4. * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
  5. * (at your option) any later version. The full license is in LICENSE file
  6. * included with this distribution, and on the openscenegraph.org website.
  7. *
  8. * This library is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * OpenSceneGraph Public License for more details.
  12. */
  13. #ifndef OSG_GLU
  14. #define OSG_GLU 1
  15. #include <osg/GL>
  16. namespace osg
  17. {
  18. /* Pixel storage modes, used by gluScaleImage */
  19. struct OSG_EXPORT PixelStorageModes
  20. {
  21. // sets defaults as per glGet docs in OpenGL red book
  22. PixelStorageModes();
  23. // use glGet's to retrieve all the current settings
  24. void retrieveStoreModes();
  25. // use glGet's to retrieve all the current 3D settings
  26. void retrieveStoreModes3D();
  27. GLint pack_alignment;
  28. GLint pack_row_length;
  29. GLint pack_skip_rows;
  30. GLint pack_skip_pixels;
  31. GLint pack_lsb_first;
  32. GLint pack_swap_bytes;
  33. GLint pack_skip_images;
  34. GLint pack_image_height;
  35. GLint unpack_alignment;
  36. GLint unpack_row_length;
  37. GLint unpack_skip_rows;
  38. GLint unpack_skip_pixels;
  39. GLint unpack_lsb_first;
  40. GLint unpack_swap_bytes;
  41. GLint unpack_skip_images;
  42. GLint unpack_image_height;
  43. } ;
  44. extern OSG_EXPORT const GLubyte * gluErrorString (GLenum error);
  45. /** OSG specific gluScaleImage function that allows you to pass in the PixelStoreModes, which
  46. * enables the code to avoid glGet's that are associated with the conventional gluScaleImage function.
  47. * Avoiding glGet's allows this gluScaleImage function to be called at any time, from any thread, there
  48. * is no need to have a graphics context current.*/
  49. extern OSG_EXPORT GLint gluScaleImage (PixelStorageModes* psm, GLenum format, GLsizei wIn, GLsizei hIn, GLenum typeIn, const void *dataIn, GLsizei wOut, GLsizei hOut, GLenum typeOut, GLvoid* dataOut);
  50. /** Traditional GLU gluScaleImage function that sets up the PixelStoreModes automatically by doing glGets.;
  51. * The use of glGet's means that you can only call this function from a thread with a valid graphics context.
  52. * The use of glGet's will also result in lower performance due to the round trip to the OpenGL driver.*/
  53. extern OSG_EXPORT GLint gluScaleImage (GLenum format, GLsizei wIn, GLsizei hIn, GLenum typeIn, const void *dataIn, GLsizei wOut, GLsizei hOut, GLenum typeOut, GLvoid* dataOut);
  54. extern OSG_EXPORT GLint gluBuild1DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data);
  55. extern OSG_EXPORT GLint gluBuild1DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, const void *data);
  56. extern OSG_EXPORT GLint gluBuild2DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data);
  57. extern OSG_EXPORT GLint gluBuild2DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *data);
  58. typedef void (GL_APIENTRY * GLTexImage3DProc) ( GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
  59. /** Small variation on normal gluBuild3DMipmapLevels as we pass in the function pointer to glTexImage3D rather than rely on GLU style query for this function pointer.*/
  60. extern OSG_EXPORT GLint gluBuild3DMipmapLevels (GLTexImage3DProc glTextImage3DProc, GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data);
  61. /** Small variation on normal gluBuild3DMipmapLevels as we pass in the function pointer to glTexImage3D rather than rely on GLU style query for this function pointer.*/
  62. extern OSG_EXPORT GLint gluBuild3DMipmaps (GLTexImage3DProc glTextImage3DProc, GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data);
  63. /* ErrorCode */
  64. #define GLU_INVALID_ENUM 100900
  65. #define GLU_INVALID_VALUE 100901
  66. #define GLU_OUT_OF_MEMORY 100902
  67. #define GLU_INCOMPATIBLE_GL_VERSION 100903
  68. #define GLU_INVALID_OPERATION 100904
  69. /* Boolean */
  70. #define GLU_FALSE 0
  71. #define GLU_TRUE 1
  72. /* QuadricDrawStyle */
  73. #define GLU_POINT 100010
  74. #define GLU_LINE 100011
  75. #define GLU_FILL 100012
  76. #define GLU_SILHOUETTE 100013
  77. /* QuadricCallback */
  78. /* GLU_ERROR */
  79. /* QuadricNormal */
  80. #define GLU_SMOOTH 100000
  81. #define GLU_FLAT 100001
  82. #define GLU_NONE 100002
  83. /* QuadricOrientation */
  84. #define GLU_OUTSIDE 100020
  85. #define GLU_INSIDE 100021
  86. /* TessCallback */
  87. #define GLU_TESS_BEGIN 100100
  88. #define GLU_BEGIN 100100
  89. #define GLU_TESS_VERTEX 100101
  90. #define GLU_VERTEX 100101
  91. #define GLU_TESS_END 100102
  92. #define GLU_END 100102
  93. #define GLU_TESS_ERROR 100103
  94. #define GLU_TESS_EDGE_FLAG 100104
  95. #define GLU_EDGE_FLAG 100104
  96. #define GLU_TESS_COMBINE 100105
  97. #define GLU_TESS_BEGIN_DATA 100106
  98. #define GLU_TESS_VERTEX_DATA 100107
  99. #define GLU_TESS_END_DATA 100108
  100. #define GLU_TESS_ERROR_DATA 100109
  101. #define GLU_TESS_EDGE_FLAG_DATA 100110
  102. #define GLU_TESS_COMBINE_DATA 100111
  103. /* TessContour */
  104. #define GLU_CW 100120
  105. #define GLU_CCW 100121
  106. #define GLU_INTERIOR 100122
  107. #define GLU_EXTERIOR 100123
  108. #define GLU_UNKNOWN 100124
  109. /* TessProperty */
  110. #define GLU_TESS_WINDING_RULE 100140
  111. #define GLU_TESS_BOUNDARY_ONLY 100141
  112. #define GLU_TESS_TOLERANCE 100142
  113. /* TessError */
  114. #define GLU_TESS_ERROR1 100151
  115. #define GLU_TESS_ERROR2 100152
  116. #define GLU_TESS_ERROR3 100153
  117. #define GLU_TESS_ERROR4 100154
  118. #define GLU_TESS_ERROR5 100155
  119. #define GLU_TESS_ERROR6 100156
  120. #define GLU_TESS_ERROR7 100157
  121. #define GLU_TESS_ERROR8 100158
  122. #define GLU_TESS_MISSING_BEGIN_POLYGON 100151
  123. #define GLU_TESS_MISSING_BEGIN_CONTOUR 100152
  124. #define GLU_TESS_MISSING_END_POLYGON 100153
  125. #define GLU_TESS_MISSING_END_CONTOUR 100154
  126. #define GLU_TESS_COORD_TOO_LARGE 100155
  127. #define GLU_TESS_NEED_COMBINE_CALLBACK 100156
  128. /* TessWinding */
  129. #define GLU_TESS_WINDING_ODD 100130
  130. #define GLU_TESS_WINDING_NONZERO 100131
  131. #define GLU_TESS_WINDING_POSITIVE 100132
  132. #define GLU_TESS_WINDING_NEGATIVE 100133
  133. #define GLU_TESS_WINDING_ABS_GEQ_TWO 100134
  134. struct GLUtesselator;
  135. typedef GLUtesselator GLUtesselatorObj;
  136. typedef GLUtesselator GLUtriangulatorObj;
  137. #define GLU_TESS_MAX_COORD 1.0e150
  138. /* Internal convenience typedefs */
  139. typedef void (GL_APIENTRY * _GLUfuncptr)();
  140. typedef void (GL_APIENTRY * GLU_TESS_CALLBACK)();
  141. extern OSG_EXPORT GLUtesselator* GL_APIENTRY gluNewTess (void);
  142. extern OSG_EXPORT void GL_APIENTRY gluDeleteTess (GLUtesselator* tess);
  143. extern OSG_EXPORT void GL_APIENTRY gluTessBeginContour (GLUtesselator* tess);
  144. extern OSG_EXPORT void GL_APIENTRY gluTessCallback (GLUtesselator* tess, GLenum which, _GLUfuncptr CallBackFunc);
  145. extern OSG_EXPORT void GL_APIENTRY gluTessEndContour (GLUtesselator* tess);
  146. extern OSG_EXPORT void GL_APIENTRY gluTessNormal (GLUtesselator* tess, GLdouble valueX, GLdouble valueY, GLdouble valueZ);
  147. extern OSG_EXPORT void GL_APIENTRY gluTessProperty (GLUtesselator* tess, GLenum which, GLdouble data);
  148. extern OSG_EXPORT void GL_APIENTRY gluTessVertex (GLUtesselator* tess, GLdouble *location, GLvoid* data);
  149. extern OSG_EXPORT void GL_APIENTRY gluTessBeginPolygon (GLUtesselator* tess, GLvoid* data);
  150. extern OSG_EXPORT void GL_APIENTRY gluTessEndPolygon (GLUtesselator* tess);
  151. extern OSG_EXPORT void GL_APIENTRY gluGetTessProperty( GLUtesselator *tess, GLenum which, GLdouble *value );
  152. }
  153. #endif // __osgGLU_h