Jump to content
  • Advertisement
Sign in to follow this  
Enerjak

Having a problem getting data from .obj file to render (index / Vertex buffer prob)

This topic is 1470 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've tried everything I could think of, every possible thing and yet, I can't get the .obj mesh to render. It gets all the vertices and indices (I think.) But when I try to pass it on to DIrect3D9's vertex and index buffers, it.....doesn't go well. Here's a few links and my explanation.

 

meshobj.cpp file:

 

(note: to keep this post short, I'll be using pastbin for code.)

 

http://pastebin.com/BJMRFHJQ

 

mesh.obj file:

 

http://pastebin.com/mPtbENV9

 

and finally: a screen shot of what PIX shows.....

 

http://puu.sh/a4oEB/429942ff81.png

 

as you can see, the vertices don't seem to be pushed through the pipeline right...I've given all I can give to explain this problem. If you could help me out, I'd appreciate it. let me know if you need to see something else.

 

 

Share this post


Link to post
Share on other sites
Advertisement

Does your data look correct on the pre-VS tab for the vertices?  If so, then it may be an issue with your projection matrices, since your x values are squashed to zero.  I would guess that this is not the case though - I would bet that your data pre-VS is not correct, and that you have a data alignment issue in your vertex buffer.  Double check to make sure that the positions in your vertex buffer all match what is given in the OBJ file, and if they don't match then you probably have an alignment issue!

Share this post


Link to post
Share on other sites

just wondering, are you multiplying with the world matrix twice? in pix it shows the world transform twice

 

i haven't used directx 9 forever, but what happens when you comment out the line: 

 

this->Transform();

Edited by iedoc

Share this post


Link to post
Share on other sites

Also, check my dx9 c++ obj loader sample if you'd like: click

 

That helps a bit, but why use FVFs? I've noticed .X files (deprecated, yes), use vertex declarations (without loading effects). So it's possible to use vert decl without shaders, no?

Share this post


Link to post
Share on other sites

You can map FVFs to vertex declarations. In fact, if I'm not mistaken, directx will internally do that if you stick with FVFs. Also, you can use vertex declarations with the fixed function pipeline (but why would you use the fixed function pipeline and not shaders?). See the section "Vertex Declaration Usage with the Fixed Function Pipeline" here.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!