Hey,
I was wondering how I can get fullscreen access for my GL programs? I’m not using GLUT, just pure X11/GLX and GL, but I’m not used to X programming in general.
/skw|d
Hey,
I was wondering how I can get fullscreen access for my GL programs? I’m not using GLUT, just pure X11/GLX and GL, but I’m not used to X programming in general.
/skw|d
I would like to know the same, unfortunately at the moment I have been really busy and unable to work on that. However, you can link your app to the root window. This will give you fullscreen I believe. Give that a try, the gears demo has a cmdline param to do that maybe try running the gears demo on the root pane first just to make sure I’ve not been miss lead. The problem doing this is any windows you have open will be in front of your GL proggie But it is a start, hopefully this weekend I will have some time to do some more work and that is on my list, I’ll post back next week as to my progress.
I am sure there must be a way to get the dimensions of the current display and create a window that overlaps everything. Would need to be able to resize this window when we change the resolutions too. I am sure someone has already done all this and could point us to some src.
/skw|d
Just an option for ya.
Why not take a look at how glut does it and implement it yourself.
Chris
What function/option in GLUT makes you go fullscreen?
/ Patric
Not sure exactly, have never used it. It isnt specifically in glut, it is in the gameGLUT API.
Thats the best I can remember.
Chris
Hi !
Some xlib macros exist to get a fullscreen window :
W = DisplayWidth(display, defaultScreen);
H = DisplayHeight(display, defaultScreen);
Then use W and H as arguments for XCreateWindow. It does work with Gnome and Kde, dont’t know for others WM.
Note that those macros return the first dimensions defined in you XF86Config file, even if you change them afterwards using Ctrl Alt +.
Hope this helps.
I want to be able to handle resolution changes as well. I am sure there is a template for this sort of thing somewhere.
/skw|d
Ok, I have looked at the Glut code, and what is done there is they turn off the decorations(the borders, menus, that stuff) and make the window the size of the screen. They then insist on making the window top window and don’t allow it to be any lower, when an event is sent.
Changing resolution, I don’t know how to do that, Does anyone know wheather or not Q3 does that? In order to change the resolution you will have to send a command to the server and in general in order to change resolution the server must be restarted. So, I don’t know how that can be done.
I will try to get some code together to get fullscreen with no borders, when I do i’ll give a post.
Neil Witcomb
Yeah, I had a feeling that the window creation was done that way. It is similiar to windows where when a window gets 100% of the GDI surface it gets all the resources.
Mode switching in X is ok, ctrl alt +/-. I had the source to it somewhere, if I get this working I’ll post the code here.
I just thought that someone would have posted this information by now as part of a GLX tutorial… oh well.
/skw|d
If you are using a toolkit like Gtk, Motif or Qt, you should have a drawing_area widget. First you need to measure the x, y screen
dimensions of the screen, then you need to save the current window geometry, so you can
go back later on. Then you set the dimensions of your current window equal to screen dimensions. At this stage your window uses all screen space, but if your application has toolbars, etc… they are still visible. Last thing to do, hide all menus, widgets, etc… made visible by your app, except the drawing_area, so you have now a full screen image of your OpenGL area, you can make photographs etc…
This is how I do it with Mesa, GTK and GTKGLArea.
Try:
glutFullScreen();
and that’s it, you’re done.
My original question states that I am NOT using GLUT. I cannot be sure that all systems I need to run my application on will have GLUT.
/skw|d
Take a look on libSDL sources:
www.libsdl.org
It can switch full screen and change resolution.
Hi,
i had the same problem and browsed through tons of documentation…
Now I think that I have found the way to do it, and its quite simple. You simply have to set the “override-redirect”-flag to True and the window size to screen resolution. The code sample below lacks any error checking and features to switch screen resolution or similar, but i gives me a fullscreen-window without decorations
Here comes the code:
/* attribute list for glx-visual */
static int attrList[] = { GLX_RGBA, GLX_DOUBLEBUFFER,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
None };
int main(int argc, char **argv)
{
Display *dpy;
int screen;
XVisualInfo *vi;
Colormap cmap;
Window win;
GLXContext ctx;
XEvent event;
XSetWindowAttributes attr;
int dpy_width, dpy_height;
/* get a connection */
dpy = XOpenDisplay(0);
screen = DefaultScreen(dpy);
/* get the screen resolution */
dpy_width = DisplayWidth (dpy, screen);
dpy_height = DisplayHeight (dpy, screen);
/* get a visual */
vi = glxChooseVisual (dpy, screen, attrList);
/* create a GLX context */
ctx = glXCreateContext(dpy, vi, 0, GL_TRUE);
/* create a color map */
cmap = XCreateColormap(dpy, RootWindow(dpy, vi->screen),
vi->visual, AllocNone);
/* create a window */
attr.colormap = cmap;
attr.border_pixel = 0;
/* prevent the window-manager from decorating our window */
attr.override_redirect = True;
attr.event_mask = ExposureMask | KeyPressMask | ButtonPressMask |
StructureNotifyMask;
win = XCreateWindow(dpy, RootWindow(dpy, vi->screen), 0, 0, dpy_width,
dpy_height, 0, vi->depth, InputOutput, vi->visual, CWBorderPixel|CWColormap|CWEventMask|CWOverrideRedirect, &attr);
/* display our window in front of everything else */
XMapRaised(dpy, win);
…
}
I hope this is what everyone wanted and that it works not only for me…
cheers and happy coding
bxe Miq
Excellent Miq,
This is exactly what I was looking for. I can easily modify this source to allow on-the-fly resolution changes as well.
Thanks,
/skw|d
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.