--- progs/xdemos/glxdemo.c | 14 +++++++------- progs/xdemos/glxswapcontrol.c | 10 +++++++--- progs/xdemos/offset.c | 10 +++++++--- progs/xdemos/texture_from_pixmap.c | 8 ++++++-- progs/xdemos/xfont.c | 12 +++++++----- progs/xdemos/xrotfontdemo.c | 11 +++++++---- 6 files changed, 41 insertions(+), 24 deletions(-)
diff --git a/progs/xdemos/glxdemo.c b/progs/xdemos/glxdemo.c index 37df64e..f0838a8 100644 --- a/progs/xdemos/glxdemo.c +++ b/progs/xdemos/glxdemo.c @@ -12,7 +12,9 @@ #include <stdio.h> #include <stdlib.h> - +Display *dpy; +Window win; +GLXContext ctx; static void redraw( Display *dpy, Window w ) { @@ -31,14 +33,16 @@ static void redraw( Display *dpy, Window w ) static void resize( unsigned int width, unsigned int height ) { printf("Resize event\n"); + if (!glXMakeCurrent(dpy, win, ctx)) { + printf("glXMakeCurrent failed\n"); + return; + } glViewport( 0, 0, width, height ); glMatrixMode( GL_PROJECTION ); glLoadIdentity(); glOrtho( -1.0, 1.0, -1.0, 1.0, -1.0, 1.0 ); } - - static Window make_rgb_db_window( Display *dpy, unsigned int width, unsigned int height ) { @@ -53,7 +57,6 @@ static Window make_rgb_db_window( Display *dpy, unsigned long mask; Window root; Window win; - GLXContext ctx; XVisualInfo *visinfo; scrnum = DefaultScreen( dpy ); @@ -110,9 +113,6 @@ static void event_loop( Display *dpy ) int main( int argc, char *argv[] ) { - Display *dpy; - Window win; - dpy = XOpenDisplay(NULL); win = make_rgb_db_window( dpy, 300, 300 ); diff --git a/progs/xdemos/glxswapcontrol.c b/progs/xdemos/glxswapcontrol.c index cd60d46..bd4ae8c 100644 --- a/progs/xdemos/glxswapcontrol.c +++ b/progs/xdemos/glxswapcontrol.c @@ -102,6 +102,9 @@ current_time(void) #endif /*BENCHMARK*/ +Display *dpy; +Window win; +GLXContext ctx; #ifndef M_PI #define M_PI 3.14159265 @@ -356,6 +359,10 @@ draw(void) static void reshape(int width, int height) { + if (!glXMakeCurrent(dpy, win, ctx)) { + printf("glXMakeCurrent failed\n"); + return; + } if (width > height) { aspectX = (GLfloat) width / (GLfloat) height; aspectY = 1.0; @@ -757,9 +764,6 @@ is_extension_supported( const char * ext ) int main(int argc, char *argv[]) { - Display *dpy; - Window win; - GLXContext ctx; char *dpyName = NULL; int swap_interval = 1; GLboolean do_swap_interval = GL_FALSE; diff --git a/progs/xdemos/offset.c b/progs/xdemos/offset.c index 6c5abf3..66ba1cc 100644 --- a/progs/xdemos/offset.c +++ b/progs/xdemos/offset.c @@ -94,12 +94,13 @@ static int attributeList[] = { GLX_RGBA, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, static int dimension = 3; +Display *dpy; +Window win; +GLXContext cx; + int main(int argc, char** argv) { - Display *dpy; XVisualInfo *vi; XSetWindowAttributes swa; - Window win; - GLXContext cx; GLint z; dpy = XOpenDisplay(0); @@ -274,6 +275,9 @@ process_input(Display *dpy, Window win) { /* this approach preserves a 1:1 viewport aspect ratio */ int vX, vY, vW, vH; int eW = event.xconfigure.width, eH = event.xconfigure.height; + if (!glXMakeCurrent(dpy, win, cx)) { + printf("glXMakeCurrent failed\n"); + } if (eW >= eH) { vX = 0; vY = (eH - eW) >> 1; diff --git a/progs/xdemos/texture_from_pixmap.c b/progs/xdemos/texture_from_pixmap.c index ab215b0..fd9cd14 100644 --- a/progs/xdemos/texture_from_pixmap.c +++ b/progs/xdemos/texture_from_pixmap.c @@ -46,6 +46,8 @@ static float top, bottom; static PFNGLXBINDTEXIMAGEEXTPROC glXBindTexImageEXT_func = NULL; static PFNGLXRELEASETEXIMAGEEXTPROC glXReleaseTexImageEXT_func = NULL; +Display *dpy; +GLXContext ctx; static Display * OpenDisplay(void) @@ -270,6 +272,10 @@ static void Resize(Window win, unsigned int width, unsigned int height) { float sz = 1.5; + if (!glXMakeCurrent(dpy, win, ctx)) { + printf("glXMakeCurrent failed\n"); + return; + } glViewport(0, 0, width, height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); @@ -363,12 +369,10 @@ EventLoop(Display *dpy, Window win) int main(int argc, char *argv[]) { - Display *dpy; GLXFBConfig pixmapConfig; XVisualInfo *windowVis; GLXPixmap gp; Window win; - GLXContext ctx; Pixmap p; dpy = OpenDisplay(); diff --git a/progs/xdemos/xfont.c b/progs/xdemos/xfont.c index 2585aa6..2d7f63d 100644 --- a/progs/xdemos/xfont.c +++ b/progs/xdemos/xfont.c @@ -43,7 +43,9 @@ static const char *FontName = "fixed"; static GLuint FontBase = 0; - +Display *dpy; +Window win; +GLXContext ctx; static void redraw( Display *dpy, Window w ) { @@ -72,6 +74,10 @@ static void redraw( Display *dpy, Window w ) static void resize( unsigned int width, unsigned int height ) { + if (!glXMakeCurrent(dpy, win, ctx)) { + printf("glXMakeCurrent failed\n"); + return; + } glViewport( 0, 0, width, height ); glMatrixMode( GL_PROJECTION ); glLoadIdentity(); @@ -118,7 +124,6 @@ static Window make_rgb_db_window( Display *dpy, int xpos, int ypos, unsigned long mask; Window root; Window win; - GLXContext ctx; XVisualInfo *visinfo; scrnum = DefaultScreen( dpy ); @@ -188,9 +193,6 @@ static void event_loop( Display *dpy ) int main( int argc, char *argv[] ) { - Display *dpy; - Window win; - dpy = XOpenDisplay(NULL); win = make_rgb_db_window( dpy, 0, 0, 300, 300 ); diff --git a/progs/xdemos/xrotfontdemo.c b/progs/xdemos/xrotfontdemo.c index 58cd028..c10ddb7 100644 --- a/progs/xdemos/xrotfontdemo.c +++ b/progs/xdemos/xrotfontdemo.c @@ -43,6 +43,9 @@ static const char *FontName = "fixed"; static GLuint FontBase[4]; +Display *dpy; +Window win; +GLXContext ctx; static void redraw( Display *dpy, Window w ) { @@ -81,6 +84,10 @@ static void redraw( Display *dpy, Window w ) static void resize( unsigned int width, unsigned int height ) { + if (!glXMakeCurrent(dpy, win, ctx)) { + printf("glXMakeCurrent failed\n"); + return; + } glViewport( 0, 0, width, height ); glMatrixMode( GL_PROJECTION ); glLoadIdentity(); @@ -132,7 +139,6 @@ static Window make_rgb_db_window( Display *dpy, int xpos, int ypos, unsigned long mask; Window root; Window win; - GLXContext ctx; XVisualInfo *visinfo; scrnum = DefaultScreen( dpy ); @@ -202,9 +208,6 @@ static void event_loop( Display *dpy ) int main( int argc, char *argv[] ) { - Display *dpy; - Window win; - dpy = XOpenDisplay(NULL); win = make_rgb_db_window( dpy, 0, 0, 300, 300 ); -- 1.6.5.2 ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev