PDA

View Full Version : Singlebuffer



elcabri
04-17-2004, 09:15 AM
I was trying to draw in single buffer mode under GLX, on my nvidia GeForceFX with the nvidia drivers. I try to put glDrawBuffer(GL_FRONT) or glDrawBuffer(GL_FRONT_AND_BACK) in my init_gl routine, but still nothing will appear in my window until I do a glXSwapBuffers.

The FBConfig is probably doublebuffer since all of them are according to glxinfo.

Is there something that I'm missing ?

Thanks,

zen
04-18-2004, 05:34 AM
Specifying GL_FRONT to glDrawBuffer should work, maybe you haven't cleared the front buffer, esp. the front depth buffer so all fragments fail the z-test? Also make sure they don't get frustum culled. Anyway if you want single buffered behaviour it would be best to request a single buffered visual as well. How do you know from glxinfo that there are no single buffered visuals available? Have you tried not passing GLX_DOUBLEBUFFER to glXChooseVisual (or the equivalent in glx 1.3 if you're using that)?

elcabri
04-18-2004, 06:42 AM
If I specify GLX_DOUBLEBUFFER=False when choosing my FBConfig, then XCreateWindow throws a BadMatch when used with the visual info returned by glXGetVisualFromFBConfig.

And yes, the scene is cleared before drawing after I have selected the front buffer for drawing. And I explicitely disable the depth test.

In case you wonder what is all this useful for, it is just that I am teaching myself OpenGL and that I like to try things that I read in the specs... Not that I have any use of singlebuffer rendering, but I don't see anything in the specs of gl or glx that would make what I'm doing wrong. Maybe the implementation is incomplete (nvidia drivers anyone ?)

One last thing : the same happens when using the GLX 1.2 and MesaGL that come with XFree4 before I install the nvidia drivers. And still the same by using GLX 1.2 style of visual selection (glXChooseVisual) with the nvidia setting.

jide
04-18-2004, 11:00 PM
Originally posted by elcabri:
If I specify GLX_DOUBLEBUFFER=False when choosing my FBConfig, then XCreateWindow throws a BadMatch when used with the visual info returned by glXGetVisualFromFBConfig.

And yes, the scene is cleared before drawing after I have selected the front buffer for drawing. And I explicitely disable the depth test.

In case you wonder what is all this useful for, it is just that I am teaching myself OpenGL and that I like to try things that I read in the specs... Not that I have any use of singlebuffer rendering, but I don't see anything in the specs of gl or glx that would make what I'm doing wrong. Maybe the implementation is incomplete (nvidia drivers anyone ?)

One last thing : the same happens when using the GLX 1.2 and MesaGL that come with XFree4 before I install the nvidia drivers. And still the same by using GLX 1.2 style of visual selection (glXChooseVisual) with the nvidia setting.First, use glx 1.3 with Nvidia under Linux. Glx 1.2 works, but regarding the specs, it's not advise to do so.

Second, check your glx attributes that they match your single buffer.

Hope this helps;

zen
04-19-2004, 05:42 AM
With glx 1.2, in order to get a single buffered visual you simply must not include GLX_DOUBLEBUFFER in your vertex atrr. array (not include GLX_DOUBLEBUFFER, False or something, in case that's what you did). After that if the call to glXChooseVisual succeeds you should be able to create a window with it (at least I think so). Read the XCreateWindow manual page to see wich cases can result in a BadMatch error. The only one I'm aware of, that has to do with the visual is a colormap mismatch. By default the created window inherits the colormap of its parent (the root typically) wich might in some cases not be suitable (that is it was generated from a different/incompatible visual). So the best way to go is to create a colormap from your visual and bind it to the window (when creating it, through the XSetWindowAttributes struct) and also install it.
I just tried removing the GLX_DOUBLEBUFFER entry from my visual attributes array and everything still works as before, double buffered. Strange...
Look, fighting with the specs (especially the parts of them that are not used in games, and are thus not properly tested) should generally be avoided. Go do something creative and productive. :)