Jump to content
  • Advertisement
Sign in to follow this  

Inverting Y axis

This topic is 2778 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

Hello guys, i have been in trouble with some basics Math or XNA problem, i still dont know.
Well im trying to do the following: put the Origin (0,0) in the center of screen (that was easy), then flip the y axis.
I wanna flip y axis because i preffer it grows going up and lowers going down (easier to draw Farseer stuff i think);

Well, to do that, i thought about flip Y Axis then translating:
R = Flip * Translating;
Where :
Flip =
1 0 0 0
0 -1 0 0
0 0 1 0
0 0 0 1
Translation =
1 0 0 0
0 1 0 0
0 0 1 0
w/2 h/2 0 1

It doenst work.
The translation works well, without any problem, but when i try flip it, it just draws the background.
The other way to reach this(in my mind) was multiplying the Translation by a scaling Matrix:
R = Matrix.CreateScale (new Vector(1f,-1f,1f))* Translation;

It also doenst work.
What can i do?
PS: sorry, my english isnt good.

Share this post

Link to post
Share on other sites
I assume this is 2d? Your things disappear when you flip the y axis because your now looking at them from the back (which, depending on your setup will be invisible/no draw). You just need to change the culling, its probably set to backface culling, set it to front face. Not sure how you'd do that in xna though but its not a particulally uncommon thing to do.

Share this post

Link to post
Share on other sites
Thank you a lot Nanoha!

Doing the following, in Draw method, it worked as expected:

RasterizerState rasterizer = new RasterizerState();
rasterizer.CullMode = CullMode.CullClockwiseFace;// Or CullMode.None
spriteBatch.Draw(test, v, Color.White);

Thank you once again!

Share this post

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

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net 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!