Does glColorMaterial track glDrawArrays?

  • Follow


When GL_COLOR_MATERIAL is enabled, calls to glColor* update the
property of the material specificied in glColorMaterial (...).

But what happen when renderering primitives from a data array  stored
in a VBO?
My experiments show it does not update the properties of the material?
Is this the normal behavior? I had a quick look at OGL 1.5 spec and
found nothing about this.

Is there a way to mimic glColorMaterial behavior when using VBO?

Thanks.

0
Reply superbabar51 (4) 3/29/2006 6:34:15 PM

superbabar51@hotmail.com wrote:
> When GL_COLOR_MATERIAL is enabled, calls to glColor* update the
> property of the material specificied in glColorMaterial (...).
> 
> But what happen when renderering primitives from a data array  stored
> in a VBO?

The same should happen. A VBO should work just like a vertex array, and
that should work just like the appropriate loop, except for the values
left in the OpenGL state machine.

> My experiments show it does not update the properties of the material?
> Is this the normal behavior? I had a quick look at OGL 1.5 spec and
> found nothing about this.

If it doesn't work, I would consider it a bug and report it. However,
the bug might be in your code :-)

--
Andy V
0
Reply Andy 3/30/2006 2:32:51 AM


> If it doesn't work, I would consider it a bug and report it.
> However, the bug might be in your code :-)

And it's probably so considering my experience of OpenGL ;-)

It think I found the why lightint doesn't seem to work:
I created a light in the middle of a room composed of 6 polygons (not
triangles) and I was expecting a circle of light on the walls, floor
and ceiling. But OpenGL computes lighting and on a vertex basis,
therefore the color of each polygon can't change in the middle of it.
Thus the conclusion: "lighting does't work!"
I guess I have to consider using normal maps or pixel shaders..
Is that the right way to have the circle of light?

Thanks for you reply!

0
Reply superbabar51 3/30/2006 2:12:15 PM

superbabar51@hotmail.com wrote:
>>If it doesn't work, I would consider it a bug and report it.
>>However, the bug might be in your code :-)
> 
> 
> And it's probably so considering my experience of OpenGL ;-)
> 
> It think I found the why lightint doesn't seem to work:
> I created a light in the middle of a room composed of 6 polygons (not
> triangles) and I was expecting a circle of light on the walls, floor
> and ceiling. But OpenGL computes lighting and on a vertex basis,
> therefore the color of each polygon can't change in the middle of it.
> Thus the conclusion: "lighting does't work!"
> I guess I have to consider using normal maps or pixel shaders..
> Is that the right way to have the circle of light?
> 
> Thanks for you reply!
> 

You have at least two choices.

1. Subdivide the polygons.
2. Use a light map.
3. Do per-pixel lighting using a fragment shader.

--
Andy V
0
Reply Andy 4/1/2006 1:14:58 AM

3 Replies
286 Views

(page loaded in 0.061 seconds)


Reply: