BadMatch with glXMakeCurrent

I am trying to get pbuffers working with glX. The pbuffer
appears to be created correctly (lots of asserts never fail
and glXQueryGLXPbufferSGIX reports the correct sizes).
When I call glXMakeCurrent the first time with the pbuffer's
display, drawable, and context, I get
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 144 (GLX)
Minor opcode of failed request: 5 (X_GLXMakeCurrent)
Serial number of failed request: 33
Current serial number in output stream: 33
The man pages on glXMakeCurrent say that BadMatch is generated
if the drawable was not created with the same X screen and visual
as the context (or if the drawable is None and context is NULL, neither
condition occuring in my code).
I am trying to share a context, so
Display* dpy = glXGetCurrentDisplay();
int scr = DefaultScreen(dpy);
GLXContext ctx = glXGetCurrentContext();
int cfgCount;
GLXFBConfig* cfg = glXGetFBConfigs(dpy,scr,&cfgCount); // cfgCount is 48,
cfg not null
int attr[] = { GLX_LARGEST_PBUFFER, 1, 0 };
GLXPbuffer pbuf = glXCreateGLXPbufferSGIX(dpy,cfg[0],width,height,attr);
// pbuf not null
// glXQueryGLXPbufferSGIX calls indicate success so far...
glXMakeCurrent(dpy,pbuf,ctx); // fails here with BadMatch
Any clues what the problem is?
--
Dave Eberly
http://www.geometrictools.com

Dave Eberly wrote:
> I am trying to get pbuffers working with glX. The pbuffer
> appears to be created correctly (lots of asserts never fail
> and glXQueryGLXPbufferSGIX reports the correct sizes).
> When I call glXMakeCurrent the first time with the pbuffer's
> display, drawable, and context, I get
>
> X Error of failed request: BadMatch (invalid parameter attributes)
> Major opcode of failed request: 144 (GLX)
> Minor opcode of failed request: 5 (X_GLXMakeCurrent)
> Serial number of failed request: 33
> Current serial number in output stream: 33
>
> The man pages on glXMakeCurrent say that BadMatch is generated
> if the drawable was not created with the same X screen and visual
> as the context (or if the drawable is None and context is NULL, neither
> condition occuring in my code).
>
> I am trying to share a context, so
> Display* dpy = glXGetCurrentDisplay();
> int scr = DefaultScreen(dpy);
> GLXContext ctx = glXGetCurrentContext();
> int cfgCount;
> GLXFBConfig* cfg = glXGetFBConfigs(dpy,scr,&cfgCount); // cfgCount is 48,
> cfg not null
> int attr[] = { GLX_LARGEST_PBUFFER, 1, 0 };
> GLXPbuffer pbuf = glXCreateGLXPbufferSGIX(dpy,cfg[0],width,height,attr);
> // pbuf not null
> // glXQueryGLXPbufferSGIX calls indicate success so far...
> glXMakeCurrent(dpy,pbuf,ctx); // fails here with BadMatch
>
> Any clues what the problem is?
Assuming that ctx is not NULL, then there is the question of whether the
context was created using the same FBConfig that was used to create the
Pbuffer (assuming the glXCreateNewContext was used to create the
context). If the context was created by glXCreateContext, then you will
need to make sure that the FBConfig that you use to create the Pbuffer
is associated with the visual used to create the context (FBConfigs do
not have to be associated with an X visual id). Since the
glXChooseFBConfig subroutine won't use the GLX_VISUAL_ID token, you will
have to loop through the list of FBConfigs that you received from
glXGetFBConfigs and use the glXGetFBConfigAttrib subroutine to get the
visual id associated with each FBConfig (if one exists) to find one that
matches the visual id used to create the context. Once you find that
FBConfig, then you use it to create your Pbuffer and, hopefully, your
BadMatch will go away.
Jim Lahue

0

Jim

5/18/2005 12:42:05 PM

"Jim Lahue" <jmlahue@us.NO_SPAM.ibm.com> wrote in message
news:3f0rlhF5c0e5U1@individual.net...
Thank you for taking the time to post help!
> Assuming that ctx is not NULL, then there is the question of whether the
> context was created using the same FBConfig that was used to create the
> Pbuffer (assuming the glXCreateNewContext was used to create the context).
> If the context was created by glXCreateContext, then you will need to make
> sure that the FBConfig that you use to create the Pbuffer is associated
> with the visual used to create the context (FBConfigs do not have to be
> associated with an X visual id). Since the glXChooseFBConfig subroutine
> won't use the GLX_VISUAL_ID token, you will have to loop through the list
> of FBConfigs that you received from glXGetFBConfigs and use the
> glXGetFBConfigAttrib subroutine to get the visual id associated with each
> FBConfig (if one exists) to find one that matches the visual id used to
> create the context. Once you find that FBConfig, then you use it to
> create your Pbuffer and, hopefully, your BadMatch will go away.
The original context was created by glXCreateContext. I managed
to figure out how glXGetFBConfigAttrib works and looped through
the array of FBConfigs and found one whose visual ID matches that of
my "main" renderer. The match occurred for a FBConfig that was
not the zero-th index of the array. (I was using nVidia's pbuffer code
sample as a guide--they just grab the zero-th index FBConfig.) The
BadMatch went away.
Unfortunately, my test application is still not working correctly after
this change. I render the mesh to the pbuffer, copy it to a system
memory chunk, and then create a texture. The texture is attached to
a screen polygon. (Still waiting on that graphics-hardware-agnostic
render-to-texture support on Linux.) The mesh is rendered to the
backbuffer, and then the screen polygon is rendered to the
backbuffer, followed by the usual swap. On my Windows machine,
I see the mesh in the center of the main window (gray background)
and the screen polygon with this same mesh in a corner of the main
window (white background). On the Linux box, the screen polygon
shows up with a white background, but no mesh. This is using
glXGetFBConfigs, glXGetFBConfigAttrib, glXCreateNewContext,
and glXCreatePbuffer to set up the pbuffer.
If I create the pbuffer instead using glXChooseFBConfigSGIX,
glXCreateContextWithConfigSGIX, and glXCreateGLXPbufferSGIX,
the screen polygon shows up correctly.
Additional hints are welcome. Thanks.
--
Dave Eberly
http://www.geometrictools.com

0

Dave

5/18/2005 4:28:38 PM

Dave Eberly wrote:
<snip snip snip>
>
> The original context was created by glXCreateContext. I managed
> to figure out how glXGetFBConfigAttrib works and looped through
> the array of FBConfigs and found one whose visual ID matches that of
> my "main" renderer. The match occurred for a FBConfig that was
> not the zero-th index of the array. (I was using nVidia's pbuffer code
> sample as a guide--they just grab the zero-th index FBConfig.) The
> BadMatch went away.
>
> Unfortunately, my test application is still not working correctly after
> this change. I render the mesh to the pbuffer, copy it to a system
> memory chunk, and then create a texture. The texture is attached to
> a screen polygon. (Still waiting on that graphics-hardware-agnostic
> render-to-texture support on Linux.) The mesh is rendered to the
> backbuffer, and then the screen polygon is rendered to the
> backbuffer, followed by the usual swap. On my Windows machine,
> I see the mesh in the center of the main window (gray background)
> and the screen polygon with this same mesh in a corner of the main
> window (white background). On the Linux box, the screen polygon
> shows up with a white background, but no mesh. This is using
> glXGetFBConfigs, glXGetFBConfigAttrib, glXCreateNewContext,
> and glXCreatePbuffer to set up the pbuffer.
>
> If I create the pbuffer instead using glXChooseFBConfigSGIX,
> glXCreateContextWithConfigSGIX, and glXCreateGLXPbufferSGIX,
> the screen polygon shows up correctly.
>
> Additional hints are welcome. Thanks.
Well, did you try using glXChooseFBConfig with the same attribute list
as you used in glXChooseFBConfigSGIX? I'm not entirely sure that the
two accept exactly the same tokens (I think that the GLX 1.3 version is
a bit more strict in what it allows). The search methodology used by
glXChooseFBConfig and glXChooseFBConfigSGIX do differ slightly but both
of them will probably be different from the
glXGetFBConfigs/glXGetFBConfigAttrib search method.
My guess is that you ended up using two different FBConfigs based on the
two different search methods: one of the FBConfigs worked for you and
the other didn't. This is just a guess, though. I can't think of any
other reason why using the SGI versions of the subroutines should give
you different results from the GLX 1.3 versions of the subroutines.
Jim Lahue

0

Jim

5/19/2005 1:34:07 PM

"Jim Lahue" <jmlahue@us.NO_SPAM.ibm.com> wrote in message
news:3f3j33F5qp4sU1@individual.net...
> Well, did you try using glXChooseFBConfig with the same attribute list as
> you used in glXChooseFBConfigSGIX?
I am not using glXChooseFBConfig. The two cases are (1) create
a pbuffer using the framebuffer's pixel format (via glXGetFBConfig)
and (2) create a pbuffer using a specified attribute list (via
glxChooseFBConfigSGIX). A similar dichotomy is used on Windows.
A stripped down version of the functions acts as pseudocode (error
handling removed, for example).
http://www.geometrictools.com/Temp/pbuffer.txt
The WGL code works for either (1) or (2). The GLX code only
works for (2). As mentioned (1) leads to a white background (so I
know the clear call for a white background colors is working), but
no mesh.
Thanks again for your comments. I only have to go through this
yet one more time--now on the Macintosh. Apple has some
pbuffer extensions that appear to be documented. I can only cross
my fingers and hope to see some working examples...
--
Dave Eberly
http://www.geometrictools.com

0

Dave

5/19/2005 6:16:10 PM

Dave Eberly wrote:
> "Jim Lahue" <jmlahue@us.NO_SPAM.ibm.com> wrote in message
> news:3f3j33F5qp4sU1@individual.net...
>
>
>>Well, did you try using glXChooseFBConfig with the same attribute list as
>>you used in glXChooseFBConfigSGIX?
>
>
> I am not using glXChooseFBConfig. The two cases are (1) create
> a pbuffer using the framebuffer's pixel format (via glXGetFBConfig)
> and (2) create a pbuffer using a specified attribute list (via
> glxChooseFBConfigSGIX). A similar dichotomy is used on Windows.
> A stripped down version of the functions acts as pseudocode (error
> handling removed, for example).
> http://www.geometrictools.com/Temp/pbuffer.txt
> The WGL code works for either (1) or (2). The GLX code only
> works for (2). As mentioned (1) leads to a white background (so I
> know the clear call for a white background colors is working), but
> no mesh.
>
> Thanks again for your comments. I only have to go through this
> yet one more time--now on the Macintosh. Apple has some
> pbuffer extensions that appear to be documented. I can only cross
> my fingers and hope to see some working examples...
It would seem that your results depend quite a bit on the type (and/or
number) of FBConfigs that exist on the system -- maybe it works on the
WGL system because it only supports a few FBConfigs and so you end up
with the same one no matter which method you use. You may want to
write a short program that displays the resources available with each
FBConfig on the failing system and then see which FBConfig that your
program chooses in the good and bad cases and see what the differences are.
Jim Lahue

0

Jim

5/20/2005 3:34:25 PM

"Jim Lahue" <jmlahue@us.NO_SPAM.ibm.com> wrote in message
news:3f6egqF67oqrU1@individual.net...
> It would seem that your results depend quite a bit on the type (and/or
> number) of FBConfigs that exist on the system -- maybe it works on the WGL
> system because it only supports a few FBConfigs and so you end up with the
> same one no matter which method you use. You may want to write a short
> program that displays the resources available with each FBConfig on the
> failing system and then see which FBConfig that your program chooses in
> the good and bad cases and see what the differences are.
Thanks for the suggestion. I had printed out the FBConfig results
on the Linux box--48 possibilities. Only one matched the visual
ID for the framebuffer associated with my application window.
From what I understand of your earlier post, that is the only one
I can use without getting a BadMatch.
Well, the SGIX version works for now and I'll just live with that.
At the rate graphics hardware/extensions are evolving for "buffer"
objects, hopefully the interfaces and usage will become simpler.
After all these years of OpenGL, you would think that there would
be some official wrapper/API to hide having to deal with the
platform-dependent calls for the more advance features....
--
Dave Eberly
http://www.geometrictools.com

0

Dave

5/20/2005 3:55:16 PM

Reply:

Similar Artilces:

