Cleaner gl_init_platform

Simplify the code of gl_init_platform.
I didn't think of using `Deref` when I wrote it.
Also removes a warning.