Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rcore] Render issue when window is partially move outside of the monitor #3980

Open
4 tasks done
hubastard opened this issue May 13, 2024 · 2 comments
Open
4 tasks done
Labels
platform: macOS macOS platform

Comments

@hubastard
Copy link

Please, before submitting a new issue verify and check:

  • I tested it on latest raylib version from master branch
  • I checked there is no similar issue already reported
  • I checked the documentation on the wiki
  • My code has no errors or misuse of raylib

Issue description

On MacOS when you drag the window slightly out of the monitor on the left, the rendering shrinks in half in the window, but only if there is a call to BeginTextureMode() in the render loop. If I remove the BeginTextureMode() from my render code, this issue does not happen. (See video below)

Environment

MacOS 14.3.1 (M1 - Apple Chip), OpenGL version 3

Issue Screenshot

bug_raylib_macos.mov

Code Example

#include "raylib.h"

int main(void)
{
  const int windowWidth = 800;
  const int windowHeight = 450;

  InitWindow(windowWidth, windowHeight, "test");

  RenderTexture2D target = LoadRenderTexture(windowWidth, windowHeight);

  while (!WindowShouldClose())
  {
    BeginTextureMode(target);
    EndTextureMode();

    BeginDrawing();
    ClearBackground(BLACK);
    DrawRectangle(0, 0, windowWidth, windowHeight, RED);
    EndDrawing();
  }

  UnloadRenderTexture(target);
  CloseWindow();

  return 0;
}
@raysan5 raysan5 added the platform: macOS macOS platform label May 13, 2024
@raysan5 raysan5 changed the title [raylib] MacOS - Render issue when window is partially move outside of the monitor [rcore] Render issue when window is partially move outside of the monitor May 13, 2024
@raysan5
Copy link
Owner

raysan5 commented May 13, 2024

Wow! Good catch! Why???

@hubastard
Copy link
Author

hubastard commented May 13, 2024

I have a feeling that it's related to a DPI issue. The only thing that I notice is that when the window is centered in the screen GetWindowScaleDPI() returns 2.0 and when I drag it out of the screen it returns 1.0. That could explain why the render is half the size, but it doesn't explain why it works fine when you don't use BeginTextureMode() O.o

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: macOS macOS platform
Projects
None yet
Development

No branches or pull requests

2 participants