clor \ material problem

Hi All,
this is not really an advanced question, it’s actually really stupid, I just can’t seem to work it out…
any how I posted the question in the beginners forum, but i am not getting any productive help over there, so I thought some of you experts can take a look and resolve the issue ? http://www.opengl.org/discussion_boards/ubb/Forum2/HTML/008513.html
thanks in advance.

Hello…
such a simple problem, and no answers…aren’t you challenged ?

I don’t think you should call glMaterial inside a triangle strip.

>>I don’t think you should call glMaterial >>inside a triangle strip.
why not? I have done it before and it worked fine, beside I get the same strange results with glColor…

Yes, glMaterial is legal - here is a list of legal function calls in a glBegin/glEnd pair:-

glVertex
glColor
glIndex
glNormal
glTexCoord
glEvalCoord
glEvalPoint
glMaterial
glEdgeFlag

Don’t know what your problem is though, snowmaster. What hardware are you running it on? It could be a driver issue.

>>What hardware are you running it on? It >>could be a driver issue.
nope, i have tested it on two computers.

I think the topic of glMaterial between glBegin and glEnd has been discussed before. Yes, it is legal, but not recommended and may have serious performance implications. I think Matt mentioned this in a topic, for quite a long time ago though, saying it was a mistake in the OpenGL design to allow this.
For this reason I wonder how well this is implemented in the drivers.

Yes, but he says the same about immediate mode itself.

>>I think the topic of glMaterial between glBegin and glEnd has been discussed before. Yes, it is legal, but not recommended and may have serious performance implications<<

as it saiz in the faq + red book, in such cases u should use glColorMaterial(…)

I did it also with glColorMaterial(…) …same result…the whole strip is in the color or material of the same vertex…

No clue, but lots of ideas to verify:

  • Have you made sure the normals are correct?
  • You set front and back materials. Do you use two sided lighting?
  • What happens if you only set the front materials?
  • Does it work differently with MS SW OpenGL pixelformats?

Ruling out other things:

  • If this also happens in immediate mode, could it be that your lighting initialization is not done while the context is current. (Then why has the last material call an effect? I don’t know.)
  • Your specular light color is very low. What happens if you set it to white?
  • What are the light positions? (Light types?) Could it be that they are both inside the objects or on the back side and you see the ambient lighting only.

And the rule of thumb: If it is working identically on different OpenGL implementations, it’s probably your code. If only one shows the wrong bahaviour, it’s probably a driver bug.

OK, PROBLEM SOLVED.
I thought about it and came to the obvious conclusion this is not a code problem !!!
but I did tested it on two different computers…so I went and checked on the other computer to see what the hardware spec is, and they have ALMOST nothing in common except…you guessed it the same stupid ATI card…so I went to a third computer with a ge-force 3 card and…everything works fine…
my bad I should have checked it in the first place…sorry…
thanks any how to all of you that tried to help.