Sign in to follow this  

How to use materials with VA's

This topic is 4663 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 4663 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this