Fixes shared texture handles on 64bits

IntPtr is platform dependent, a raw c pointer so in 64bits platforms
it's a 64bits int. Casting it to a uint (32bits) was making it loose
precission and not opening correctly the shared texture sometimes.