PDA

View Full Version : clor \ material problem



snow_master
05-09-2002, 04:46 AM
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.

snow_master
05-12-2002, 02:50 PM
Hello......
such a simple problem, and no answers....aren't you challenged ?

Humus
05-12-2002, 03:08 PM
I don't think you should call glMaterial inside a triangle strip.

snow_master
05-13-2002, 09:38 AM
>>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.....

knackered
05-13-2002, 09:46 AM
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.

snow_master
05-13-2002, 09:48 AM
>>What hardware are you running it on? It >>could be a driver issue.
nope, i have tested it on two computers.

Humus
05-13-2002, 10:19 AM
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.

knackered
05-13-2002, 12:27 PM
http://www.opengl.org/discussion_boards/ubb/smile.gif Yes, but he says the same about immediate mode itself.

zed
05-13-2002, 12:51 PM
>>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(..)

snow_master
05-13-2002, 02:23 PM
I did it also with glColorMaterial(..) ....same result....the whole strip is in the color or material of the same vertex....

Relic
05-14-2002, 03:30 AM
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.

snow_master
05-14-2002, 09:17 AM
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.