Advertisement Jump to content
Sign in to follow this  

[SOLVED] rendered shapes moving by themselves?

This topic is 3827 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 picked up directx 9 and have been moving pretty quickly through it these past couple days. Some of my code is a little buggy, but one that is particularly annoying me at the moment is as follows: I'm basically rendering two sets of triangles. One is a basically a surface, evenly space in x/y for the vertices, with varying z values. The second is a half-cylinder that is supposed to act as a backdrop. When i move the camera around (i'm actually moving the camera, not doing world transformations) the surface appears to move correctly while the half cylinder behaves in strange ways. for example, when i rotate the camera, the cylinder rotates around the surface, so i'm always looking at it! Worse, when i rotate up and down, the backdrop falls below or rises above the surface. Very strange behavior! No idea why it's doing this and it's the behavior i'm trying to fix. Here is my code. I'm sure i'm doing a lot of things I shouldn't be because I don't quite have the handle on how directX is "supposed" to be implemented, yet. Sorry if it is difficult to read through, looks like the tabbing really kills the indentation here, and as you can see, my code looks like a potpourri of tutorials. If you would like me to compile it or provide the other needed resources, I can do that too. I'm kind of hoping this is a common mistake and not some big problem where i have to change a lot of my code... EDIT #1: The code is so long and ugly i'll just link to it: EDIT#2: I thought examples of the bug might be important Here is the normal view then you rotate the camera to see the left side of the surface, and a little upwards to get a higher view and then the cylinder moves itself to that size of the surface, and then a little below it, too! i might as well ask one other quick question - Why does the back end of my cylinder tend to render on TOP of my front end. This looks weird, and it seems the z buffer isnt helping me. Maybe I set it up incorrectly? _______________________________________________________________ Well, looks like changing the order in which the cylinder and the surface were drawn gave me the behavior i wanted! I don't really understand, but okay. [Edited by - sqpat on July 25, 2008 5:08:25 PM]

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!