Hi, I wanted to use opengl 3.0 in linux with fltk 2. I already had opengl
2.1 working. So in the constructor of my GlWindow I made a function create a
new 3.0 context, and the set context(..) to replace the existing one.
But later before draw() there are some
XRequest.144: GLXBadDrawable 0x4200007
errors. Any suggestions?
void GlDebugWindow::makeGl3Context()
{
// ASSERT(glXIsDirect(fltk::xdisplay,
reinterpret_cast<GLXContext>(super::context())));
int arr[] = {GLX_RENDER_TYPE, GLX_RGBA_BIT,
GLX_RED_SIZE, 8, GLX_GREEN_SIZE, 8, GLX_BLUE_SIZE, 8, GLX_ALPHA_SIZE,
8,
GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT | GLX_PIXMAP_BIT,
GLX_DOUBLEBUFFER, True,
//GLX_DEPTH_SIZE, 1, // pick the smallest for now
None };
int n;
GLXFBConfig * c = glXChooseFBConfig(fltkDisplay(),
DefaultScreen(fltkDisplay()),
arr, &n);
DEBUG("Got # configs : " << n);
if (n == 0)
{
throw Exception("Could not choose FB Config");
}
typedef GLXContext (*PFNGLXCREATECONTEXTATTRIBSARB)(
Display *dpy,
GLXFBConfig config,
GLXContext share_context,
Bool direct,
const int *attrib_list);
PFNGLXCREATECONTEXTATTRIBSARB glXCreateContextAttribsARB =
(PFNGLXCREATECONTEXTATTRIBSARB) glXGetProcAddress((const
GLubyte *) "glXCreateContextAttribsARB");
if (!glXCreateContextAttribsARB)
{
throw Exception("Cannot get pointer to glx function");
}
#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091
#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092
int arr2[] = { GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
GLX_CONTEXT_MINOR_VERSION_ARB, 0, None };
GLXContext ctx3 = glXCreateContextAttribsARB(fltkDisplay(), c[0], 0
/*_share*/, True, arr2);
if (!ctx3)
{
throw Exception("opengl 3.0 ctx3 failed");
}
super::context(ctx3, true);
DEBUG("context= " << super::context());
DEBUG("ctx3 = " << ctx3);
}
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk