OpenGL doesn't render vertex color data

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
WhiteNoise

OpenGL doesn't render vertex color data

Post by WhiteNoise »

I'm currently using version 0.12. It works if Lighting is set to False, but not otherwise.. Any ideas on how to fix this? I believe it works in DirectX, but I need to use openGL.

-Dave
Vox
Posts: 47
Joined: Fri Apr 01, 2005 5:25 pm

Post by Vox »

Try glEnable(GL_COLOR_MATERIAL) in CVideoOpenGLWin32::initDriver.
WhiteNoise

Post by WhiteNoise »

Yay! That worked. Thanks Vox.
tonic
Posts: 69
Joined: Mon Dec 10, 2007 6:18 pm
Contact:

Post by tonic »

Is there any reason why this isn't the default behavior?

Vertex colors seem to work with D3D, but not with OpenGL (if lighting is enabled) because there's no call to glEnable(GL_COLOR_MATERIAL). However, even glColorPointer is called, so it even looks like the intention is to use the vertex colors.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

No, I don't think it's intended, I'll check possible dependencies and add it if there are none.
tonic
Posts: 69
Joined: Mon Dec 10, 2007 6:18 pm
Contact:

Post by tonic »

hybrid wrote:No, I don't think it's intended, I'll check possible dependencies and add it if there are none.
At least in my case this just fixes it to work like the d3d driver does. However, I have only tested this with some basic material types like EMT_SOLID.
tonic
Posts: 69
Joined: Mon Dec 10, 2007 6:18 pm
Contact:

Post by tonic »

tonic wrote:
hybrid wrote:No, I don't think it's intended, I'll check possible dependencies and add it if there are none.
At least in my case this just fixes it to work like the d3d driver does. However, I have only tested this with some basic material types like EMT_SOLID.
Some further notes... without the color material enabled, node's Material DiffuseColor can be used to change the whole object's color. With the color material one needs to update all the vertex colors. (this is how it works w/OpenGL driver)

With D3D driver it seems to currently work like you are always using vertex colors. To use Material's DiffuseColor I think the driver/material renderers would need to be modified to disable D3DRS_COLORVERTEX (and/or fiddle with D3DRS_DIFFUSEMATERIALSOURCE etc). Can somebody tell if the Material's Colors currently actually even do anything with D3D driver? Like, in which case it affects objects when tested in irrEdit?


I'd like to be able to control on per-object basis which way the object is colored (diffuse, ambient etc) -- either with vertex colors or with the colors set in Material of the object. Or both at the same time (multiplied) if it is somehow possible.
Munger
Posts: 28
Joined: Sun Mar 04, 2007 11:39 am
Location: Tokyo

Post by Munger »

Quite a few years ago, I remember finding that GL_COLOR_MATERIAL had really bad performance. I can't even be certain (it was a long time ago), but it might be worth doing some performance tests on a few video cards to check it will perform OK.
Post Reply