glColour3f doesn't work on my gluSphere

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).]

When using GL lighting you need to specify materials for objects you draw.

Although I always thought the default material was solid white, not black.

Pete

Try use glutWireSphere instead, just to see that nothing is wrong with the way you draw your sphere.

glutWireSphere(m_Radius,15,10);

Probably should have used that from the beginning. The problem however isn’t fixed…

As a matter of interest, I placed a light next to the object within the sphere and it gets lit while the sphere does not.

Then I commented out the disabling of lighting in the above function. The sphere is not affected by lighting.

This is quite odd…

Try looking at gluQuadricNormals.

I have lighting turned off, what would normals have anything to do with it? Besides I’m now using glutWireSphere.

Any other takers?

Got it!

I was screwing with the texture loader when it broke. All the spheres turned white.

!!!

The Sphere was attempting to use the currently bound texture.

That means I have a few things to fix…