PDA

View Full Version : OBJ groups & Texture shading



perrya
06-09-2013, 09:18 PM
The OBJ file format can break the object down into a series of groups. I tried creating multiple element buffers based on the number of groups found in the OBJ file. I then sequentially issued a draw() on each element buffer. The object did not draw correctly.

I guess the overriding question is, if there are multiple textures and texture specifications for a given OBJ file, whats the best way to implement this in OpenGL ?

carsten neumann
06-10-2013, 10:50 AM
Splitting the rendering of an object into multiple draw calls in order to switch textures (or other state) in between is on option (probably most general and easiest to implement, so best in that sense ;) ). You could bind multiple textures (or use array textures) and draw groups of sub-objects at once, but then you'd need to add a vertex attribute to distinguish which texture to use for each face.
For help to figure out why your multiple draw calls approach is not working you'll have to supply more details of course :)