[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Full-Screen mode.

(Damn, accidentally double posted to OpenGL-gamedev, rather than 
replying here) :)

How are you using glXChooseVisual when creating your OpenGL context? You 
should be calling it along the lines of...

glXChooseVisual(dpy, screen, attrListDouble);

where attrListDouble is a structure in this form:

static int attrListDouble[] = {
         GLX_RED_SIZE, 8,
         GLX_GREEN_SIZE, 8,
         GLX_BLUE_SIZE, 8,
         GLX_DEPTH_SIZE, 24,

That's assuming you want 32bit mode, with a 24bit Z-Buffer.

dpy is your Display (connection to the X server)
screen is screen number

Obviously the GLX_DOUBLEBUFFER flag is important. If you remove that 
from the structure, you'll just get a single buffered visual. If this 
function returns NULL with the attrListDouble structure, then it's 
possible that double buffering isn't possible. In that you'll need to 
call it again with the GLX_DOUBLEBUFFER flag removed.

Once you've created your OpenGL context, you'll probably also want to 
call glXIsDirect to make sure that direct rendering is possible, 
otherwise all of your rendering commands will be going via the X server 
(which is probably bad).

Cheers, hope that helped.

email(n) - the current trend in modern postism.

Stephen J Baker wrote:
> I have an OpenGL program that (attempts) to run in Full-screen
> mode on nVidia hardware/drivers.  I'm using raw Xlib commands
> to set up the window - and I have the __GL_SYNC_TO_VBLANK option
> set in order (theoretically) to avoid tearing in the image.
> However, I find that my program does not take advantage of
> the page-flip option for swapping double-buffers.  This
> results in slower rendering and some 'tearing' in the image
> when the system is heavily loaded.
> When I run the same kind of code - but using GLUT (and the
> 'glutFullScreen()' function) instead of my own Xlib window
> setup functions, it works just fine.
> So, I deduce that what I'm doing to get a full-screen window
> is somehow not enough to trigger the driver to use page-flip
> mode.
> I set the window dimensions to be the same as the screen
> resolution, and set the window origin to (0,0) - I also
> turn off the window border, title, decoration, etc, etc.
> What is it that GLUT (or other full-screen programs) do
> that I'm missing?   Does anyone have source code to do this
> that I could steal ?
> I've looked through the GLUT source-code - but it's pretty
> impenetrable if you aren't an X-windows expert (and I'm not).
> Thanks in advance.
>           Steve.
> ----
> Steve Baker                      (817)619-2657 (Vox/Vox-Mail)
> L3Com/Link Simulation & Training (817)619-2466 (Fax)
> Work: sjbaker@link.com           http://www.link.com
> Home: sjbaker1@airmail.net       http://www.sjbaker.org