Bugzilla – Attachment 146275 Details for
Bug 282604
Memory leak
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Forgot Password
testcase
a2.cpp (text/x-c++src), 2.22 KB, created by
Lubos Lunak
on 2007-06-14 12:56:59 UTC
(
hide
)
Description:
testcase
Filename:
MIME Type:
Creator:
Lubos Lunak
Created:
2007-06-14 12:56:59 UTC
Size:
2.22 KB
patch
obsolete
>#include <X11/Xlib.h> >#include <stdio.h> >#include <GL/glx.h> > >bool aaa( Display* dpy ); > >int main( int argc, char* argv[] ) > { > Display* dpy = XOpenDisplay( NULL ); > return aaa( dpy ); > } > >bool aaa( Display* dpy ) >{ > const char* renderer; >#define HAVE_GLXCHOOSEVISUAL >#ifdef HAVE_GLXCHOOSEVISUAL > int attribSingle[] = { > GLX_RGBA, > GLX_RED_SIZE, 1, > GLX_GREEN_SIZE, 1, > GLX_BLUE_SIZE, 1, > None > }; > int attribDouble[] = { > GLX_RGBA, > GLX_RED_SIZE, 1, > GLX_GREEN_SIZE, 1, > GLX_BLUE_SIZE, 1, > GLX_DOUBLEBUFFER, > None > }; > > XVisualInfo* visinfo = glXChooseVisual ( > dpy, DefaultScreen( dpy ), attribSingle > ); > if (visinfo) > { > GLXContext ctx = glXCreateContext ( dpy, visinfo, NULL, True ); > if (glXIsDirect(dpy, ctx)) > { > glXDestroyContext (dpy,ctx); > return true; > } > > XSetWindowAttributes attr; > unsigned long mask; > Window root; > XVisualInfo *visinfo; > int width = 100, height = 100; > int scrnum = DefaultScreen( dpy ); > > root = RootWindow(dpy, scrnum); > > visinfo = glXChooseVisual(dpy, scrnum, attribSingle); > if (!visinfo) > { > visinfo = glXChooseVisual(dpy, scrnum, attribDouble); > if (!visinfo) > { > fprintf(stderr, "Error: couldn't find RGB GLX visual\n"); > return false; > } > } > > attr.background_pixel = 0; > attr.border_pixel = 0; > attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone); > attr.event_mask = StructureNotifyMask | ExposureMask; > mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask; > > Window win = XCreateWindow(dpy, root, 0, 0, width, height, > 0, visinfo->depth, InputOutput, > visinfo->visual, mask, &attr); > > if ( glXMakeCurrent(dpy, win, ctx)) > renderer = (const char *) glGetString(GL_RENDERER); > XDestroyWindow(dpy, win); > glXDestroyContext (dpy,ctx); > > return false; > } > else > { > return false; > } >#else >#error no GL? > return false; >#endif >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
Attachments on
bug 282604
: 146275 |
146279
|
146280