summaryrefslogtreecommitdiffstats
path: root/progs/xdemos
diff options
context:
space:
mode:
Diffstat (limited to 'progs/xdemos')
-rw-r--r--progs/xdemos/glxgears.c14
-rw-r--r--progs/xdemos/offset.c10
2 files changed, 21 insertions, 3 deletions
diff --git a/progs/xdemos/glxgears.c b/progs/xdemos/glxgears.c
index 088f25a357a..92c75caa5e6 100644
--- a/progs/xdemos/glxgears.c
+++ b/progs/xdemos/glxgears.c
@@ -35,6 +35,7 @@
#include <X11/keysym.h>
#include <GL/gl.h>
#include <GL/glx.h>
+#include <GL/glxext.h>
#ifndef GLX_MESA_swap_control
#define GLX_MESA_swap_control 1
@@ -586,11 +587,17 @@ is_glx_extension_supported(Display *dpy, const char *query)
* Attempt to determine whether or not the display is synched to vblank.
*/
static void
-query_vsync(Display *dpy)
+query_vsync(Display *dpy, GLXDrawable drawable)
{
int interval = 0;
-
+#if defined(GLX_EXT_swap_control)
+ if (is_glx_extension_supported(dpy, "GLX_EXT_swap_control")) {
+ unsigned int tmp = -1;
+ glXQueryDrawable(dpy, drawable, GLX_SWAP_INTERVAL_EXT, &tmp);
+ interval = tmp;
+ } else
+#endif
if (is_glx_extension_supported(dpy, "GLX_MESA_swap_control")) {
PFNGLXGETSWAPINTERVALMESAPROC pglXGetSwapIntervalMESA =
(PFNGLXGETSWAPINTERVALMESAPROC)
@@ -749,7 +756,7 @@ main(int argc, char *argv[])
make_window(dpy, "glxgears", x, y, winWidth, winHeight, &win, &ctx);
XMapWindow(dpy, win);
glXMakeCurrent(dpy, win, ctx);
- query_vsync(dpy);
+ query_vsync(dpy, win);
if (printInfo) {
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
@@ -771,6 +778,7 @@ main(int argc, char *argv[])
glDeleteLists(gear1, 1);
glDeleteLists(gear2, 1);
glDeleteLists(gear3, 1);
+ glXMakeCurrent(dpy, None, NULL);
glXDestroyContext(dpy, ctx);
XDestroyWindow(dpy, win);
XCloseDisplay(dpy);
diff --git a/progs/xdemos/offset.c b/progs/xdemos/offset.c
index 314a4fcdd17..3858a5b8020 100644
--- a/progs/xdemos/offset.c
+++ b/progs/xdemos/offset.c
@@ -94,6 +94,9 @@ static int attributeList[] = { GLX_RGBA, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1,
static int dimension = 3;
+static float Scale = 1.0;
+
+
int main(int argc, char** argv) {
Display *dpy;
XVisualInfo *vi;
@@ -182,6 +185,7 @@ draw_scene(int mx, int my) {
#else
glEnable(GL_POLYGON_OFFSET_FILL);
#endif
+ glScalef(Scale, Scale, Scale);
cubes(mx, my, HIDDEN_LINE);
#ifdef GL_EXT_polygon_offset
glDisable(GL_POLYGON_OFFSET_EXT);
@@ -289,6 +293,12 @@ process_input(Display *dpy, Window win) {
case KeyPress:
(void) XLookupString(&event.xkey, buf, sizeof(buf), &keysym, NULL);
switch (keysym) {
+ case 'Z':
+ Scale *= 1.1;
+ break;
+ case 'z':
+ Scale *= 0.9;
+ break;
case XK_Escape:
exit(EXIT_SUCCESS);
default: