+// Algorithm from http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2.
+unsigned next_power_of_two(unsigned v)
+{
+ v--;
+ v |= v >> 1;
+ v |= v >> 2;
+ v |= v >> 4;
+ v |= v >> 8;
+ v |= v >> 16;
+ v++;
+ return v;
+}
+
+void *get_gl_context_identifier()
+{
+#if defined(__DARWIN__)
+ return (void *)CGLGetCurrentContext();
+#elif defined(WIN32)
+ return (void *)wglGetCurrentContext();
+#else
+ return (void *)glXGetCurrentContext();
+#endif
+}
+