Jump to content

  • Log In with Google      Sign In   
  • Create Account


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

  • You cannot reply to this topic
5 replies to this topic

#1 Enerjak   Members   -  Reputation: 227

Like
0Likes
Like

Posted 09 July 2014 - 06:19 PM

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.

 

 



Sponsor:

#2 Jason Z   Crossbones+   -  Reputation: 4672

Like
3Likes
Like

Posted 09 July 2014 - 07:08 PM

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!



#3 Amr0   Members   -  Reputation: 1028

Like
1Likes
Like

Posted 10 July 2014 - 08:05 AM

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



#4 iedoc   Members   -  Reputation: 661

Like
0Likes
Like

Posted 10 July 2014 - 11:11 AM

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, 10 July 2014 - 11:17 AM.

Braynzar Soft - DirectX Lessons & Game Programming Resources!

#5 Enerjak   Members   -  Reputation: 227

Like
0Likes
Like

Posted 11 July 2014 - 06:04 AM

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?



#6 Amr0   Members   -  Reputation: 1028

Like
0Likes
Like

Posted 11 July 2014 - 07:02 AM

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.







PARTNERS