Thread: GLX/X11 Changing the rendering resolution

  1. #1
    Registered User
    Join Date
    Jul 2013
    Posts
    1

    Question GLX/X11 Changing the rendering resolution

    I have made a simple application that creates a window with an OpenGL 4.2 context and takes user input.

    I have implemented making the window go fullscreen with XRandR and can change the display resolution.

    I would like to change this so that I don't have to set the displays resolution and only the window/contexts so that it renders at a lower resolution but the display stays at its default.

    How could I implement this? Which extensions provide this or can I do this with XRandR and just manipulating the window rather than the root window(dektop)?

    Thanks.

  2. #2
    Ticked and off
    Join Date
    Oct 2011
    Location
    La-la land
    Posts
    1,728
    I think this answer is too obvious, but since nobody else responded, here goes.

    Quote Originally Posted by Coffee_and_Code View Post
    I would like to [render] at a lower resolution [than the] display[.]
    Create an offscreen surface with the same pixel format as your window, and render to that surface instead of directly to your window.

    Whenever the window needs updating, copy the surface contents to the window (scaling the surface to fill the window).

    If you use two surfaces, you can render to one while drawing the other to the window; this is a classic example of double buffering.

  3. #3
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    2,158
    Quote Originally Posted by Coffee_and_Code View Post
    I would like to change this so that I don't have to set the displays resolution and only the window/contexts so that it renders at a lower resolution but the display stays at its default.
    I would recommend against this.

    Users generally expect all of the pixels on their screen to be taken advantage of, forfeiting resolution (especially without the user's consent) will be unfriendly.

    Besides, unless your rendering resolution is a clear multiple of your screen's, it will be ugly unless you antialias.

    Alternatively, consider providing the option to render to a decorated window where the user may tweak the dimensions to their heart's content.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Changing resolution with API call
    By Narcose in forum Windows Programming
    Replies: 1
    Last Post: 10-21-2006, 02:17 PM
  2. Changing Screen Resolution
    By Tronic in forum Windows Programming
    Replies: 2
    Last Post: 02-23-2005, 02:02 PM
  3. My Resolution
    By RoD in forum A Brief History of Cprogramming.com
    Replies: 31
    Last Post: 01-04-2005, 04:37 PM
  4. Manually Changing Display Resolution on Win98?
    By drdroid in forum Tech Board
    Replies: 5
    Last Post: 06-07-2004, 11:19 AM
  5. What resolution?
    By Cheeze-It in forum A Brief History of Cprogramming.com
    Replies: 28
    Last Post: 09-13-2001, 09:42 AM

Tags for this Thread