Sign in to follow this  
tergino

alias wavefront object loading in opengl

Recommended Posts

tergino    122
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
cmv    180
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

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