mirror of
https://github.com/Perlmint/glew-cmake.git
synced 2024-11-22 22:55:06 +00:00
removed GLUT dependency
git-svn-id: https://glew.svn.sourceforge.net/svnroot/glew/trunk/glew@135 783a27ee-832a-0410-bc00-9f386506c6dd
This commit is contained in:
parent
7cad40f8db
commit
031afdf03b
@ -59,7 +59,7 @@ static void* NSGLGetProcAddress (const char* name)
|
|||||||
{
|
{
|
||||||
NSSymbol symbol;
|
NSSymbol symbol;
|
||||||
char* symbolName;
|
char* symbolName;
|
||||||
// Prepend a '_' for the Unix C symbol mangling convention
|
/* prepend a '_' for the Unix C symbol mangling convention */
|
||||||
symbolName = malloc(strlen(name) + 2);
|
symbolName = malloc(strlen(name) + 2);
|
||||||
strcpy(symbolName+1, name);
|
strcpy(symbolName+1, name);
|
||||||
symbolName[0] = '_';
|
symbolName[0] = '_';
|
||||||
|
@ -4,16 +4,21 @@
|
|||||||
|
|
||||||
/* ------------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------------ */
|
||||||
|
|
||||||
int main (int argc, char** argv)
|
int main ()
|
||||||
{
|
{
|
||||||
GLuint err;
|
GLuint err;
|
||||||
glutInit(&argc, argv);
|
if (GL_TRUE == glewCreateContext())
|
||||||
glutCreateWindow("GLEW Extension Info");
|
{
|
||||||
|
fprintf(stderr, "Error: glewCreateContext failed\n");
|
||||||
|
glewDestroyContext();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
glewExperimental = GL_TRUE;
|
glewExperimental = GL_TRUE;
|
||||||
err = glewInit();
|
err = glewInit();
|
||||||
if (GLEW_OK != err)
|
if (GLEW_OK != err)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Error [main]: glewInit failed: %s\n", glewGetErrorString(err));
|
fprintf(stderr, "Error [main]: glewInit failed: %s\n", glewGetErrorString(err));
|
||||||
|
glewDestroyContext();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@ -36,5 +41,89 @@ int main (int argc, char** argv)
|
|||||||
glxewInfo();
|
glxewInfo();
|
||||||
#endif
|
#endif
|
||||||
if (f != stdout) fclose(f);
|
if (f != stdout) fclose(f);
|
||||||
|
glewDestroyContext();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------ */
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
|
||||||
|
GLboolean glewCreateContext ()
|
||||||
|
{
|
||||||
|
WNDCLASS wc;
|
||||||
|
HWND wnd;
|
||||||
|
HDC dc;
|
||||||
|
PIXELFORMATDESCRIPTOR pfd;
|
||||||
|
int pf;
|
||||||
|
HGLRC rc;
|
||||||
|
// register window class
|
||||||
|
ZeroMemory(&wc, sizeof(WNDCLASS));
|
||||||
|
wc.hInstance = GetModuleHandle(NULL);
|
||||||
|
wc.lpfnWndProc = DefWindowProc;
|
||||||
|
wc.lpszClassName = "GLEW";
|
||||||
|
if (0 == RegisterClass(&wc)) return GL_TRUE;
|
||||||
|
// create window
|
||||||
|
wnd = CreateWindow("GLEW", "GLEW", 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, GetModuleHandle(NULL), NULL);
|
||||||
|
if (NULL == wnd) return GL_TRUE;
|
||||||
|
// get the device context
|
||||||
|
dc = GetDC(wnd);
|
||||||
|
if (NULL == dc) return GL_TRUE;
|
||||||
|
// find pixel format
|
||||||
|
ZeroMemory(&pfd, sizeof(PIXELFORMATDESCRIPTOR));
|
||||||
|
pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
|
||||||
|
pfd.nVersion = 1;
|
||||||
|
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL;
|
||||||
|
pf = ChoosePixelFormat(dc, &pfd);
|
||||||
|
if (pf == 0) return GL_TRUE;
|
||||||
|
// set the pixel format for the dc
|
||||||
|
if (FALSE == SetPixelFormat(dc, pf, &pfd)) return GL_TRUE;
|
||||||
|
// create rendering context
|
||||||
|
rc = wglCreateContext(dc);
|
||||||
|
if (NULL == rc) return GL_TRUE;
|
||||||
|
if (FALSE == wglMakeCurrent(dc, rc)) return GL_TRUE;
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void glewDestroyContext ()
|
||||||
|
{
|
||||||
|
HWND wnd = FindWindow("GLEW", "GLEW");
|
||||||
|
HGLRC rc = wglGetCurrentContext();
|
||||||
|
HDC dc = wglGetCurrentDC();
|
||||||
|
if (NULL != rc) wglMakeCurrent(NULL, NULL);
|
||||||
|
if (NULL != rc) wglDeleteContext(wglGetCurrentContext());
|
||||||
|
if (NULL != wnd && NULL != dc) ReleaseDC(wnd, dc);
|
||||||
|
if (NULL != wnd) DestroyWindow(wnd);
|
||||||
|
UnregisterClass("GLEW", GetModuleHandle(NULL));
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------ */
|
||||||
|
|
||||||
|
# ifdef __APPLE__
|
||||||
|
|
||||||
|
GLboolean glewCreateContext ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void glewDestroyContext ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
# else /* __linux || __sgi */
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------ */
|
||||||
|
|
||||||
|
GLboolean glewCreateContext ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void glewDestroyContext ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@ -32,12 +32,20 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
#include <GL/glut.h>
|
|
||||||
#include <GL/wglew.h>
|
#include <GL/wglew.h>
|
||||||
#include <GL/glxew.h>
|
#include <GL/glxew.h>
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
static FILE* f;
|
static FILE* f;
|
||||||
|
|
||||||
|
GLboolean glewCreateContext ();
|
||||||
|
void glewDestroyContext ();
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static void glewPrintExt (const GLubyte* name, GLint defined)
|
static void glewPrintExt (const GLubyte* name, GLint defined)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
@ -50,7 +50,7 @@ BSC32=bscmake.exe
|
|||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||||
# ADD LINK32 ../../lib/glew32s.lib /nologo /subsystem:console /machine:I386
|
# ADD LINK32 ../../lib/glew32s.lib opengl32.lib gdi32.lib user32.lib /nologo /subsystem:console /machine:I386
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "glewinfo - Win32 Debug"
|
!ELSEIF "$(CFG)" == "glewinfo - Win32 Debug"
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ BSC32=bscmake.exe
|
|||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||||
# ADD LINK32 ../../lib/glew32sd.lib /nologo /subsystem:console /incremental:no /pdb:"static/debug/glewinfod.pdb" /debug /machine:I386 /out:"../../bin/glewinfod.exe" /pdbtype:sept
|
# ADD LINK32 ../../lib/glew32sd.lib opengl32.lib gdi32.lib user32.lib /nologo /subsystem:console /incremental:no /pdb:"static/debug/glewinfod.pdb" /debug /machine:I386 /out:"../../bin/glewinfod.exe" /pdbtype:sept
|
||||||
# SUBTRACT LINK32 /pdb:none
|
# SUBTRACT LINK32 /pdb:none
|
||||||
|
|
||||||
!ENDIF
|
!ENDIF
|
||||||
|
Loading…
Reference in New Issue
Block a user