mirror of
https://github.com/nigels-com/glew.git
synced 2024-11-26 07:41:58 +00:00
*** empty log message ***
git-svn-id: https://glew.svn.sourceforge.net/svnroot/glew/trunk/glew@138 783a27ee-832a-0410-bc00-9f386506c6dd
This commit is contained in:
parent
a583df73d7
commit
92a9583067
6
Makefile
6
Makefile
@ -72,7 +72,7 @@ LD = ld
|
|||||||
CFLAGS.EXTRA =
|
CFLAGS.EXTRA =
|
||||||
LDFLAGS.SO = -shared -soname $(LIB.SONAME)
|
LDFLAGS.SO = -shared -soname $(LIB.SONAME)
|
||||||
LDFLAGS.EXTRA = -L/usr/X11R6/lib
|
LDFLAGS.EXTRA = -L/usr/X11R6/lib
|
||||||
LDFLAGS.GL = -lXmu -Xi -lGLU -lGL -lXext -lX11
|
LDFLAGS.GL = -lXmu -lXi -lGLU -lGL -lXext -lX11
|
||||||
NAME = GLEW
|
NAME = GLEW
|
||||||
WARN = -Wall -W
|
WARN = -Wall -W
|
||||||
BIN.SUFFIX =
|
BIN.SUFFIX =
|
||||||
@ -109,7 +109,7 @@ LD = cc
|
|||||||
CFLAGS.EXTRA = -dynamic -I/usr/X11R6/include
|
CFLAGS.EXTRA = -dynamic -I/usr/X11R6/include
|
||||||
LDFLAGS.SO = -dynamiclib
|
LDFLAGS.SO = -dynamiclib
|
||||||
LDFLAGS.EXTRA = -L/usr/X11R6/lib
|
LDFLAGS.EXTRA = -L/usr/X11R6/lib
|
||||||
LDFLAGS.GL = -lXmu -Xi -lGLU -lGL -lXext -lX11
|
LDFLAGS.GL = -lXmu -lXi -lGLU -lGL -lXext -lX11
|
||||||
NAME = GLEW
|
NAME = GLEW
|
||||||
BIN.SUFFIX =
|
BIN.SUFFIX =
|
||||||
WARN = -Wall -W
|
WARN = -Wall -W
|
||||||
@ -150,7 +150,7 @@ BIN.SRCS = src/glewinfo.c
|
|||||||
BIN.OBJS = $(BIN.SRCS:.c=.o)
|
BIN.OBJS = $(BIN.SRCS:.c=.o)
|
||||||
BIN.LIBS = -Llib -l$(NAME) $(LDFLAGS.EXTRA) $(LDFLAGS.GL)
|
BIN.LIBS = -Llib -l$(NAME) $(LDFLAGS.EXTRA) $(LDFLAGS.GL)
|
||||||
|
|
||||||
all: lib/$(LIB.SHARED) lib/$(LIB.STATIC) bin/$(BIN)
|
all debug: lib/$(LIB.SHARED) lib/$(LIB.STATIC) bin/$(BIN)
|
||||||
|
|
||||||
lib:
|
lib:
|
||||||
mkdir lib
|
mkdir lib
|
||||||
|
@ -49,14 +49,15 @@ int main ()
|
|||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
|
HWND wnd = NULL;
|
||||||
|
HDC dc = NULL;
|
||||||
|
HGLRC rc = NULL;
|
||||||
|
|
||||||
GLboolean glewCreateContext ()
|
GLboolean glewCreateContext ()
|
||||||
{
|
{
|
||||||
WNDCLASS wc;
|
WNDCLASS wc;
|
||||||
HWND wnd;
|
|
||||||
HDC dc;
|
|
||||||
PIXELFORMATDESCRIPTOR pfd;
|
PIXELFORMATDESCRIPTOR pfd;
|
||||||
int pf;
|
int pf;
|
||||||
HGLRC rc;
|
|
||||||
/* register window class */
|
/* register window class */
|
||||||
ZeroMemory(&wc, sizeof(WNDCLASS));
|
ZeroMemory(&wc, sizeof(WNDCLASS));
|
||||||
wc.hInstance = GetModuleHandle(NULL);
|
wc.hInstance = GetModuleHandle(NULL);
|
||||||
@ -87,9 +88,6 @@ GLboolean glewCreateContext ()
|
|||||||
|
|
||||||
void glewDestroyContext ()
|
void glewDestroyContext ()
|
||||||
{
|
{
|
||||||
HWND wnd = FindWindow("GLEW", "GLEW");
|
|
||||||
HGLRC rc = wglGetCurrentContext();
|
|
||||||
HDC dc = wglGetCurrentDC();
|
|
||||||
if (NULL != rc) wglMakeCurrent(NULL, NULL);
|
if (NULL != rc) wglMakeCurrent(NULL, NULL);
|
||||||
if (NULL != rc) wglDeleteContext(wglGetCurrentContext());
|
if (NULL != rc) wglDeleteContext(wglGetCurrentContext());
|
||||||
if (NULL != wnd && NULL != dc) ReleaseDC(wnd, dc);
|
if (NULL != wnd && NULL != dc) ReleaseDC(wnd, dc);
|
||||||
@ -115,50 +113,41 @@ void glewDestroyContext ()
|
|||||||
|
|
||||||
/* ------------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------------ */
|
||||||
|
|
||||||
Display* dpy;
|
Display* dpy = NULL;
|
||||||
XVisualInfo* vi;
|
XVisualInfo* vi = NULL;
|
||||||
GLXContext context;
|
GLXContext ctx = NULL;
|
||||||
Window window;
|
Window wnd;
|
||||||
|
|
||||||
GLboolean glewCreateContext ()
|
GLboolean glewCreateContext ()
|
||||||
{
|
{
|
||||||
Colormap cmap;
|
int attrib[] = { GLX_RGBA, None };
|
||||||
XSetWindowAttributes swa;
|
|
||||||
int erb, evb;
|
int erb, evb;
|
||||||
int attrib[] = { None };
|
|
||||||
/* open display */
|
/* open display */
|
||||||
dpy = XOpenDisplay(NULL);
|
dpy = XOpenDisplay(NULL);
|
||||||
if (NULL == dpy) return GL_TRUE;
|
if (NULL == dpy) return GL_TRUE;
|
||||||
/* query for glx */
|
/* query for glx */
|
||||||
if (!glXQueryExtension(display, &erb, &evb)) return GL_TRUE;
|
if (!glXQueryExtension(dpy, &erb, &evb)) return GL_TRUE;
|
||||||
/* choose visual */
|
/* choose visual */
|
||||||
vi = glXChooseVisual(dpy, DefaultScreen(dpy), attrib);
|
vi = glXChooseVisual(dpy, DefaultScreen(dpy), attrib);
|
||||||
if (NULL == vi) return GL_TRUE;
|
if (NULL == vi) return GL_TRUE;
|
||||||
/* create context */
|
/* create context */
|
||||||
ctx = glXCreateContext(dpy, vi, None, True);
|
ctx = glXCreateContext(dpy, vi, None, True);
|
||||||
if (NULL == ctx) return GL_TRUE;
|
if (NULL == ctx) return GL_TRUE;
|
||||||
/* create colormap */
|
|
||||||
//cmap = XCreateColormap(dpy, RootWindow(dpy, vi->screen), vi->visual, AllocNone);
|
|
||||||
/* create window */
|
/* create window */
|
||||||
//swa.colormap = cmap;
|
wnd = XCreateSimpleWindow(dpy, RootWindow(dpy, vi->screen), 0, 0, 1, 1, 0, 0, 0);
|
||||||
wnd = XCreateWindow(dpy, RootWindow(dpy, vi->screen), 0, 0, 1, 1, 0, vi->depth,
|
/* make context current */
|
||||||
InputOutput, vi->visual, 0, &swa);
|
|
||||||
//XMapWindow(dpy, wnd);
|
|
||||||
if (!glXMakeCurrent(dpy, wnd, ctx)) return GL_TRUE;
|
if (!glXMakeCurrent(dpy, wnd, ctx)) return GL_TRUE;
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void glewDestroyContext ()
|
void glewDestroyContext ()
|
||||||
{
|
{
|
||||||
XUnmapWindow(dpy, wnd);
|
if (NULL != dpy && NULL != ctx) glXDestroyContext(dpy, ctx);
|
||||||
XDestroyWindow(dpy, wnd);
|
if (NULL != dpy) XDestroyWindow(dpy, wnd);
|
||||||
//XFreeColormap(dpy, cmap);
|
if (NULL != vi) XFree(vi);
|
||||||
glXDestroyContext(dpy, ctx);
|
if (NULL != dpy) XCloseDisplay(dpy);
|
||||||
XFree(vi);
|
|
||||||
XCloseDisplay(dpy);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# endif /* __linux || __sgi */
|
# endif /* __linux || __sgi */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user