Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 429567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T19:47:17+00:00 2026-05-12T19:47:17+00:00

How exactly would one go about getting an OpenGL app to run fullscreen straight

  • 0

How exactly would one go about getting an OpenGL app to run fullscreen straight from the terminal (Ubuntu Server 9.04)? I’ve developed an application for visual diagnostics on my server, but, I’m not totally sure the best way to get it to run in a windowless environment.


Ideally, I would run my program:

./visualdiagnostics

and have that launch the OpenGL app. Then, via a simple Ctrl+X key binding, I’ll kill the app and go back to the terminal.


Do I need to install X11 and then somehow launch it from within the program? What would be the best way to detect if it’s already running and, start/stop it if necessary?

And FYI: No, I’m not trying to get this to run over Putty or anything… I have a monitor hooked straight up to the server. The server has proper video drivers installed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T19:47:18+00:00Added an answer on May 12, 2026 at 7:47 pm

    There are several parts to your task. Keep in mind that some of this can be very distro-specific; but since you said Ubuntu we’ll talk Ubuntu!

    Also you tagged this question C however I am starting off with a common Linux pattern: a native application with a Bash shell script wrapper. Perhaps once you get things working well you might fold that functionality into C if you have to.

    Detecting whether X is running

    Being root can help a lot. Some things that work.

    1. pgrep Xorg
    2. Check whether /var/lib/gdm/:0.Xauth exists. This will be there even if nobody has logged in but GDM is running.
    3. ls -l /home/*/.Xauthority (Even if you’re not root you can at least confirm whether you are running X.

    Piggybacking an existing X session

    You did not specifically mention it but if you are root at the console, or if you want to run the app as the same user who is already logged in, it’s pretty easy.

    You have to get the DISPLAY and XAUTHORITY environment variables right, and once you do you can use the existing X display.

    For DISPLAY you might just assume :0 or you could find an existing X program (x-session-manager is the GNOME standard) and read its environment from /proc/PID/environ. Variables are in key=value format delimited by a null byte. For example, if its PID is 12345:

    cat /proc/12345/environ \
      | ruby -ne 'puts $_.split("\0").select {|e| e.starts_with? "DISPLAY=" }'
    

    For XAUTHORITY you could get it the same way. Or if you prefer guessing, it’s almost always /home/whoever/.Xauthority

    Once you have those two variables, running X code is easy, for example:

    env DISPLAY=:0 XAUTHORITY=/home/brian/.Xauthority ./visualdiagnostics
    

    Stopping X

    This one is easy if you’re root: /etc/init.d/gdm stop. killall Xorg will work too.

    If you are a user, kill your own Xorg or x-session-manager process. (I’d welcome input from others for the canonical way to do this. Maybe some dbus-send message?)

    Starting X

    I would recommend xinit whose goal in life is to fire X and run exactly one program.

    For example: xinit ./visualdiagnostics

    You can also tell xinit what resolution to run X at which may or may not be important to you. (This becomes important in the full-screen section below.)

    The problem with this is you will have no window manager— no maximize and minimize buttons. It’s not just cosmetic. Usually an app is useless because a popup window cannot be moved or you cannot focus on the right input field. However if you have a special app it could be sufficient (see full-screen below).

    The next step would be my answer to everything: another shell script wrapper! Something simple that starts the window manager and then becomes your program should work.

    #!/bin/bash
    #
    # Start visualdiagnostics once xinit calls me.
    
    /usr/bin/metacity& # Or ratpoison, or fluxbox, or compiz, etc.
    exec ./visualdiagnostics
    

    It’s important to exec (become) the main program because once that first program exits, X will shut down.

    Running fullscreen

    I am not 100% certain on this. Some ideas:

    • Try the standard X -geometry parameters to set 0,0 as the upper-left corner and +x+y for your horizontal and vertical size. How do you know the size? Either you hard-coded it when you launched xinit or you could ask the X server. xwininfo -root will tell you and there is an xlib API call that would do that too—check the xwininfo source I guess.
    • Your app itself can request maximization and/or resizing to fill the screen. I’m not familiar but it is definitely in the X API.
    • Some of the more configurable window managers can be pre-configured to run you maximized already. This is probably what I personally would check first. Your wrapper script could create a $HOME/.fluxboxrc just by echoing some hard-coded configs > the file.

    Summary

    The others are right. X is not strictly necessary sine OpenGL can run against a framebuffer. However considering how ubiquitous X is and how much work has gone into automating it for distributions, I would probably invest my effort into the X route as it might be easier long-term even though it’s a little convoluted.

    (By the way, I sincerely hope when you say “terminal” you mean you are at the text console, not gnome-terminal that would be awful! 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.