Demos (master): wglcontext: Several fixes that were forgotten when commiting.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Wed Nov 2 13:37:01 UTC 2011


Module: Demos
Branch: master
Commit: 39014eea0e892a3fd62474469fda638e724b890b
URL:    http://cgit.freedesktop.org/mesa/demos/commit/?id=39014eea0e892a3fd62474469fda638e724b890b

Author: José Fonseca <jfonseca at vmware.com>
Date:   Wed Nov  2 13:36:55 2011 +0000

wglcontext: Several fixes that were forgotten when commiting.

---

 src/wgl/wglcontext.c |   23 +++++++++++------------
 1 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/src/wgl/wglcontext.c b/src/wgl/wglcontext.c
index 957689b..92df7cc 100644
--- a/src/wgl/wglcontext.c
+++ b/src/wgl/wglcontext.c
@@ -22,9 +22,8 @@
 #include <windows.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <GL/gl.h>
-#include <GL/glext.h>
-#include <GL/wglext.h>
+#include <GL/glew.h>
+#include <GL/wglew.h>
 
 static LRESULT CALLBACK
 WndProc(HWND hWnd,
@@ -43,7 +42,7 @@ WndProc(HWND hWnd,
    return 0;
 }
 
-static char *
+static const char *
 context_error_to_string(DWORD error)
 {
    switch (error) {
@@ -72,17 +71,17 @@ profile_mask_to_string(GLint profileMask)
 }
 
 static void
-print_context_infos()
+print_context_infos(void)
 {
    GLint majorVersion;
    GLint minorVersion;
    GLint profileMask;
-   const GLubyte *version;
+   const char *version;
 
    fprintf(stdout, "Context Informations\n");
 
-   version = glGetString(GL_VERSION);
-   fprintf(stdout, "GL_VERSION: %s\n", glGetString(GL_VERSION));
+   version = (const char *)glGetString(GL_VERSION);
+   fprintf(stdout, "GL_VERSION: %s\n", version);
 
    // Request informations with the new 3.x features.
    if (sscanf(version, "%d.%d", &majorVersion, &minorVersion) != 2)
@@ -153,9 +152,9 @@ create_context(int majorVersion, int minorVersion, int profileMask, int contextF
    }
 
    memset(&pfd, 0, sizeof(pfd));
-   pfd.nVersion = 1;
    pfd.nSize = sizeof(pfd);
-   pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL;
+   pfd.nVersion = 1;
+   pfd.dwFlags = PFD_DOUBLEBUFFER | PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL;
    pfd.iPixelType = PFD_TYPE_RGBA;
    pfd.cColorBits = 24;
    pfd.cDepthBits = 24;
@@ -199,7 +198,7 @@ create_context(int majorVersion, int minorVersion, int profileMask, int contextF
    ctx = wglCreateContextAttribsARB(hdc, 0, attribsList);
    if (!ctx) {
       DWORD error = GetLastError();
-      fprintf(stderr, "wglCreateContextAttribsARB failed(): %s (0x%x)\n",
+      fprintf(stderr, "wglCreateContextAttribsARB failed(): %s (0x%lx)\n",
               context_error_to_string(error), error);
       return;
    }
@@ -212,7 +211,7 @@ create_context(int majorVersion, int minorVersion, int profileMask, int contextF
       return;
    }
 
-   print_context_infos(majorVersion);
+   print_context_infos();
 }
 
 static void




More information about the mesa-commit mailing list