piston icon indicating copy to clipboard operation
piston copied to clipboard

Window coordinates are broken?

Open jarrett opened this issue 9 years ago • 13 comments

After upgrading to the latest Piston dependencies, window coordinates seem to be broken, at least on OSX. Here is a screen capture of the Hello World example demonstrating the error. The same thing occurs for every application I've tested, including the Piston examples and my home-grown apps.

jarrett avatar Jul 23 '15 21:07 jarrett

Seems to be broken on the Glutin window back-end.

bvssvni avatar Jul 24 '15 18:07 bvssvni

You can switch to let window: PistonWindow<(), Sdl2Window> = ... to fix the problem temporarily.

This requires extern crate sdl2_window; and use sdl2_window::Sdl2Window;.

bvssvni avatar Jul 24 '15 18:07 bvssvni

Thanks! Good to know. Should I post this issue to the glutin_window Github?

jarrett avatar Jul 24 '15 18:07 jarrett

Not necessary. It is probably a small fix.

bvssvni avatar Jul 24 '15 18:07 bvssvni

The "user_input" example seem to work?

bvssvni avatar Jul 24 '15 18:07 bvssvni

There is an issue on Glutin about the origin moving on Retina displays https://github.com/tomaka/glutin/issues/503

bvssvni avatar Jul 25 '15 09:07 bvssvni

I guess that there are two bugs involved here, 1) that moves the origin and 2) related to resizing.

The "user_input" example is used to test backends but does not use PistonWindow. It could be that the second bug is triggered by PistonWindow.

bvssvni avatar Jul 25 '15 09:07 bvssvni

GlutinWindow does not emit resize events.

bvssvni avatar Jul 25 '15 09:07 bvssvni

The second bug is caused by https://github.com/tomaka/glutin/issues/445

bvssvni avatar Jul 25 '15 10:07 bvssvni

I've fixed the second bug https://github.com/PistonDevelopers/piston_window/pull/74.

bvssvni avatar Jul 26 '15 20:07 bvssvni

Thanks!

So just to confirm, PistonWindow's default config is still broken pending the GlutinWindow fix, correct?

In the meantime, cargo update and switching to Sdl2Window per your instructions above worked for me.

jarrett avatar Jul 27 '15 15:07 jarrett

For Retina displays it is pending on https://github.com/tomaka/glutin/issues/503.

bvssvni avatar Jul 28 '15 16:07 bvssvni

This might be related to an issue I have been running into when going through sudoku tutorial. I have been trying to figure out why my y-axis is off the screen. I finally cloned the Piston-Tutorial repo and ran the sudoku tutorial and saw that it works fine. However, I eventually realized it worked because it was using an older version of the dependencies in the Cargo.lock file. When I delete the Cargo.lock file, clean, and re-build it gets the latest version where the y axis is offset. See images below.

[dependencies]
# working version
piston = "0.35.0"
piston2d-graphics = "0.23.0"
piston2d-opengl_graphics = "0.49.0"
pistoncore-glutin_window = "0.42.0"

# latest version where screen is off 
# piston = "0.36.0"
# piston2d-graphics = "0.26.0"
# piston2d-opengl_graphics = "0.52.0"
# pistoncore-glutin_window = "0.45.3"

image of working version image of broken version

willbush avatar Mar 26 '18 05:03 willbush

Closing as outdated.

bvssvni avatar Apr 30 '24 17:04 bvssvni