43#define PI 3.14159265358979323846
59 if (newstate ==
NULL) {
67 newstate->errorCallback =
NULL;
80 if (qobj->errorCallback) {
81 qobj->errorCallback(
which);
122 switch(orientation) {
168 int needCache2, needCache3;
172 if (slices < 2 || stacks < 1 || baseRadius < 0.0 || topRadius < 0.0 ||
179 deltaRadius = baseRadius - topRadius;
189 needCache2 = needCache3 = 0;
203 zNormal = deltaRadius /
length;
206 for (
i = 0;
i < slices;
i++) {
210 sinCache2[
i] = xyNormalRatio *
SIN(
angle);
211 cosCache2[
i] = xyNormalRatio *
COS(
angle);
213 sinCache2[
i] = -xyNormalRatio *
SIN(
angle);
214 cosCache2[
i] = -xyNormalRatio *
COS(
angle);
222 for (
i = 0;
i < slices;
i++) {
225 sinCache3[
i] = xyNormalRatio *
SIN(
angle);
226 cosCache3[
i] = xyNormalRatio *
COS(
angle);
228 sinCache3[
i] = -xyNormalRatio *
SIN(
angle);
229 cosCache3[
i] = -xyNormalRatio *
COS(
angle);
234 sinCache[slices] = sinCache[0];
235 cosCache[slices] = cosCache[0];
237 sinCache2[slices] = sinCache2[0];
238 cosCache2[slices] = cosCache2[0];
241 sinCache3[slices] = sinCache3[0];
242 cosCache3[slices] = cosCache3[0];
258 for (
j = 0;
j < stacks;
j++) {
260 zHigh = (
j + 1) *
height / stacks;
261 radiusLow = baseRadius - deltaRadius * ((
float)
j / stacks);
262 radiusHigh = baseRadius - deltaRadius * ((
float) (
j + 1) / stacks);
265 for (
i = 0;
i <= slices;
i++) {
283 radiusLow * cosCache[
i], zLow);
286 (
float) (
j+1) / stacks);
289 radiusHigh * cosCache[
i], zHigh);
293 (
float) (
j+1) / stacks);
296 radiusHigh * cosCache[
i], zHigh);
302 radiusLow * cosCache[
i], zLow);
310 for (
i = 0;
i < slices;
i++) {
320 sintemp = sinCache[
i];
321 costemp = cosCache[
i];
322 for (
j = 0;
j <= stacks;
j++) {
324 radiusLow = baseRadius - deltaRadius * ((
float)
j / stacks);
331 radiusLow * costemp, zLow);
337 for (
j = 1;
j < stacks;
j++) {
339 radiusLow = baseRadius - deltaRadius * ((
float)
j / stacks);
342 for (
i = 0;
i <= slices;
i++) {
359 radiusLow * cosCache[
i], zLow);
365 for (
j = 0;
j <= stacks;
j += stacks) {
367 radiusLow = baseRadius - deltaRadius * ((
float)
j / stacks);
370 for (
i = 0;
i <= slices;
i++) {
386 glVertex3f(radiusLow * sinCache[
i], radiusLow * cosCache[
i],
391 for (
i = 0;
i < slices;
i++) {
401 sintemp = sinCache[
i];
402 costemp = cosCache[
i];
404 for (
j = 0;
j <= stacks;
j++) {
406 radiusLow = baseRadius - deltaRadius * ((
float)
j / stacks);
413 radiusLow * costemp, zLow);
427 gluPartialDisk(qobj, innerRadius, outerRadius, slices, loops, 0.0, 360.0);
442 GLfloat texLow = 0.0, texHigh = 0.0;
448 if (slices < 2 || loops < 1 || outerRadius <= 0.0 || innerRadius < 0.0 ||
449 innerRadius > outerRadius) {
454 if (sweepAngle < -360.0) sweepAngle = 360.0;
455 if (sweepAngle > 360.0) sweepAngle = 360.0;
456 if (sweepAngle < 0) {
457 startAngle += sweepAngle;
458 sweepAngle = -sweepAngle;
461 if (sweepAngle == 360.0) {
464 slices2 = slices + 1;
468 deltaRadius = outerRadius - innerRadius;
472 angleOffset = startAngle / 180.0 *
PI;
473 for (
i = 0;
i <= slices;
i++) {
474 angle = angleOffset + ((
PI * sweepAngle) / 180.0) *
i / slices;
479 if (sweepAngle == 360.0) {
480 sinCache[slices] = sinCache[0];
481 cosCache[slices] = cosCache[0];
500 if (innerRadius == 0.0) {
508 radiusLow = outerRadius -
509 deltaRadius * ((
float) (loops-1) / loops);
511 texLow = radiusLow / outerRadius / 2;
515 for (
i = slices;
i >= 0;
i--) {
518 texLow * cosCache[
i] + 0.5);
521 radiusLow * cosCache[
i], 0.0);
524 for (
i = 0;
i <= slices;
i++) {
527 texLow * cosCache[
i] + 0.5);
530 radiusLow * cosCache[
i], 0.0);
538 radiusLow = outerRadius - deltaRadius * ((
float)
j / loops);
539 radiusHigh = outerRadius - deltaRadius * ((
float) (
j + 1) / loops);
541 texLow = radiusLow / outerRadius / 2;
542 texHigh = radiusHigh / outerRadius / 2;
546 for (
i = 0;
i <= slices;
i++) {
550 texLow * cosCache[
i] + 0.5);
553 radiusLow * cosCache[
i], 0.0);
557 texHigh * cosCache[
i] + 0.5);
560 radiusHigh * cosCache[
i], 0.0);
564 texHigh * cosCache[
i] + 0.5);
567 radiusHigh * cosCache[
i], 0.0);
571 texLow * cosCache[
i] + 0.5);
574 radiusLow * cosCache[
i], 0.0);
582 for (
i = 0;
i < slices2;
i++) {
583 sintemp = sinCache[
i];
584 costemp = cosCache[
i];
585 for (
j = 0;
j <= loops;
j++) {
586 radiusLow = outerRadius - deltaRadius * ((
float)
j / loops);
589 texLow = radiusLow / outerRadius / 2;
592 texLow * cosCache[
i] + 0.5);
594 glVertex3f(radiusLow * sintemp, radiusLow * costemp, 0.0);
600 if (innerRadius == outerRadius) {
603 for (
i = 0;
i <= slices;
i++) {
606 cosCache[
i] / 2 + 0.5);
609 innerRadius * cosCache[
i], 0.0);
614 for (
j = 0;
j <= loops;
j++) {
615 radiusLow = outerRadius - deltaRadius * ((
float)
j / loops);
617 texLow = radiusLow / outerRadius / 2;
621 for (
i = 0;
i <= slices;
i++) {
624 texLow * cosCache[
i] + 0.5);
627 radiusLow * cosCache[
i], 0.0);
631 for (
i=0;
i < slices2;
i++) {
632 sintemp = sinCache[
i];
633 costemp = cosCache[
i];
635 for (
j = 0;
j <= loops;
j++) {
636 radiusLow = outerRadius - deltaRadius * ((
float)
j / loops);
638 texLow = radiusLow / outerRadius / 2;
643 texLow * cosCache[
i] + 0.5);
645 glVertex3f(radiusLow * sintemp, radiusLow * costemp, 0.0);
651 if (sweepAngle < 360.0) {
652 for (
i = 0;
i <= slices;
i+= slices) {
653 sintemp = sinCache[
i];
654 costemp = cosCache[
i];
656 for (
j = 0;
j <= loops;
j++) {
657 radiusLow = outerRadius - deltaRadius * ((
float)
j / loops);
660 texLow = radiusLow / outerRadius / 2;
662 texLow * cosCache[
i] + 0.5);
664 glVertex3f(radiusLow * sintemp, radiusLow * costemp, 0.0);
669 for (
j = 0;
j <= loops;
j += loops) {
670 radiusLow = outerRadius - deltaRadius * ((
float)
j / loops);
672 texLow = radiusLow / outerRadius / 2;
676 for (
i = 0;
i <= slices;
i++) {
679 texLow * cosCache[
i] + 0.5);
682 radiusLow * cosCache[
i], 0.0);
685 if (innerRadius == outerRadius)
break;
711 GLfloat sintemp1 = 0.0, sintemp2 = 0.0, sintemp3 = 0.0, sintemp4 = 0.0;
712 GLfloat costemp1 = 0.0, costemp2 = 0.0, costemp3 = 0.0, costemp4 = 0.0;
718 if (slices < 2 || stacks < 1 || radius < 0.0) {
741 for (
i = 0;
i < slices;
i++) {
746 sinCache2a[
i] = sinCache1a[
i];
747 cosCache2a[
i] = cosCache1a[
i];
751 for (
j = 0;
j <= stacks;
j++) {
767 sinCache1b[stacks] = 0;
770 for (
i = 0;
i < slices;
i++) {
775 for (
j = 0;
j <= stacks;
j++) {
787 sinCache1a[slices] = sinCache1a[0];
788 cosCache1a[slices] = cosCache1a[0];
790 sinCache2a[slices] = sinCache2a[0];
791 cosCache2a[slices] = cosCache2a[0];
794 sinCache3a[slices] = sinCache3a[0];
795 cosCache3a[slices] = cosCache3a[0];
810 sintemp2 = sinCache1b[1];
811 zHigh = cosCache1b[1];
814 sintemp3 = sinCache3b[1];
815 costemp3 = cosCache3b[1];
818 sintemp3 = sinCache2b[1];
819 costemp3 = cosCache2b[1];
821 cosCache2a[0] * sinCache2b[0],
830 for (
i = slices;
i >= 0;
i--) {
834 cosCache2a[
i] * sintemp3,
840 cosCache3a[
i+1] * sintemp3,
849 sintemp2 * cosCache1a[
i], zHigh);
852 for (
i = 0;
i <= slices;
i++) {
856 cosCache2a[
i] * sintemp3,
861 cosCache3a[
i] * sintemp3,
869 sintemp2 * cosCache1a[
i], zHigh);
875 sintemp2 = sinCache1b[stacks-1];
876 zHigh = cosCache1b[stacks-1];
879 sintemp3 = sinCache3b[stacks];
880 costemp3 = cosCache3b[stacks];
883 sintemp3 = sinCache2b[stacks-1];
884 costemp3 = cosCache2b[stacks-1];
885 glNormal3f(sinCache2a[stacks] * sinCache2b[stacks],
886 cosCache2a[stacks] * sinCache2b[stacks],
895 for (
i = 0;
i <= slices;
i++) {
899 cosCache2a[
i] * sintemp3,
904 cosCache3a[
i] * sintemp3,
912 sintemp2 * cosCache1a[
i], zHigh);
915 for (
i = slices;
i >= 0;
i--) {
919 cosCache2a[
i] * sintemp3,
925 cosCache3a[
i+1] * sintemp3,
934 sintemp2 * cosCache1a[
i], zHigh);
943 zLow = cosCache1b[
j];
944 zHigh = cosCache1b[
j+1];
945 sintemp1 = sinCache1b[
j];
946 sintemp2 = sinCache1b[
j+1];
949 sintemp4 = sinCache3b[
j+1];
950 costemp4 = cosCache3b[
j+1];
954 sintemp3 = sinCache2b[
j+1];
955 costemp3 = cosCache2b[
j+1];
956 sintemp4 = sinCache2b[
j];
957 costemp4 = cosCache2b[
j];
959 sintemp3 = sinCache2b[
j];
960 costemp3 = cosCache2b[
j];
961 sintemp4 = sinCache2b[
j+1];
962 costemp4 = cosCache2b[
j+1];
970 for (
i = 0;
i <= slices;
i++) {
974 cosCache2a[
i] * sintemp3,
985 1 - (
float) (
j+1) / stacks);
988 sintemp2 * cosCache1a[
i], zHigh);
992 1 - (
float)
j / stacks);
995 sintemp1 * cosCache1a[
i], zLow);
1000 cosCache2a[
i] * sintemp4,
1005 cosCache3a[
i] * sintemp4,
1015 1 - (
float)
j / stacks);
1018 sintemp1 * cosCache1a[
i], zLow);
1022 1 - (
float) (
j+1) / stacks);
1025 sintemp2 * cosCache1a[
i], zHigh);
1033 for (
j = 0;
j <= stacks;
j++) {
1034 sintemp1 = sinCache1b[
j];
1035 costemp1 = cosCache1b[
j];
1039 sintemp2 = sinCache2b[
j];
1040 costemp2 = cosCache2b[
j];
1045 for (
i = 0;
i < slices;
i++) {
1050 cosCache2a[
i] * sintemp2,
1058 zLow =
j * radius / stacks;
1062 1 - (
float)
j / stacks);
1065 sintemp1 * cosCache1a[
i], costemp1);
1072 for (
j = 1;
j < stacks;
j++) {
1073 sintemp1 = sinCache1b[
j];
1074 costemp1 = cosCache1b[
j];
1078 sintemp2 = sinCache2b[
j];
1079 costemp2 = cosCache2b[
j];
1086 for (
i = 0;
i <= slices;
i++) {
1090 cosCache3a[
i] * sintemp2,
1095 cosCache2a[
i] * sintemp2,
1104 1 - (
float)
j / stacks);
1107 sintemp1 * cosCache1a[
i], costemp1);
1111 for (
i = 0;
i < slices;
i++) {
1112 sintemp1 = sinCache1a[
i];
1113 costemp1 = cosCache1a[
i];
1117 sintemp2 = sinCache2a[
i];
1118 costemp2 = cosCache2a[
i];
1125 for (
j = 0;
j <= stacks;
j++) {
1129 costemp2 * sinCache3b[
j],
1134 costemp2 * sinCache2b[
j],
1144 1 - (
float)
j / stacks);
1147 costemp1 * sinCache1b[
j], cosCache1b[
j]);
#define GLU_INVALID_VALUE
GLAPI void GLAPIENTRY glTexCoord2f(GLfloat s, GLfloat t)
GLAPI void GLAPIENTRY glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
GLAPI void GLAPIENTRY glBegin(GLenum mode)
GLAPI void GLAPIENTRY glVertex3f(GLfloat x, GLfloat y, GLfloat z)
GLint GLint GLsizei GLsizei height
GLAPI void GLAPIENTRY glEnd(void)
GLuint GLsizei GLsizei * length
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
#define gluQuadricCallback
#define gluQuadricNormals
#define gluQuadricOrientation
#define gluQuadricTexture
#define gluQuadricDrawStyle
static float(__cdecl *square_half_float)(float x
static void gluQuadricError(GLUquadric *qobj, GLenum which)
GLUquadric *GLAPIENTRY gluNewQuadric(void)
void(GLAPIENTRY *errorCallback)(GLint)
static GLenum _GLUfuncptr fn
void(WINAPI * _GLUfuncptr)(void)