int main( int argc, char *argv[] )
{
   Display *dpy;
   Window win;
   Pixmap pm;
   GLXPixmap glxpm;

   dpy = XOpenDisplay(NULL);

   win = make_rgb_window( dpy, 300, 300 );
   glxpm = make_pixmap( dpy, win, 300, 300, &pm );

   glXMakeCurrent( dpy, glxpm, ctx );
   printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));

   /* Render an image into the pixmap */
   glShadeModel( GL_FLAT );
   glClearColor( 0.5, 0.5, 0.5, 1.0 );
   glClear( GL_COLOR_BUFFER_BIT );
   glViewport( 0, 0, 300, 300 );
   glOrtho( -1.0, 1.0, -1.0, 1.0, -1.0, 1.0 );
   glColor3f( 0.0, 1.0, 1.0 );
   glRectf( -0.75, -0.75, 0.75, 0.75 );
   glFlush();

   XMapWindow( dpy, win );

   event_loop( dpy, pm );
   return 0;
}
int main( int argc, char *argv[] )
{
   Display *dpy;
   Window win;
   Pixmap pm;
   GLXPixmap glxpm;
   int eventbase, errorbase;

   dpy = XOpenDisplay(NULL);

   if(NULL == dpy) {
       fprintf(stderr, "error: opening display\n");
       return EXIT_FAILURE;
   }

   if(!glXQueryExtension(dpy, &eventbase, &errorbase)) {
       fprintf(stderr, "GLX is not available!\n");
       return EXIT_FAILURE;
   }
   

   win = make_rgb_window( dpy, 300, 300 );

   fprintf(stderr, "This test should produce a GLXBadPixmap error.\n");

   glXDestroyPixmap(dpy, /*intentional*/ win);

   return 0;
}
Beispiel #3
0
int main( int argc, char *argv[] )
{
   Display *dpy;
   Window win;
   Pixmap pm;
   GLXPixmap glxpm;
   int eventbase, errorbase;

   dpy = XOpenDisplay(NULL);

   if(NULL == dpy) {
       fprintf(stderr, "error: opening display\n");
       return EXIT_FAILURE;
   }

   if(!glXQueryExtension(dpy, &eventbase, &errorbase)) {
       fprintf(stderr, "GLX is not available!\n");
       return EXIT_FAILURE;
   }
   

   win = make_rgb_window( dpy, 300, 300 );
   glxpm = make_pixmap( dpy, win, 300, 300, &pm );

   printf("glxpm 0x%lx\n", glxpm);

   if(!glXMakeCurrent(dpy, glxpm, ctx)) {
       fprintf(stderr, "glXMakeCurrent failed!\n");
       return EXIT_FAILURE;
   }

   printf("GL_RENDERER: %s\n", (char *) glGetString(GL_RENDERER));

   /* Render an image into the pixmap */
   glShadeModel( GL_FLAT );
   glClearColor( 0.5, 0.5, 0.5, 1.0 );
   glClear( GL_COLOR_BUFFER_BIT );
   glViewport( 0, 0, 300, 300 );
   glOrtho( -1.0, 1.0, -1.0, 1.0, -1.0, 1.0 );
   glColor3f( 0.0, 0.0, 1.0 );
   glRectf( -0.75, -0.75, 0.75, 0.75 );
   glFlush();

   XMapWindow( dpy, win );

   event_loop( dpy, pm );

   return 0;
}