OpenGL - Vertex colors with lighting

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Alon
Posts: 7
Joined: Fri May 16, 2014 9:42 pm

OpenGL - Vertex colors with lighting

Post by Alon »

OK, so since OpenGL is overall better than D3D (in my opinion) and more portable, i ported my old project over to OpenGL.
HOWEVER, I noticed a rather bothersome inconsistency with the Dirext3D and OpenGL driver.

For some reason, if I have a model with vertex paint, (using b3d format because nothing else Irrlicht supports works for my purposes) in OpenGL, the vert paint only seems to show when lighting is disabled, otherwise the model's vert colors are set to white and then shaded. Is this a problem with the driver, a limitation of OpenGL it uses, or both?

And if so, what would be the simplest fix for it? I've got no problems with modifying the Irrlicht library, as long as I can fix this somehow. Does anyone have a solution?
Any help would be greatly, greatly appreciated. I rely on vertex colors quite a bit.
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: OpenGL - Vertex colors with lighting

Post by hendu »

You can always write a shader if the fixed pipeline does not satisfy.
Alon
Posts: 7
Joined: Fri May 16, 2014 9:42 pm

Re: OpenGL - Vertex colors with lighting

Post by Alon »

Well, yeah, but I figured it was an oversight in the fixed pipeline that was fixable, and I could avoid setting up shaders for that material entirely.
I'm still learning GLSL and not that good at it yet.

EDIT: Like, can anyone point me to the code where the OpenGL driver interprets and sets vert colors based on vert data so I can have a whack at it?
That would be much appreciated.
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: OpenGL - Vertex colors with lighting

Post by mongoose7 »

Like, Irrlicht passes the vertex colours to OpenGL, so there is no *fix* you can apply. But maybe you could try setting the material colour and see if this makes a difference. There is an OpenGL setting which makes the engine take the colour from the material and I don't know whether this is set or not. Or if it would help or not.
Post Reply