Here are some more pure SDK primitives
Low level sphere primitive
SUB DrawGLSphere (BYVAL sRadius AS SINGLE, BYVAL nFirst AS LONG, nLast AS LONG)
LOCAL I, J AS LONG
LOCAL dtr AS SINGLE: dtr = 0.0174532925199432957## ' To convert degree to radian
LOCAL sA, sX, sZ, sY1, sY2, sV1, sV2 AS SINGLE
LOCAL i360 AS SINGLE
LOCAL nStep AS LONG: nStep = 6 'MAX&((nSlice \ (50 * sRadius)) * 10, 5) ' Reduce triangle count with distance/size
CALL glPushMatrix()
CALL glScalef(sRadius, sRadius, sRadius)
LOCAL nMax AS LONG: nMax = 180 - nStep
FOR J = 0 TO nMax STEP nStep
sY1 = COS(J * dtr): sY2 = COS((J + nStep) * dtr)
sV1 = SQR(1 - (sY1 * sY1)): sV2 = SQR(1 - (sY2 * sY2))
CALL glBegin(&H0005) '// %TRIANGLE_STRIP
FOR I = nFirst TO nLast STEP nStep ' use 180 for front half only
sA = I * dtr
sX = COS(sA) * sV1: sZ = SIN(sA) * sV1
i360 = 1 - I / 360
CALL glTexCoord2f(i360, (1 - J) / 180)
CALL glNormal3f(sX + sX, sY1 + sY1, sZ + sZ)
CALL glVertex3f(sX, sY1, sZ)
sX = COS(sA) * sV2: sZ = SIN(sA) * sV2
CALL glTexCoord2f(i360, (1 - (J + nStep)) / 180)
CALL glNormal3f(sX + sX, sY2 + sY2, sZ + sZ)
CALL glVertex3f(sX, sY2, sZ)
NEXT
CALL glEnd()
NEXT
CALL glPopMatrix()
END SUB
Cup
SUB DrawCup (BYVAL sRadius AS SINGLE, BYVAL nTexture AS LONG)
IF nTexture THEN CALL glBindTexture(%TEXTURE_2D, nTexture)
CALL DrawGLSphere(sRadius, 0, 180)
END SUB
Dome
SUB DrawDome (BYVAL sRadius AS SINGLE, BYVAL nTexture AS LONG)
IF nTexture THEN CALL glBindTexture(%TEXTURE_2D, nTexture)
CALL DrawGLSphere(sRadius, 180, 360)
END SUB
Cylinder
SUB DrawCylinder (BYVAL Radius AS SINGLE, BYVAL Value AS SINGLE, BYVAL R1 AS SINGLE, BYVAL R2 AS SINGLE, BYVAL nTexture AS LONG)
LOCAL quadObj, Slice AS LONG
IF nTexture THEN CALL glBindTexture(%TEXTURE_2D, nTexture)
quadObj = gluNewQuadric() ' Pointer to the Quadric Object (Return 0 If No Memory))
IF quadObj THEN
CALL gluQuadricNormals(quadObj, %GLU_SMOOTH) ' Create Smooth Normals
CALL gluQuadricTexture(quadObj, %TRUE) ' Create Texture Coords
IF R1 > 1.0 or R2 > 1.0 THEN Slice = 32 ELSE Slice = 24
CALL gluCylinder(quadObj, Radius * R1, Radius * R2, Value, Slice, 1)
CALL gluDeleteQuadric(quadObj)
END IF
END SUB
Disk
SUB DrawDisk (BYVAL Radius AS SINGLE, BYVAL nTexture AS LONG)
IF nTexture THEN CALL glBindTexture(%TEXTURE_2D, nTexture)
LOCAL quadObj AS LONG
quadObj = gluNewQuadric() ' Pointer to the Quadric Object (Return 0 If No Memory))
IF quadObj THEN
CALL gluQuadricNormals(quadObj, %GLU_SMOOTH) ' Create Smooth Normals
CALL gluQuadricTexture(quadObj, %TRUE) ' Create Texture Coords
CALL gluDisk(quadObj, 0.0, Radius, 32, 32)
CALL gluDeleteQuadric(quadObj)
END IF
END SUB
Sphere
SUB DrawSphere (BYVAL sRadius AS SINGLE, BYVAL nTexture AS LONG)
IF nTexture THEN CALL glBindTexture(%TEXTURE_2D, nTexture)
CALL DrawGLSphere(sRadius, 0, 360)
END SUB
Cube front face
SUB DrawCubeFrontFace (BYVAL nTexture AS LONG)
IF nTexture THEN CALL glBindTexture(%TEXTURE_2D, nTexture)
CALL glBegin(&H0007) ' %QUADS
' Front Face
'CALL glNormal3f(0.0, 0.0, 0.5)
CALL glTexCoord2f(0.0, 0.0): CALL glVertex3f(-1.0,-1.0, 1.0) ' Bottom Left Of The Texture And Quad
CALL glTexCoord2f(1.0, 0.0): CALL glVertex3f( 1.0,-1.0, 1.0) ' Bottom Right Of The Texture And Quad
CALL glTexCoord2f(1.0, 1.0): CALL glVertex3f( 1.0, 1.0, 1.0) ' Top Right Of The Texture And Quad
CALL glTexCoord2f(0.0, 1.0): CALL glVertex3f(-1.0, 1.0, 1.0) ' Top Left Of The Texture And Quad
CALL glEnd()
END SUB
Cube back face
SUB DrawCubeBackFace (BYVAL nTexture AS LONG)
IF nTexture THEN CALL glBindTexture(%TEXTURE_2D, nTexture)
CALL glBegin(&H0007) ' %QUADS
' Back Face
'CALL glNormal3f(0.0, 0.0,-0.5)
CALL glTexCoord2f(1.0, 0.0): CALL glVertex3f(-1.0,-1.0,-1.0) ' Bottom Right Of The Texture And Quad
CALL glTexCoord2f(1.0, 1.0): CALL glVertex3f(-1.0, 1.0,-1.0) ' Top Right Of The Texture And Quad
CALL glTexCoord2f(0.0, 1.0): CALL glVertex3f( 1.0, 1.0,-1.0) ' Top Left Of The Texture And Quad
CALL glTexCoord2f(0.0, 0.0): CALL glVertex3f( 1.0,-1.0,-1.0) ' Bottom Left Of The Texture And Quad
CALL glEnd()
END SUB
Cube top face
SUB DrawCubeTopFace (BYVAL nTexture AS LONG)
IF nTexture THEN CALL glBindTexture(%TEXTURE_2D, nTexture)
CALL glBegin(&H0007) ' %QUADS
' Top Face
'CALL glNormal3f(0.0, 0.5, 0.0)
CALL glTexCoord2f(0.0, 1.0): CALL glVertex3f(-1.0, 1.0,-1.0) ' Top Left Of The Texture And Quad
CALL glTexCoord2f(0.0, 0.0): CALL glVertex3f(-1.0, 1.0, 1.0) ' Bottom Left Of The Texture And Quad
CALL glTexCoord2f(1.0, 0.0): CALL glVertex3f( 1.0, 1.0, 1.0) ' Bottom Right Of The Texture And Quad
CALL glTexCoord2f(1.0, 1.0): CALL glVertex3f( 1.0, 1.0,-1.0) ' Top Right Of The Texture And Quad
CALL glEnd()
END SUB
Cube bottom face
SUB DrawCubeBottomFace (BYVAL nTexture AS LONG)
IF nTexture THEN CALL glBindTexture(%TEXTURE_2D, nTexture)
CALL glBegin(&H0007) ' %QUADS
' Bottom Face
'CALL glNormal3f(0.0,-0.5, 0.0)
CALL glTexCoord2f(1.0, 1.0): CALL glVertex3f(-1.0,-1.0,-1.0) ' Top Right Of The Texture And Quad
CALL glTexCoord2f(0.0, 1.0): CALL glVertex3f( 1.0,-1.0,-1.0) ' Top Left Of The Texture And Quad
CALL glTexCoord2f(0.0, 0.0): CALL glVertex3f( 1.0,-1.0, 1.0) ' Bottom Left Of The Texture And Quad
CALL glTexCoord2f(1.0, 0.0): CALL glVertex3f(-1.0,-1.0, 1.0) ' Bottom Right Of The Texture And Quad
CALL glEnd()
END SUB
Cube right face
SUB DrawCubeRightFace (BYVAL nTexture AS LONG)
IF nTexture THEN CALL glBindTexture(%TEXTURE_2D, nTexture)
CALL glBegin(&H0007) ' %QUADS
' Right face
'CALL glNormal3f(0.5, 0.0, 0.0)
CALL glTexCoord2f(1.0, 0.0): CALL glVertex3f( 1.0,-1.0,-1.0) ' Bottom Right Of The Texture And Quad
CALL glTexCoord2f(1.0, 1.0): CALL glVertex3f( 1.0, 1.0,-1.0) ' Top Right Of The Texture And Quad
CALL glTexCoord2f(0.0, 1.0): CALL glVertex3f( 1.0, 1.0, 1.0) ' Top Left Of The Texture And Quad
CALL glTexCoord2f(0.0, 0.0): CALL glVertex3f( 1.0,-1.0, 1.0) ' Bottom Left Of The Texture And Quad
CALL glEnd()
END SUB
Cube left face
SUB DrawCubeLeftFace (BYVAL nTexture AS LONG)
IF nTexture THEN CALL glBindTexture(%TEXTURE_2D, nTexture)
CALL glBegin(&H0007) ' %QUADS
' Left Face
'CALL glNormal3f(-0.5, 0.0, 0.0)
CALL glTexCoord2f(0.0, 0.0): CALL glVertex3f(-1.0,-1.0,-1.0) ' Bottom Left Of The Texture And Quad
CALL glTexCoord2f(1.0, 0.0): CALL glVertex3f(-1.0,-1.0, 1.0) ' Bottom Right Of The Texture And Quad
CALL glTexCoord2f(1.0, 1.0): CALL glVertex3f(-1.0, 1.0, 1.0) ' Top Right Of The Texture And Quad
CALL glTexCoord2f(0.0, 1.0): CALL glVertex3f(-1.0, 1.0,-1.0) ' Top Left Of The Texture And Quad
CALL glEnd()
END SUB
Cube
SUB DrawCube (BYVAL nTexture AS LONG)
IF nTexture THEN CALL glBindTexture(%TEXTURE_2D, nTexture)
CALL DrawCubeFrontFace(0)
CALL DrawCubeBackFace(0)
CALL DrawCubeTopFace(0)
CALL DrawCubeBottomFace(0)
CALL DrawCubeRightFace(0)
CALL DrawCubeLeftFace(0)
END SUB