Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 6 of 6

Thread: Window offset

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Super Moderator Regular Contributor
    Join Date
    Jul 2001
    Posts
    405

    Window offset

    When creating a top application window on windows 10 i now get a opengl rendering Surface that is extended 8 pixel to the left under the window decorations and 31 pixel under the titlebar. Is there any flag to disable this behaviour at window Creation time as it breaks window compatibility ?

    I can see that it is realted to the WM_NCCALCSIZE event that somehow Changes the client area within the window. I would like to disable this behaviour of my application window.

    I guess that windows with Aero enabled in windows 10 adds a transparent border of 8x31 pixels. Only happends for the topmost window. Does not happend for popup or fullscreen windows
    Last edited by ToolTech; 11-14-2017 at 07:09 AM.

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,170
    Are you calling AdjustWindowRect() before CreateWindow() (or SetWindowPos()) to let the OS bloat the window bounds to account for the frame, border, and caption pixels?:

    Code cpp:
    RECT rect;
    rect.left   = 0;
    rect.top    = 0;
    rect.right  = width;
    rect.bottom = height;
    AdjustWindowRect( &rect, winStyle, FALSE );
     
    HWND win = CreateWindow( "className", "My Window", winStyle,
                             winOriginX, winOriginY,
                             ( rect.right  - rect.left ),  // Adjusted width
                             ( rect.bottom - rect.top  ),  // Adjusted height
                             NULL, NULL, instance, NULL);

    Related reading:



  3. #3
    Super Moderator Regular Contributor
    Join Date
    Jul 2001
    Posts
    405
    Yes you are right but.... That can be done and that will extend the size of the window at creation time and then updated by the NCCALCSIZE.It will then receive the expected size on WM_SIZE then but if i create a viewport using this size with glViewport i wont get the modelview transform right.

    E.g. i have an app that in a traditional non aero environment creates a perfect quad in an perspective view. A unit modelview and an outline from -1 to 1 in x and y will create a perfect outline of the window extent. The same works in a window mode where i use full screen or a Child window in windows 10.

    BUT in a top application that is adjusted with AdjustWindowRect i get exactly the same size of WM_SIZE but now the quad i located outside the visible window. That means that the mapping made by gzViewport dosnt map to the WM_SIZE window so the presentation is wrong. All values in the application regarding size and vieweport are the same

    Perhaps this is a NVidia driver bug...

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Jan 2007
    Posts
    1,728
    GetClientRect is your friend.

    Only resetting your viewport on a resize event is actually a total micro-optimization; all that the viewport does is set a few state bits and transforms; you can safely make a GetClientRect call at the start of each frame, calculate new viewport bounds from that, and make a glViewport call each frame, and trust me - you will not notice one microsecond of measurable performance difference.

  5. #5
    Super Moderator Regular Contributor
    Join Date
    Jul 2001
    Posts
    405
    What i am trying to explain is that is exactly what i do and I get the same values from VM_SIZE. However in the top view window application the scaling is wrong. In the fullscreen ist correct and in a non aero window its correct. Exactly the same values are received in the VM_SIZE event

  6. #6
    Super Moderator Regular Contributor
    Join Date
    Jul 2001
    Posts
    405
    Its a driver issue. It happends on Intel 4.4.0 opengl drivers. Works ok on Intel 4.3.0 and on NVidia 385->

    Solved...

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •