vispy/vispy — pull request #639 by alexjc (2014-11-22 11:10:59+00:00)
Title: Fixing GLFW Tests & Support for Retina Devices

(This pull request is not ready to merge yet, but is intended to continue the discussion of #551 specifically for the GLFW use-case and fixing the tests.)

Currently with GLFW, the tests fail on Retina displays:
````
======================================================================
FAIL: Test drawing to a framebuffer
----------------------------------------------------------------------
Traceback (most recent call last):
File "vispy/gloo/tests/test_use_gloo.py", line 43, in test_use_framebuffer
assert_equal(c.size, shape[::-1])
nose.proxy.AssertionError: Tuples differ: (600, 200) != (300, 100)

First differing element 0:
600
300

- (600, 200)
? ^ ^
+ (300, 100)
? ^ ^
````

Based on @lcampagn's comment: assuming `canvas.size` should return the window size, I tried changing the GLFW backend to return WindowSize instead of FrameBuffer size in both `_vispy_get_size` and `_on_resize`, that fixes all the tests. (See the diff.)

Now, however, the rest doesn't work and the viewport (in particular) seems wrong. This is the problem, I think:
````
vispy.gloo.set_viewport(0, 0, *event.size)
````

Should I pursue this direction? How easy will it be to handle the glViewport sizing in a retina friendly way? I'm starting to think it'd be easier for `canvas.size` to return the full retina framebuffer size and have a separate call for the window size.