• Advertisement
Sign in to follow this  

alias wavefront object loading in opengl

This topic is 3372 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 am using nate robbins' glm library for uploading alias wavefront objects. The object has texture applied to it using uv mapping in blender. Now when i use an object viewer program this texure is shown, so i certainly now it has a texture associated with it. But using the glm library i get a white object with no texture. Here is the code ive used: void drawmodel() { if (!pmodel) { pmodel = glmReadOBJ("C:/Documents and Settings/test.obj"); if (!pmodel) exit(0); glmUnitize(pmodel); glmFacetNormals(pmodel); glmVertexNormals(pmodel,90,TRUE); glEnable(GL_TEXTURE_2D); } glmDraw(pmodel, GLM_SMOOTH | GLM_MATERIAL|GLM_TEXTURE); }

Share this post


Link to post
Share on other sites
Advertisement
The textures are described in a material file (.mtl) usually exported alongside the mesh data. Since the material is a separate file, chances are you need to explicitly load it in your code. I'm not familiar with the glm library so I don't know if it supports mtl files, so have a look in the documentation and see if there's a glmReadMaterial or something. :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement