PDA

View Full Version : glutSolidSphere and glColorMaterial



dmckelvie
04-09-2002, 09:45 AM
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.

jmathies
04-09-2002, 02:24 PM
Originally posted by dmckelvie:
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.


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

dmckelvie
04-10-2002, 08:20 AM
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.