[OPENGL32]
[reactos.git] / reactos / dll / opengl / opengl32 / swimpl.c
index c95fea0..3bc109b 100644 (file)
@@ -13,6 +13,7 @@
 #include <main/framebuffer.h>
 #include <main/renderbuffer.h>
 #include <main/shared.h>
+#include <main/viewport.h>
 #include <swrast/s_context.h>
 #include <swrast/s_renderbuffer.h>
 #include <swrast_setup/swrast_setup.h>
@@ -102,8 +103,18 @@ sw_get_string( struct gl_context *ctx, GLenum name )
 {
     (void) ctx;
     if(name == GL_RENDERER)
-        return (const GLubyte *) "ReactOS Software Implementation";
-    
+    {
+        static const GLubyte renderer[] = { 'R','e','a','c','t','O','S',' ',
+            'S','o','f','t','w','a','r','e',' ',
+            'I','m','p','l','e','m','e','n','t','a','t','i','o','n',0 };
+        return renderer;
+    }
+    /* Don't claim to support the fancy extensions that mesa supports, they will be slow anyway */
+    if(name == GL_EXTENSIONS)
+    {
+        static const GLubyte extensions[] = { 0 };
+        return extensions;
+    }
     return NULL;
 }
 
@@ -469,8 +480,7 @@ BOOL sw_SetPixelFormat(HDC hdc, struct wgl_dc_data* dc_data, INT format)
         pixel_formats[fb->format_index].accum_bits,
         pixel_formats[fb->format_index].accum_bits,
         pixel_formats[fb->format_index].alpha_bits ? 
-            pixel_formats[fb->format_index].accum_bits : 0,
-        1 /* One sampling level */);
+            pixel_formats[fb->format_index].accum_bits : 0);
     
     if(!fb->gl_visual)
     {
@@ -526,7 +536,6 @@ DHGLRC sw_CreateContext(struct wgl_dc_data* dc_data)
     
     /* Initialize the context */
     if(!_mesa_initialize_context(&sw_ctx->mesa,
-                                 API_OPENGL,
                                  fb->gl_visual,
                                  NULL,
                                  &mesa_drv_functions,
@@ -593,7 +602,7 @@ BOOL sw_DeleteContext(DHGLRC dhglrc)
 PROC sw_GetProcAddress(LPCSTR name)
 {
     /* We don't support any extensions */
-    assert(FALSE);
+    WARN("Asking for proc address %s, returning NULL.\n", name);
     return NULL;
 }
 
@@ -748,6 +757,15 @@ BOOL sw_SetContext(struct wgl_dc_data* dc_data, DHGLRC dhglrc)
         ERR("_mesa_make_current filaed!\n");
         return FALSE;
     }
+    
+    /* Set the viewport if this is the first time we initialize this context */
+    if(sw_ctx->mesa.Viewport.X == 0 && 
+       sw_ctx->mesa.Viewport.Y == 0 &&
+       sw_ctx->mesa.Viewport.Width == 0 &&
+       sw_ctx->mesa.Viewport.Height == 0)
+    {
+        _mesa_set_viewport(&sw_ctx->mesa, 0, 0, width, height);
+    }
 
     /* update the framebuffer size */
     _mesa_resize_framebuffer(&sw_ctx->mesa, fb->gl_buffer, width, height);