Actually set the GL context before doing any GL calls.

diff --git a/dlls/ddraw/d3ddevice/mesa.c b/dlls/ddraw/d3ddevice/mesa.c
index 59d823f..aa23795 100644
--- a/dlls/ddraw/d3ddevice/mesa.c
+++ b/dlls/ddraw/d3ddevice/mesa.c
@@ -2314,6 +2314,13 @@
     memcpy(object->view_mat , id_mat, 16 * sizeof(float));
     memcpy(object->proj_mat , id_mat, 16 * sizeof(float));
 
+    /* Initialisation */
+    TRACE(" setting current context\n");
+    LEAVE_GL();
+    object->set_context(object);
+    ENTER_GL();
+    TRACE(" current context set\n");
+
     /* allocate the clipping planes */
     glGetIntegerv(GL_MAX_CLIP_PLANES,&max_clipping_planes);
     if (max_clipping_planes>32) {
@@ -2324,14 +2331,8 @@
     TRACE(" capable of %d clipping planes\n", (int)object->max_clipping_planes );
     object->clipping_planes = (d3d7clippingplane*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, object->max_clipping_planes * sizeof(d3d7clippingplane));
 
-    /* Initialisation */
-    TRACE(" setting current context\n");
-    LEAVE_GL();
-    object->set_context(object);
-    ENTER_GL();
-    TRACE(" current context set\n");
-
     glHint(GL_FOG_HINT,GL_NICEST);
+    
     glClearColor(0.0, 0.0, 0.0, 0.0);
     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
     glDrawBuffer(buffer);