Fix a problem that caused the new interface code to not actually be
[mesa.git] / src / glut / ggi / ggiglut.c
index d66a9d706b8f60933a1b2e8d701145f96205e8c1..9c5ad0c7bf511096c85c3ac20637faf655614f13 100644 (file)
@@ -55,7 +55,7 @@ char *__glutProgramName = "GGI";
 
 static ggi_visual_t __glut_vis;
 
-static GGIMesaContext __glut_ctx;
+static ggi_mesa_context_t __glut_ctx;
 
 //static int __glut_width = WIDTH;
 //static int __glut_height = HEIGHT;
@@ -238,11 +238,6 @@ int glutCreateWindow(const char *title)
        
        gt = (rgb) ? __glut_gt_rgb : __glut_gt_index;
        
-       __glut_ctx = GGIMesaCreateContext();
-       
-       if (__glut_ctx == NULL) 
-         ggiPanic("Can't create mesa-context\n");
-
        __glut_vis = ggiOpen(NULL);
        if (__glut_vis == NULL) 
        {
@@ -261,20 +256,27 @@ int glutCreateWindow(const char *title)
          /* return GL_FALSE; */
        }
        
-       ggiGetMode(__glut_vis, &mode);
-
-       if (GGIMesaSetVisual(__glut_ctx, __glut_vis, rgb, frames > 1) < 0) 
+       if (ggiMesaExtendVisual(__glut_vis, GL_FALSE, GL_FALSE, 
+                               16, 0, 0, 0, 0, 0, 1) < 0) 
        {
                ggiPanic("GGIMesaSetVisual failed!\n");
        }
        
+       __glut_ctx = ggiMesaCreateContext(__glut_vis);
+       
+       if (__glut_ctx == NULL) 
+         ggiPanic("Can't create mesa-context\n");
+
+       ggiGetMode(__glut_vis, &mode);
+
+       
        __glut_width = mode.visible.x;
        __glut_height = mode.visible.y;
        
        mousex = mode.visible.x / 2;
        mousey = mode.visible.y / 2;
        
-       GGIMesaMakeCurrent(__glut_ctx);
+       ggiMesaMakeCurrent(__glut_ctx, __glut_vis);
        
        if (__glut_reshape) 
          __glut_reshape(__glut_width, __glut_height);