status of Fortran API to Vulkan graphics (the "new" openGL)
As many might know, Vulkan has been released 2 days ago on Feb 16, 2016:
https://www.khronos.org/news/archives
"The Khronos Group announces the immediate availability of the Vulkan 1.0
royalty-free, open standard API specification. Vulkan provides high-efficiency,
cross-platform access to graphics and compute on modern GPUs"
This is the "new" openGL, called Vulkan.
Any one knows if there is any work by any one or company to make a
Fortran thin API for Vulkan? The API in in C as it stands.
--Nasser
"Nasser M. Abbasi" wrote in message news:na55m5$n61$1@gioia.aioe.org...
> As many might know, Vulkan has been released 2 days ago on Feb 16, 2016:
> https://www.khronos.org/news/archives
> "The Khronos Group announces the immediate availability of the Vulkan 1.0
> royalty-free, open standard API specification. Vulkan provides
> high-efficiency,
> cross-platform access to graphics and compute on modern GPUs"
> This is the "new" openGL, called Vulkan.
> Any one knows if there is any work by any one or company to make a
> Fortran thin API for Vulkan? The API in in C as it stands.
The header files look fairly easy to translate to Fortran, but
installation of the drivers failed, so I won't be able to do
anything with it.
...

OpenGL hardware acceleration for the LabVIEW's OpenGL graphics engine?In another thread about running recent versions of LabVIEW on older hardwar=
e, someone mentioned that LabVIEW uses OpenGL for its graphics engine [whic=
h would make sense, because there's no such thing as DirectX for Linux or S=
parc/Solaris or whatever]. This got me to thinking about the question of af=
fordable graphics cards with good OpenGL acceleration that meshes well with=
LabVIEW.<br><br>Unfortunately, when I went to Google on OpenGL hardware re=
views, the hits that I got were rather old [by video card standards]:<br><b=
lockquote><br><b>Open...

openGL for turtle graphics I am developing a Logo-like turtle graphics system in the
programming language J http://www.jsoftware.com/ . At present the system
is implemented in a graphics system called "gl2". J is adopting "openGL"
and I am assuming it is a much richer graphics environment. openGL likely
includes sprites or layers or some other feature that would make managing
turtles separately from the background much easier. There may also be
openGL features for screen wraparound and slide controls for window
scrolling.
Are there any existing openGL implementations of such systems that
I could ...

OpenGL api call ?Hi all
I am making some examples with openGL and I have one problem with two
functions.
"glGenTextures y glDeleteTextures."
OpenGLLibrary>>glGenTextures: n textures: textures
" Generate texture names
void glGenTextures( GLsizei n, GLuint * textures);
n: Specifies the number of texture names to be
generated.
textures: Specifies an array in which the generated texture
names are stored."
<stdcall: void glGenTextures sdword dword*>
^self invalidCall
OpenGLLibrary>>glDeleteTex...

OpenGL API questionMost of the games, written for Windows, that aren't portable, use Direct
X. Now and then, however, there's a game that uses Open GL and is _not_
portable... I am mystified why. Any ideas?
keith wrote:
> Most of the games, written for Windows, that aren't portable, use Direct
> X. Now and then, however, there's a game that uses Open GL and is _not_
> portable... I am mystified why. Any ideas?
Graphics is not the only part of a game. There are Sound, User Input and a
lot of other potentially unportable stuff involved. However most game
engines are very portable, and h...

Console graphics APIsDoes anyone know what graphics APIs are used for console programming
(GameCube, PlayStation2, Xbox)? All three systems probably support OpenGL,
and I can see the Xbox using DirectX. I'm asking because I plan on becoming
a console games programmer and I'd like to know which I should learn first.
//mike tyndall
In article <1JudnbSKfsK4eI_cRVn-hA@comcast.com>,
Mike Tyndall <swtyndall@hotmail.com> wrote:
>Does anyone know what graphics APIs are used for console programming
>(GameCube, PlayStation2, Xbox)? All three systems probably support OpenGL,
>and...

