gimp
02-12-2001, 09:34 PM
Here is some code:
/*-----------------------------------------------------------------------------
Slow and nasty wireframe sphere drawing. Upside is it requires no storage.
-----------------------------------------------------------------------------*/
void CSphere: :Draw(void) const
{
glPushAttrib(GL_LIGHTING_BIT | GL_CURRENT_BIT);
glDisable(GL_LIGHTING);
glPushMatrix();
glTranslatef(m_Centre.x, m_Centre.y, m_Centre.z);
glColor3f(1.0f,1.0f,1.0f);
GLUquadricObj *SphereObj = gluNewQuadric();
gluQuadricDrawStyle(SphereObj, GLU_LINE);
gluSphere(SphereObj, m_Radius, 15, 10);
gluDeleteQuadric(SphereObj);
glPopMatrix();
glPopAttrib();
}
As you can see I've tried to insulate the function from my main codebase, though for some reason the wireframe still remains black...
Note : This functions is a simple way for me to see a sphere primitive in game, hence I don't use any local storage. This is used to see bounding spheres during collision test debugging.
Many thanks
Chris
[This message has been edited by gimp (edited 02-12-2001).]
/*-----------------------------------------------------------------------------
Slow and nasty wireframe sphere drawing. Upside is it requires no storage.
-----------------------------------------------------------------------------*/
void CSphere: :Draw(void) const
{
glPushAttrib(GL_LIGHTING_BIT | GL_CURRENT_BIT);
glDisable(GL_LIGHTING);
glPushMatrix();
glTranslatef(m_Centre.x, m_Centre.y, m_Centre.z);
glColor3f(1.0f,1.0f,1.0f);
GLUquadricObj *SphereObj = gluNewQuadric();
gluQuadricDrawStyle(SphereObj, GLU_LINE);
gluSphere(SphereObj, m_Radius, 15, 10);
gluDeleteQuadric(SphereObj);
glPopMatrix();
glPopAttrib();
}
As you can see I've tried to insulate the function from my main codebase, though for some reason the wireframe still remains black...
Note : This functions is a simple way for me to see a sphere primitive in game, hence I don't use any local storage. This is used to see bounding spheres during collision test debugging.
Many thanks
Chris
[This message has been edited by gimp (edited 02-12-2001).]