Quadric Draw Styles

BlitzMax Forums/BlitzMax OpenGL Programming/Quadric Draw Styles

I maybe missing something out with this example test with the preset shapes, and would love to know what's up with it.

Can anyone see why this code wont render the sphere with the QuadricDrawStyle command?

'----------------------------------
' pre built shapes testies
' SPHERE with Quadric Line Drawing
' thanks: Nehe / Extron / BB & Co.
'---------------------------------- 

Const XRES=640
Const YRES=480
Const RRES= 16

bglCreateContext(XRES,YRES,RRES,0,BGL_BACKBUFFER | BGL_DEPTHBUFFER | BGL_FULLSCREEN)
HideMouse


'
' The Variables
'
Global quadratic:Int Ptr													' Storage For Our Quadratic Objects

Global LightAmbient:Float[]=	[0.5, 0.5, 0.5, 1.0]
Global LightDiffuse:Float[]=	[1.0, 1.0, 1.0, 1.0]
Global LightPosition:Float[]=	[0.0, 0.0, 2.0, 1.0]

Global Texname:Int[3]													' Storage For 3 Textures

Global xrot:Float
Global yrot:Float
Global zrot:Float

InitOpenGL()


'
' the main program loop. 												
'
While Not KeyHit(KEY_ESCAPE) Or MouseHit(1)

	RenderOpenGL	()
	bglSwapBuffers	()
Wend



Function RenderOpenGL()

	glClear 			(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)			' Clear Screen And The Depth Buffer
	glLoadIdentity		()											' Reset Current Modelview Matrix
	glTranslatef		(0.0,0.0,-5)
	glRotatef			(xrot,1.0,0.0,0.0)
	glRotatef			(yrot,0.0,1.0,0.0)
	glRotatef			(zrot,0.0,0.0,1.0)
	glBindTexture		(GL_TEXTURE_2D, Texname[0])
	
	gluQuadricDrawStyle	(quadratic,GLU_LINE)
	gluSphere			(quadratic,1.0,32,32)							' Draw A Sphere 

	xrot:+.1
	yrot:+.1
	zrot:+.1
	
End Function



Function InitOpenGL()
	
	LoadGlTextures		()
	glEnable			(GL_TEXTURE_2D)									' Enable Texture Mapping
	glShadeModel		(GL_SMOOTH)										' Enable Smooth Shading
	glClearColor		(0.0, 0.0, 0.0, 0.5)								' Black Background
	glClearDepth		(1.0)											' Depth Buffer Setup
	glEnable			(GL_DEPTH_TEST)									' Enables Depth Testing
	glDepthFunc		(GL_LEQUAL)										' The Type Of Depth Testing To Do
	glHint			(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST)				' Really Nice Perspective 

	glLightfv			(GL_LIGHT1, GL_AMBIENT, LightAmbient)					' Setup The Ambient Light
	glLightfv			(GL_LIGHT1, GL_DIFFUSE, LightDiffuse)					' Setup The Diffuse Light
	glLightfv			(GL_LIGHT1, GL_POSITION,LightPosition)					' Position The Light
	glEnable			(GL_LIGHT1)										' Enable Light One

	quadratic			=Int Ptr gluNewQuadric()								' Create Pointer To Quadric Object 
	
	gluQuadricNormals	(quadratic, GLU_SMOOTH)								' Create Smooth Normals
	gluQuadricTexture	(quadratic, GL_TRUE)								' Create Texture Coords

	glViewport		(0,0,XRES,YRES)									' Set viewport
	glMatrixMode		(GL_PROJECTION)									' Select The Projection Matrix
	glLoadIdentity		()												' Reset The Projection Matrix
	gluPerspective		(45.0,Float(XRES)/Float(YRES),0.1,100.0)				' Calculate Aspect Ratio 
	glMatrixMode		(GL_MODELVIEW)										' Select The Modelview Matrix
	glLoadIdentity		()

End Function 



Function LoadGLTextures()
	
	Local Text:TPixmap =LoadPixmap("media/texture1.png")

	glGenTextures(1, Varptr Texname[0])									' Create a Texture
	
	
	'
	' Create a MipMapped Texture
	'
	glBindTexture		(GL_TEXTURE_2D, Texname[0])
	glTexParameteri	(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,GL_LINEAR);
	glTexParameteri	(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
	gluBuild2DMipmaps	(GL_TEXTURE_2D, 3, Text.width, Text.height, GL_RGB, GL_UNSIGNED_BYTE, Text.pixels)

End Function


Thanks,
Thumbz