Spinning OpenGL.Tk graphicsPython's OpenGL.Tk binding makes simple 3D drawing a snap! The default mouse
keys for panning and sizing is left and right, for rotation it seems to be
the middle key which is on just very few people's mouse nowadays.
Of course I tried obvious and not so obvious shift/alt/contrl/mouse
combinations- without any success.
Is there a work-around? The docu for the binding is somewhat obscure and one
has to guess a lot ;-) I haven't figured out yet how to use AutoSpin ....
I am using Windows2000
Thanks for suggestions and may be hints to more detailed documentation.
Michael
Maybe ...

calling a graphics opengl programHi groups,
I have written a program in opengl and i want to call this
program when my xscreensaver gets called in such a way that the output
of my opengl program should appear instead of any screensaver that is
invoked by the xscreensaver.I want to know if we can do this,is it
possible to do this or not.I would be thankful to you guys if you give
me a reply.
Thanks in advance,
Bye.
...

Best graphics api for GUI?Hi, what api would you all recommend for doing GUIs? Since I am primarily a
linux user, I was thinking of the GDK set, but having programmed GUIs in
Java for a few years now (which is exceptionally easy, but perhaps only
because I'm used to it), I was wondering if there were any 'easier' (for
want of a better word) c++ gui apis one could consider?
Cheers,
Ben
BrianJones <brian@jones1611.fsnet.co.uk> spoke thus:
> Hi, what api would you all recommend for doing GUIs? Since I am primarily a
> linux user, I was thinking of the GDK set, but having programmed GUIs in
&gt...

What about Lisp and OpenGL (or other graphics libraries)??I need to include some displays in a program so I would really like to
have an opengl library, like C++ does. However, from what I have seen
on the net, there is no standard library and what's there seems more
like incomplete patchwork.
Anyone knows how to gain graphical capabilities using Lisp? do I have
to code that in C/C++ and then communicate through ports or something?
Any and all help greatly appreciated :)
ghostunit@gmail.com wrote:
> I need to include some displays in a program so I would really like to
> have an opengl library, like C++ does. However, from what I have ...

gforth: OpenGL Graphics Part I---[ gforth: OpenGL Graphics Part I ]-----------------[07/01/2010]---
by Timothy Trussell
---[ Where We Are ]--------------------------------------------------
An introduction to implementing an OpenGL interface for gforth.
---[ What is OpenGL? ]-----------------------------------------------
From the Wikipedia description of OpenGL:
/-------------------------------------------------------------------\
OpenGL (Open Graphics Library) is a standard specification defining
a cross-language, cross-platform API for writing applications that
produce 2D and 3D computer g...

OpenGL For Non-Graphics ProcessingI don't know if it's of interest to anyone in here, but I thought it may be
worth mentioning a product that uses shaders to harness the processing power
on modern GPU's, as it might turn a few wheels in your own minds.
"BionicFX announced a technology for music production that turns NVIDIA
video cards into audio effects processors. Audio Video Exchange (AVEX)
converts digital audio into graphics data, and then performs effect
calculations using the 3D architecture of the GPU. The latest video cards
from NVIDIA are capable of more than 40 gigaflops of processing power
c...

Line width with Graphics I APIHi,
I'm creating applets using JDK1.1.8 which doesn't use the Graphics2D. How
do I modify the width of a using Graphics I API. Any ideas?
Justin
"Justin Birtwell" <justin.birtwell@verizon.net> writes:
> I'm creating applets using JDK1.1.8 which doesn't use the Graphics2D. How
> do I modify the width of a using Graphics I API. Any ideas?
You don't. That feature is not part of 1.1.x. You can do the obvious
things like using multiple single-pixel lines to simulate a larger
line, or filled rectangles. Or upgrade to a newer Java version.
/Thomas
...

Graphics--combining graphicsI am trying to create an animation of a piecewise function. I have a graph of a ball rolling and I would like to combine an animation for one equation of motion for the first part with another equation for the second part of the motion. It is easy enough to create the two animations individually, however I am stumped on how to combine them into one continuous animation.
Link to the forum page for this post:
http://www.mathematica-users.org/webMathematica/wiki/wiki.jsp?pageName=Special:Forum_ViewTopic&pid=10007#p10007
Posted through http://www.mathematica-users.org [[postId=10007]]
...

