      #define SDL_PROC(ret,func,params) video->func=func;
 diff --git a/src/video/nacl/SDL_naclevents.cc b/src/video/nacl/SDL_naclevents.cc
 new file mode 100644
-index 0000000..98267e4
+index 0000000..c9eaea8
 --- /dev/null
 +++ b/src/video/nacl/SDL_naclevents.cc
-@@ -0,0 +1,307 @@
+@@ -0,0 +1,320 @@
 +#include "SDL_config.h"
 +
 +#include "SDL_nacl.h"

+static SDL_VideoDevice *NACL_CreateDevice(int devindex) {
+  SDL_VideoDevice *device;
+
+  assert(gNaclPPInstance);
+
+  /* Initialize all variables that we clean on shutdown */
+  device = (SDL_VideoDevice *)SDL_malloc(sizeof(SDL_VideoDevice));
+  if (device) {
+    SDL_memset(device, 0, (sizeof *device));
+    device->hidden = (struct SDL_PrivateVideoData *)
+        SDL_malloc((sizeof *device->hidden));
+  }
+  if (device == NULL || device->hidden == NULL) {
+    SDL_OutOfMemory();

+  return 0;
+}
+
+static int NACL_GL_MakeCurrent(_THIS) {
+  if (!_this->hidden->context3d) {
+    assert(_this->hidden->context3d);
+    SDL_SetError("GL_MakeCurrent called without an OpenGL video mode set");
+    return -1;
+  }
+  fprintf(stderr, "SDL: making GL context current\n");
+  glSetCurrentContextPPAPI(_this->hidden->context3d);
+
+  RegalMakeCurrent(_this->hidden->context3d,
+                   (PPB_OpenGLES2 *)g_nacl_opengles2_interface);
+  glLogMessageCallbackREGAL(regalLogCallback);
+  return 0;
+}
+
+static void NACL_GL_SwapBuffers(_THIS) {
+  if (!_this->hidden->context3d) {
+    assert(_this->hidden->context3d);
+    fprintf(stderr,
+            "SDL: GL_SwapBuffers called without an OpenGL video mode set\n");
+    return;
+  }
+  g_nacl_graphics3d_interface->SwapBuffers(_this->hidden->context3d,
+                                           PP_BlockUntilComplete());
+}
+#endif
+
+}  // extern "C"
diff --git a/src/video/nacl/SDL_naclvideo.h b/src/video/nacl/SDL_naclvideo.h
new file mode 100644
index 0000000..7dde7dd
--- /dev/null
+++ b/src/video/nacl/SDL_naclvideo.h
@@ -0,0 +1,36 @@
