theHollow Posted March 15, 2005 Posted March 15, 2005 (edited) I just don't seem to understand what the h*ll I am doing wrong. I know that there is something I haven't quite understood, but I just can't seem to figure out what. I have created two rectangles, one blue and one red. Each rectangle are created by four triangles, where the two first are facing out, the other in. Just to avoid transparency when the object is rotated. That's at least what I thought. Here are two images. The first is what I like it to be. The second image is the source of my frustrations. The two images (screenshots) are taken while the two rectangles are rotating. I use VB.NET, and I have attached my code if something's missing. I am just so close to giving up. I have read various tutorials on this forum, but no luck. Please help...test3.zip Edited March 15, 2005 by PlausiblyDamp Quote
Administrators PlausiblyDamp Posted March 15, 2005 Administrators Posted March 15, 2005 You need to tell DirectX to manage your Z-Buffer - then it can handle depth correctly. clicky has a good tutorial on Z-buffer use. I've updated your game.vb class and attached it - if you compare this one to your copy you will see the differences mainly 'added to your initialize routine D3Dpp.EnableAutoDepthStencil = True D3Dpp.AutoDepthStencilFormat = DepthFormat.D16 and 'Used to clear the device D3Ddev.Clear(ClearFlags.Target Or ClearFlags.ZBuffer, bgColor, 1, 0) and also 'following line modified in SetupMatrices D3Ddev.Transform.Projection = Matrix.PerspectiveFovLH(Math.PI / 3.0F, 1.0F, 1.0F, 10.0F) GameClass.zip Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
theHollow Posted March 16, 2005 Author Posted March 16, 2005 Ah! Thank you very, very, very much. I've been looking for this solution for quite a while now. Again...thank you! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.