Jump to content
  • Advertisement
Sign in to follow this  
DarkDemon

OpenGL Rendering .obj data

This topic is 3715 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

Hey there, I'm rather new around here and with using Opengl. I'm working on a project and having some problems with modelling. I've used blender to create a simple recentangle, I've then saved this as an obj and manually added the vertex and facet information to the arrays. Oddly when the code is excuted it seems as if some of the points are off. I assume blender takes care of winding things correctly and such. I've tried modelling other shapes but still having poor results, either it doesnt look like the object I've modelled or some of the points are wrong. glVertex3f(vertex[facet[0]][0],vertex[facet[0]][1],vertex[facet[0]][2]); [Edited by - DarkDemon on April 23, 2008 12:24:28 PM]

Share this post


Link to post
Share on other sites
Advertisement
In the .obj format, all your indices for a face start at 1 as opposed to 0, so you might mean 'i-1' instead of just 'i' in your render.

Cheers,
--Brian

Share this post


Link to post
Share on other sites
Hello Brian,

Thanks for your suggestion, please excuse me if I'm being naive. I may interpreted your suggestion wrong.

if I use

glVertex3f(vertex[facet[i-1][0]][0],vertex[facet[i-1][0]][1],vertex[facet[i-1][0]][2]);

I get an access violation.

Share this post


Link to post
Share on other sites
I'm sorry, I misspoke.

glVertex3f(vertex[facet[0]-1][0],vertex[facet[0]-1][1],vertex[facet[0]-1][2]);

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!