GLU_FILL is the default. The sphere will render just fine without calling gluQuadricDrawstyle(). I'll probably add a Setstyle() function to my class eventually, but for the time being, my priorety is to get a functioning CSphere object first, then add to it.
By the way, gluQuadricDrawstyle() will also take GLU_SILHOUETTE and GLU_POINT.
I did manage to solve the problem myself though. I moved the rest of the initialization out of the constructor and into the Init() function and it worked fine.
My next project is to assign it member texture and bumpmaps. Here's the complete object:
Declaration:
#ifndef __csphere_h_#ifndef __CSPHERE_H__#define __csphere_h_#define _CSPHERE_H__#ifdef __cplusplusextern "C" {#endif#include <windows.h>//////////////////////////////////////////////////////////////////////////////////CSphere class//////////////////////////////////////////////////////////////////////////////// class CSphere { public: CSphere(); ~CSphere(); bool Init(float fRadius , int nLats , int nLongs); void Draw(); float Radius() {return m_fRadius;}; int Latitude() {return m_nLats;}; int Longitude() {return m_nLongs;}; private: GLUquadricObj *ball; float m_fRadius; int m_nLats; int m_nLongs; };#ifdef __cplusplus}#endif#endif /*__CSPHERE_H__ */#endif /*__csphere_h_*/
Definitions:
#include <windows.h>#include <math.h>#include <gl/gl.h>#include <gl/glu.h>#include <gl/glaux.h>#include "CSphere.h"////////////////////////////////////////////////////////////////////////////////// CSphere Members////////////////////////////////////////////////////////////////////////////////CSphere::CSphere(){}CSphere::~CSphere(){ gluDeleteQuadric(ball);} bool CSphere::Init(float fRadius , int nLats , int nLongs){ bool bReturn = true; m_fRadius = fRadius; m_nLats = nLats; m_nLongs = nLongs; ball = gluNewQuadric(); gluQuadricNormals(ball,GLU_SMOOTH); return bReturn;}void CSphere::Draw(){ gluSphere(ball, m_fRadius, m_nLats, m_nLongs);}
I know this is all beginner stuff to most of you, but I feel I should share what this community helped me build.
[Edited by - dreamtwister on May 31, 2007 12:53:01 AM]