2D vector graphics with OpenGLWith OpenGL and the Common Lisp Application Builder project it is easy to
create nice 3D animations:
http://svn.sourceforge.net/viewcvs.cgi/*checkout*/lispbuilder/trunk/lispbuilder-opengl/documentation/index.html
(the lispbuilder-opengl-package will be released later at Sourceforge)
But OpenGL is useful for fast 2D vector graphics, too, because drawing
operations are accelerated by the graphics card. I've implemented a very
basic SVG path parser (in 16 lines with lispbuilder-lexer) and used the SVG
file from http://www.lisperati.com/logo.html for rendering something with
OpenGL:
http://...

OpenGL API and hardware accelerationHi,
I am pretty new to OpenGL. After trying out a few examples, i
downloaded the Mesa source code and looked at the 3D driver (ATI :
r300) to see what operations are typically accelerated. I guess that
this
is not a simple task that can be done quickly with so many
indirections in the code :-) Some are obvious where ctx->Driver
functions are initialized by the driver. Then there are the software
fallback modules vbo etc. also that initializes the Driver functions.
For example, i was trying to see if the Vertex operations like
glVertex2f() are accelerated. I was unable to find it out. Is th...

paintComponent(Graphics graphics)Hi=20
I hope I can explain this clearly without getting into too much detail as t=
he code in question is a couple of thousand of lines. So to begin, I have =
a JPanel to which I add JLabels and JComponents using JPanel's add() method=
.. It works fine, but now I would like to print an image ON TOP of the adde=
d JLabels and JComponents. For this I manipulate my JPanel's paintComponen=
t(Graphics graphics) method. In it I have something of the following sort:
paintComponent(Graphics graphics){
Graphics2D g =3D (Graphics2D)graphics.create();
g.drawImage(image, 200, ...

API to change the DPI of a graphicI would like to use the FrameMaker 7.1 API to programmatically set the
DPI of an image (a PNG imported by reference in this case) to a set
value (eg 125).
I was hoping I could use the property FP_InsetDpi against the
SetPropVAL function, but that doesn't work.
Any ideas? Anyone have some sample code?
Thanks.
David.
...

graphics APIs, consoles, etc.
For some reason, graphics APIs and gaming consoles are both discussed in
this group. There's an interesting long interview with John Carmack and
Todd Hollenshead that touches on those topics here:
<http://www.gameinformer.com/News/Story/200701/N07.0109.1737.15034.htm?Pa
ge=1>
--
--Tim Smith
Tim Smith wrote:
> For some reason, graphics APIs and gaming consoles are both discussed
> in this group. There's an interesting long interview with John
> Carmack and Todd Hollenshead that touches on those topics here:
>
> <http://www.gameinformer.com/News/Story/200...

the graphics and the concept of the graphicHiya all.
everybody should applicate this type of guidelines
This movement builds a
strong visual link between the head and shoulders.
If you get the correct
relationship between the eyes, nose and mouth, you will end up with a good
likeness.
Our Pencil Portrait lesson explains and illustrates the step by
step drawing techniques involved in creating the portrait of a young girl.
At this stage, the drawing is no more than a set of carefully measured
features that establish the final proportions of the portrait.
There are
three basic stages in the creation of the image...

3D graphics API historyI'm writing a book on the OpenGL graphics API. In the introductory chapter,
I'd like to provide a glimpse of the 3D graphics API world prior to OpenGL's
introduction.
Does anyone have any direct experience with, or references (papers, etc)
regarding proprietary APIs of the 1980s? For example, Ardent's Dore, HP's
Starbase, SGI's Iris GL, and proprietary PHIGS such as IBM GraPHIGS, etc. (I
don't need information on PEX/PEXlib, thanks - already have that covered.)
Did the Stellar GS1000 have a proprietary API, and if so, what was it?
Please post any ...

graphic inside a graphicHi everyone
Does anybody know how to insert a graphic inside a graphic?? I mean,
to add a small graphic (as a zoom for example) inside a plot.
Thanks
augusto
try axes
try axes
check out the tool 'imshow()', then try to bring the figure in shape
get(gca) and superimpose your graph - 'hold on', 'plot()', 'hold off'
(Haven't tried it my self so far)
Thorben
The example below shows you how to insert a graphic (e.g. photo) into
another MATLAB figure.
I = imread('peppers.png');
theta = linspace(-pi,pi,200);
figure; plot(theta,cos(theta)); gr...