mirror of
https://github.com/nigels-com/glew.git
synced 2024-11-22 05:45:07 +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 =
|
||||
LDFLAGS.SO = -shared -soname $(LIB.SONAME)
|
||||
LDFLAGS.EXTRA = -L/usr/X11R6/lib
|
||||
LDFLAGS.GL = -lXmu -Xi -lGLU -lGL -lXext -lX11
|
||||
LDFLAGS.GL = -lXmu -lXi -lGLU -lGL -lXext -lX11
|
||||
NAME = GLEW
|
||||
WARN = -Wall -W
|
||||
BIN.SUFFIX =
|
||||
@ -109,7 +109,7 @@ LD = cc
|
||||
CFLAGS.EXTRA = -dynamic -I/usr/X11R6/include
|
||||
LDFLAGS.SO = -dynamiclib
|
||||
LDFLAGS.EXTRA = -L/usr/X11R6/lib
|
||||
LDFLAGS.GL = -lXmu -Xi -lGLU -lGL -lXext -lX11
|
||||
LDFLAGS.GL = -lXmu -lXi -lGLU -lGL -lXext -lX11
|
||||
NAME = GLEW
|
||||
BIN.SUFFIX =
|
||||
WARN = -Wall -W
|
||||
@ -150,7 +150,7 @@ BIN.SRCS = src/glewinfo.c
|
||||
BIN.OBJS = $(BIN.SRCS:.c=.o)
|
||||
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:
|
||||
mkdir lib
|
||||
|
@ -49,14 +49,15 @@ int main ()
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
HWND wnd = NULL;
|
||||
HDC dc = NULL;
|
||||
HGLRC rc = NULL;
|
||||
|
||||
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);
|
||||
@ -87,9 +88,6 @@ GLboolean glewCreateContext ()
|
||||
|
||||
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);
|
||||
@ -115,50 +113,41 @@ void glewDestroyContext ()
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
Display* dpy;
|
||||
XVisualInfo* vi;
|
||||
GLXContext context;
|
||||
Window window;
|
||||
Display* dpy = NULL;
|
||||
XVisualInfo* vi = NULL;
|
||||
GLXContext ctx = NULL;
|
||||
Window wnd;
|
||||
|
||||
GLboolean glewCreateContext ()
|
||||
{
|
||||
Colormap cmap;
|
||||
XSetWindowAttributes swa;
|
||||
int attrib[] = { GLX_RGBA, None };
|
||||
int erb, evb;
|
||||
int attrib[] = { None };
|
||||
/* open display */
|
||||
dpy = XOpenDisplay(NULL);
|
||||
if (NULL == dpy) return GL_TRUE;
|
||||
/* query for glx */
|
||||
if (!glXQueryExtension(display, &erb, &evb)) return GL_TRUE;
|
||||
if (!glXQueryExtension(dpy, &erb, &evb)) return GL_TRUE;
|
||||
/* choose visual */
|
||||
vi = glXChooseVisual(dpy, DefaultScreen(dpy), attrib);
|
||||
if (NULL == vi) return GL_TRUE;
|
||||
/* create context */
|
||||
ctx = glXCreateContext(dpy, vi, None, True);
|
||||
if (NULL == ctx) return GL_TRUE;
|
||||
/* create colormap */
|
||||
//cmap = XCreateColormap(dpy, RootWindow(dpy, vi->screen), vi->visual, AllocNone);
|
||||
/* create window */
|
||||
//swa.colormap = cmap;
|
||||
wnd = XCreateWindow(dpy, RootWindow(dpy, vi->screen), 0, 0, 1, 1, 0, vi->depth,
|
||||
InputOutput, vi->visual, 0, &swa);
|
||||
//XMapWindow(dpy, wnd);
|
||||
wnd = XCreateSimpleWindow(dpy, RootWindow(dpy, vi->screen), 0, 0, 1, 1, 0, 0, 0);
|
||||
/* make context current */
|
||||
if (!glXMakeCurrent(dpy, wnd, ctx)) return GL_TRUE;
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
void glewDestroyContext ()
|
||||
{
|
||||
XUnmapWindow(dpy, wnd);
|
||||
XDestroyWindow(dpy, wnd);
|
||||
//XFreeColormap(dpy, cmap);
|
||||
glXDestroyContext(dpy, ctx);
|
||||
XFree(vi);
|
||||
XCloseDisplay(dpy);
|
||||
if (NULL != dpy && NULL != ctx) glXDestroyContext(dpy, ctx);
|
||||
if (NULL != dpy) XDestroyWindow(dpy, wnd);
|
||||
if (NULL != vi) XFree(vi);
|
||||
if (NULL != dpy) XCloseDisplay(dpy);
|
||||
}
|
||||
|
||||
# endif /* __linux || __sgi */
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user