aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--samples/OpenGL/x11argb_opengl_glsl/Makefile9
-rw-r--r--samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c39
2 files changed, 47 insertions, 1 deletions
diff --git a/samples/OpenGL/x11argb_opengl_glsl/Makefile b/samples/OpenGL/x11argb_opengl_glsl/Makefile
index b59feea..62e3496 100644
--- a/samples/OpenGL/x11argb_opengl_glsl/Makefile
+++ b/samples/OpenGL/x11argb_opengl_glsl/Makefile
@@ -1,3 +1,10 @@
+.PHONY: all
+
+all: x11argb_opengl_glsl x11argb_opengl_glsl3
+
x11argb_opengl_glsl: x11argb_opengl_glsl.c Makefile
- clang -std=c99 -g3 -o x11argb_opengl_glsl x11argb_opengl_glsl.c -lX11 -lXrender -lGLEW -lm
+ cc -std=c99 -g3 -o x11argb_opengl_glsl x11argb_opengl_glsl.c -lX11 -lXrender -lGLEW -lm
+
+x11argb_opengl_glsl3: x11argb_opengl_glsl.c Makefile
+ cc -std=c99 -g3 -o x11argb_opengl_glsl3 -D USE_GLX_CREATE_CONTEXT_ATTRIB x11argb_opengl_glsl.c -lX11 -lXrender -lGLEW -lm
diff --git a/samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c b/samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c
index 3c5908b..b658f5c 100644
--- a/samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c
+++ b/samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c
@@ -130,6 +130,37 @@ static void fatalError(const char *why)
exit(0x666);
}
+static int isExtensionSupported(const char *extList, const char *extension)
+{
+
+ const char *start;
+ const char *where, *terminator;
+
+ /* Extension names should not have spaces. */
+ where = strchr(extension, ' ');
+ if ( where || *extension == '\0' )
+ return 0;
+
+ /* It takes a bit of care to be fool-proof about parsing the
+ OpenGL extensions string. Don't be fooled by sub-strings,
+ etc. */
+ for ( start = extList; ; ) {
+ where = strstr( start, extension );
+
+ if ( !where )
+ break;
+
+ terminator = where + strlen( extension );
+
+ if ( where == start || *(where - 1) == ' ' )
+ if ( *terminator == ' ' || *terminator == '\0' )
+ return 1;
+
+ start = terminator;
+ }
+ return 0;
+}
+
static int Xscreen;
static Atom del_atom;
static Colormap cmap;
@@ -304,6 +335,12 @@ static void createTheWindow()
}
}
+static int ctxErrorHandler( Display *dpy, XErrorEvent *ev )
+{
+ fputs("Error at context creation", stderr);
+ return 0;
+}
+
static void createTheRenderContext()
{
int dummy;
@@ -356,6 +393,8 @@ static void createTheRenderContext()
if (!glXMakeContextCurrent(Xdisplay, glX_window_handle, glX_window_handle, render_context)) {
fatalError("glXMakeCurrent failed for window\n");
}
+
+ glewInit();
}
static int updateTheMessageQueue()