glutSolidSphere and glColorMaterial

I’m having a problem with colouring GLUT spheres using glColorMaterial so that
glColor should set the colour of the next
graphics primitive.

My code works fine with glBegin/glVertex/glEnd but when I try including glutSolidSpheres, I find that I only seem to get 8 colours. I.e. it looks as though I only have 1 bit each of RGB. Any other colour for a sphere gets mapped to one of these colours.

I can’t believe this is a ‘feature’ of GLUT 3.7, so I assume I have installed something wrong or just made a mistake.

Anyone seen anything like this before or have an idea what might be causing this? I’m using
the new NVidia driver for Linux, GLUT 3.7 and GLU 1.3 from SGI.

Originally posted by dmckelvie:
[b]I’m having a problem with colouring GLUT spheres using glColorMaterial so that
glColor should set the colour of the next
graphics primitive.

My code works fine with glBegin/glVertex/glEnd but when I try including glutSolidSpheres, I find that I only seem to get 8 colours. I.e. it looks as though I only have 1 bit each of RGB. Any other colour for a sphere gets mapped to one of these colours.

I can’t believe this is a ‘feature’ of GLUT 3.7, so I assume I have installed something wrong or just made a mistake.

Anyone seen anything like this before or have an idea what might be causing this? I’m using
the new NVidia driver for Linux, GLUT 3.7 and GLU 1.3 from SGI. [/b]

Get the GLUT source and play around with it. The functions that draw the primitives are simple and easy cut and paste directly into your own code.

Jim

Well, solved the problem. Mainly my hairy code to blame - underlying problem was trying to set GL state without a valid GLUT window being available.