Skip to main content
GameDev.net gamedev.net
🔒 Locked

[SLIMDX] Rendering Problem

Started by bloom87 Apr 9, 2009 at 5:51 PM 2 replies 1.3k views
Original Post
bloom87
bloom87
Hello, I am currently programming a small game in SlimDX using C# and i'm using DirectX as a reference and converting to SlimDX. I am new to graphics programming, but i have some background in DirectX. My problem is on rendering. The program runs, but only displays text on a coloured background. Two textured cubes should be shown though. I believe the problem could be related to the SetStreamSource method, because im not sure what the Stride parameter means. The code is too long to paste here, so im posting a link for download. I would appreciate if some one could try and run the program, and point out any solutions. Thanks in advance! Here is the Download Link: Code Download [Edited by - bloom87 on April 11, 2009 8:38:46 PM]
MJP
MJP
The stride parameter is vertex stride of your vertex buffer, which is determined by your vertex declaration. Typically you'll have something like this:
|Position(float3)|TexCoord(float2)|Normal(float3)|

For a vertex buffer with that layout, your stride would be (3 + 2 + 3) * sizeof(float).
Mike.Popoloski
Mike.Popoloski
I took a quick look at the code and found several problems without even looking in-depth. First, you're using random, differing sizes for your strides and buffer creations. Nothing seems to match up. Next, when creating your vertices, you never actually send them to the vertex buffer. Third, your vertex format declares your positions as pretransformed, so any transformations you apply will be ignored.
Mike Popoloski | Journal | SlimDX
bloom87
bloom87
Thanks so much for the explanation and for pointing out the errors.
I am currently working on it.

Thanks for your support!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.