Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] Problem while creating the GLContext

Hi,

tried the OpenGL SWT binding, great work, but it seems that it doesn't
work correct sometimes.

If I use the gtk binding on my Linux/PPC laptop, I got a "badmatch"
error on the invocation of XGL.glXMakeCurrent():

The program '<unknown>' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadMatch (invalid parameter attributes)'.
  (Details: serial 955 error_code 8 request_code 145 minor_code 5)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful

After I digged into the problem, I found that there is a problem with
the XVisual used for the  GLContext and the Canvas. If I create the
GLContext without the doublebuffering flag, then I can run the
OpenGLExample.

int attrib [] = {
 XGL.GLX_LEVEL, 0,
 XGL.GLX_RGBA,
 //XGL.GLX_DOUBLEBUFFER,
 XGL.GLX_DEPTH_SIZE, depth,
 0
};
int infoPtr = XGL.glXChooseVisual (xDisplay, screen, attrib);

With the doublebuffering flag I got following Visual(glxinfo -v):

Visual ID: 27  depth=24  class=TrueColor
    bufferSize=24 level=0 renderType=rgba doubleBuffer=1 stereo=0
    rgba: redSize=8 greenSize=8 blueSize=8 alphaSize=8
    auxBuffers=0 depthSize=24 stencilSize=0
    accum: redSize=0 greenSize=0 blueSize=0 alphaSize=0
    multiSample=0  multiSampleBuffers=0
    visualCaveat=None
    Opaque.

And without:

Visual ID: 23  depth=24  class=TrueColor
    bufferSize=24 level=0 renderType=rgba doubleBuffer=0 stereo=0
    rgba: redSize=8 greenSize=8 blueSize=8 alphaSize=8
    auxBuffers=0 depthSize=24 stencilSize=0
    accum: redSize=0 greenSize=0 blueSize=0 alphaSize=0
    multiSample=0  multiSampleBuffers=0
    visualCaveat=None
    Opaque.

Searching the net I found following post on a newgroup:
http://groups.google.de/groups?hl=de&lr=&ie=UTF-8&threadm=4cbepc%241h7g%40ausnews.austin.ibm.com&rnum=1&prev=/groups%3Fq%3DglXChooseVisual%2BglXMakeCurrent%2BBadMatch%26hl%3Dde%26lr%3D%26ie%3DUTF-8%26group%3Dcomp.graphics.api.opengl%26selm%3D4cbepc%25241h7g%2540ausnews.austin.ibm.com%26rnum%3D1

The post says there is a problem if you create GLContext with different
XVisual than the XVisual of the widget, which you try to combine. Hmm...

Another post writes, that he change the "direct" flag to false and
everything works.
http://groups.google.de/groups?hl=de&lr=&ie=UTF-8&threadm=37110F24.D9671C67%40xenetic.fi&rnum=7&prev=/groups%3Fq%3DglXChooseVisual%2BglXMakeCurrent%2BBadMatch%26hl%3Dde%26lr%3D%26ie%3DUTF-8%26group%3Dcomp.graphics.api.opengl%26selm%3D37110F24.D9671C67%2540xenetic.fi%26rnum%3D7

So, I change the "direct" flag from "false" to "true"(the other
direction), and then it works for me. *grmpf#*!

handle = XGL.glXCreateContext (xDisplay, info, 0, true);

How can I get the visual info of the gtk widgets? Should be the flag 
on "true" as default value?

Thanks, Stephan Michels.



Back to the top