How to use materials with VA's

Started by
1 comment, last by Fibonacci One 19 years, 1 month ago
I'll be using vertex arrays (and eventually vertex buffer objects) to draw my models. Different materials are used with different parts of the models. Is there a way to pass this information to a vertex array? Or do I have to split the object into sections based on material and then when it comes time to draw, set the material properties, draw one subarray, set new material properties, draw another subarray, etc?
Without order nothing can exist - without chaos nothing can evolve.
Advertisement
with the fixed function pipeline and OGL's built in materials system you'll need to split the model up so different parts are draw with the correct material infomation.

Now, if you are using shaders in theory you could setup another stream of data which you could use to pass the per vertex material properties down and have the shaders sort it all out.
You probably want to look into using glEnable(GL_COLOR_MATERIAL) and glColorMaterial(...). You could then use a color array to specify material.

Edit: I've never done this before, this is just an idea.

This topic is closed to new replies.

Advertisement