Jump to content
  • Advertisement
Sign in to follow this  
CyberSlag5k

How to use materials with VA's

This topic is 4942 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
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.

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!