My Ubuntu installation seems to have magically guessed my monitor's native resolution (it's the mode it's set to on startup). Unlike most, my monitor's native resolution is NOT its highest resolution, so it's not a matter of picking the highest on the list. Ubuntu must have communicated with the monitor somehow to get this value.
I can not for the life of me figure out how to do this myself. I am trying to write an OpenGL application, and for the most control/best picture I want to set the video mode to the monitor's physical resolution. Is there an API I can use to do this, preferably applicable to linux or X11 in general?