Recommended Posts

Hello,
I have been using a Mesh to render stuff, but recently have begun work on eliminating it (I find that it is not flexible enough to properly intergrate into an engine, but then again I just like reinventing the wheel :). Anyway I have a very simple sample that renders a rotating double sided triangle to the screen, well it *should* as far as I can tell. Simply put, it doesn't show up. I have turned off culling and lighting to be sure I can atleast see a black triangle (on a blue background mind you, I figured that part out quite quickly). Camera is at (0, 0, -5) looking at origin. Triangle is equilateral with sides of 1 so it should be properly visible. Strange part is, if I load it directly from a .X file (using a Mesh) it works, so that excludes matrix, math, hardware and dx problems. I get no errors or warnings from the DX debugger, I even ran DXSpy on a compile using Mesh and vertex/index buffers I created myself. I made a screen of some of the elements of the spy, you can see here (hope I get the ubb code right, couldn't find forum help). The only difference with the Spy I get when using Mesh is the order of the render setup calls (stuff like, I set material after buffers, but Mesh does that first). Can this sort of order matter? Or does it only matter that you have a correct state when calling DrawPrimitive?
For those interrested, here is my render code:
the part that is commented out is what I use when rendering a Mesh (which works)

Share this post

Link to post

Share on other sites

Can this sort of order matter? Or does it only matter that you have a correct state when calling DrawPrimitive?

You should just make sure that you have the correct states and the correct information set before you try and render such as setting materials, textures and vertex declaration/formats before you try and render. Other than that I don't really see any problem.