Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenGL - loading an object with multiple texture

I'm trying to draw a quadcopter model using OpenGL. The quadcopter object has an .obj file, an .mtl file and three .tga file for texturing(one for rotors, one for body, one for guns).

My problem is I don't know how to apply these three textures on the object. Should I split the object in three. Are there more any simpler and more efficient way?

like image 230
user3817833 Avatar asked Feb 07 '26 16:02

user3817833


1 Answers

The simplest way is to split the object into three distinct objects, otherwise you would need some method of identifying which texture the texture coordinates sample. This would require additional information for every single vertex in the model.

I'm not familiar with the obj format, but most formats I have worked with separate objects with different materials into separate meshes, with each mesh referencing a single material.

like image 175
Homar Avatar answered Feb 09 '26 07:02

Homar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!