elect
elect

Reputation: 7190

OpenGL, interleaved VBO (vertex, normal and color) with light

I have an interleaved VBO containing vertexes, normals and colors. Everything works as espected.

I want to have lights as well, but if I enable it, then colors are not working any more.

I guess this is because lights dont work with gl.glColor, but with color materials (as also here specified, first question)

So, taking in account that I need to render no more than 10000 triangles and I need to switch color 3 times during the rendering, which is the best strategy that fits my needs?

Ps: I am also rendering several millions of triangles with other VBOs (but with just a color per VBO), so I guess gl.glBegin does not represent a valid option for me..

Upvotes: 2

Views: 868

Answers (1)

keltar
keltar

Reputation: 18399

If your hardware doesn't support shaders, you can use glColorMaterial(GL_FRONT, GL_DIFFUSE) and glEnable(GL_COLOR_MATERIAL).

Upvotes: 2

Related Questions