MCPcopy Create free account
hub / github.com/VirtualGL/virtualgl / copyContextTest

Function copyContextTest

server/fakerut.cpp:2671–2815  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2669}
2670
2671int copyContextTest(void)
2672{
2673 Display *dpy = NULL; Window win = 0;
2674 int dpyw, dpyh, retval = 1;
2675 int glxattribs[] = { GLX_DOUBLEBUFFER, GLX_RGBA, None };
2676 XVisualInfo *vis = NULL;
2677 GLXContext ctx1 = 0, ctx2 = 0;
2678 XSetWindowAttributes swa;
2679
2680 printf("glXCopyContext() test:\n\n");
2681
2682 try
2683 {
2684 if(!(dpy = XOpenDisplay(0))) THROW("Could not open display");
2685 dpyw = DisplayWidth(dpy, DefaultScreen(dpy));
2686 dpyh = DisplayHeight(dpy, DefaultScreen(dpy));
2687
2688 if(!(vis = glXChooseVisual(dpy, DefaultScreen(dpy), glxattribs)))
2689 THROW("glXChooseVisual()");
2690
2691 Window root = RootWindow(dpy, DefaultScreen(dpy));
2692 swa.colormap = XCreateColormap(dpy, root, vis->visual, AllocNone);
2693 swa.border_pixel = 0;
2694 swa.background_pixel = 0;
2695 swa.event_mask = 0;
2696 if((win = XCreateWindow(dpy, root, 0, 0, dpyw / 2, dpyh / 2, 0, vis->depth,
2697 InputOutput, vis->visual, CWBorderPixel | CWColormap | CWEventMask,
2698 &swa)) == 0)
2699 THROW("Could not create window");
2700 XMapWindow(dpy, win);
2701
2702 try
2703 {
2704 if(!(ctx1 = glXCreateContext(dpy, vis, NULL, True)))
2705 THROW("Could not create context");
2706 if(!(ctx2 = glXCreateContext(dpy, vis, NULL, True)))
2707 THROW("Could not create context");
2708
2709 if(!(glXMakeCurrent(dpy, win, ctx1)))
2710 THROW("Could not make context current");
2711
2712 while(glGetError() != GL_NO_ERROR) {}
2713 glClearAccum(0.5, 0.5, 0.5, 0.5); // GL_ACCUM_BUFFER_BIT
2714 CHECK_GL_ERROR();
2715 glClearColor(0.5, 0.5, 0.5, 0.5); // GL_COLOR_BUFFER_BIT
2716 CHECK_GL_ERROR();
2717 glEdgeFlag(GL_FALSE); // GL_CURRENT_BIT
2718 CHECK_GL_ERROR();
2719 glClearDepth(0.5); // GL_DEPTH_BUFFER_BIT
2720 CHECK_GL_ERROR();
2721 glEnable(GL_LIGHT0); // GL_ENABLE_BIT
2722 CHECK_GL_ERROR();
2723 glMapGrid1f(2, 0.5, 0.5); // GL_EVAL_BIT
2724 CHECK_GL_ERROR();
2725 glFogi(GL_FOG_MODE, GL_LINEAR); // GL_FOG_BIT
2726 CHECK_GL_ERROR();
2727 glHint(GL_FOG_HINT, GL_FASTEST); // GL_HINT_BIT
2728 CHECK_GL_ERROR();

Callers 1

mainFunction · 0.85

Calls 12

XOpenDisplayFunction · 0.85
glXChooseVisualFunction · 0.85
XCreateWindowFunction · 0.85
glXCreateContextFunction · 0.85
glXMakeCurrentFunction · 0.85
glViewportFunction · 0.85
checkContextFunction · 0.85
glXDestroyContextFunction · 0.85
XDestroyWindowFunction · 0.85
XFreeFunction · 0.85
XCloseDisplayFunction · 0.85
whatMethod · 0.80

Tested by

no test coverage detected