-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
[rcore][glfw] GetScreenHeight()
returns 0 when used inside RenderTexture and window resized
#4848
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
Comments
GetScreenHeight()
returns 0 when used inside RenderTextureGetScreenHeight()
returns 0 when used inside RenderTexture and window resized
Does not seem to occur on Linux/Xorg with DESKTOP_GLFW This is how it looks like on my side
2025-03-23_05-04-09.mp4@raysan5 I presume, you're using Windows10/11 with GLFW backend ? |
@sleeptightAnsiC Thanks for reviewing this issue, that's what I see: screen_scaling_issue.mp4I think there could be some missunderstanding on my side, afair |
I can now only get your code running and get the same pictured window: make && ./main
g++ -O3 -Wall -std=c++11 -Wno-missing-braces -I/opt/homebrew/Cellar/raylib/5.5/include -c main.cpp -o main.o || (make clean && exit 1) # Clean on compilation failure
g++ main.o -o main -L/opt/homebrew/Cellar/raylib/5.5/lib -lraylib || (make clean && exit 1) # Clean on linking failure
rm -f main.o # Clean up object files after building
INFO: Initializing raylib 5.5
INFO: Platform backend: DESKTOP (GLFW)
INFO: Supported raylib modules:
INFO: > rcore:..... loaded (mandatory)
INFO: > rlgl:...... loaded (mandatory)
INFO: > rshapes:... loaded (optional)
INFO: > rtextures:. loaded (optional)
INFO: > rtext:..... loaded (optional)
INFO: > rmodels:... loaded (optional)
INFO: > raudio:.... loaded (optional)
INFO: DISPLAY: Device initialized successfully
INFO: > Display size: 1440 x 900
INFO: > Screen size: 800 x 450
INFO: > Render size: 800 x 450
INFO: > Viewport offsets: 0, 0
INFO: GLAD: OpenGL extensions loaded successfully
INFO: GL: Supported extensions count: 43
INFO: GL: OpenGL device information:
INFO: > Vendor: Apple
INFO: > Renderer: Apple M1
INFO: > Version: 4.1 Metal - 89.4
INFO: > GLSL: 4.10
INFO: GL: VAO extension detected, VAO functions loaded successfully
INFO: GL: NPOT textures extension detected, full NPOT textures supported
INFO: GL: DXT compressed textures supported
INFO: PLATFORM: DESKTOP (GLFW - Cocoa): Initialized successfully
INFO: TEXTURE: [ID 1] Texture loaded successfully (1x1 | R8G8B8A8 | 1 mipmaps)
INFO: TEXTURE: [ID 1] Default texture loaded successfully
INFO: SHADER: [ID 1] Vertex shader compiled successfully
INFO: SHADER: [ID 2] Fragment shader compiled successfully
INFO: SHADER: [ID 3] Program shader loaded successfully
INFO: SHADER: [ID 3] Default shader loaded successfully
INFO: RLGL: Render batch vertex buffers loaded successfully in RAM (CPU)
INFO: RLGL: Render batch vertex buffers loaded successfully in VRAM (GPU)
INFO: RLGL: Default OpenGL state initialized successfully
INFO: TEXTURE: [ID 2] Texture loaded successfully (128x128 | GRAY_ALPHA | 1 mipmaps)
INFO: FONT: Default font loaded successfully (224 glyphs)
INFO: SYSTEM: Working Directory: /Users/ian/VSCodeProjects/C++ Stuff/Cpp_Games/raylib_project/Test
INFO: TEXTURE: [ID 3] Texture loaded successfully (600x400 | R8G8B8A8 | 1 mipmaps)
INFO: TEXTURE: [ID 1] Depth renderbuffer loaded successfully (32 bits)
INFO: FBO: [ID 1] Framebuffer object created successfully
INFO: TIMER: Target time per frame: 16.667 milliseconds
INFO: FBO: [ID 1] Unloaded framebuffer from VRAM (GPU)
INFO: TEXTURE: [ID 2] Unloaded texture data from VRAM (GPU)
INFO: SHADER: [ID 3] Default shader unloaded successfully
INFO: TEXTURE: [ID 1] Default texture unloaded successfully
INFO: Window closed successfully |
Changing the file back to $ make && ./main
g++ -o main -L/opt/homebrew/Cellar/raylib/5.5/lib -lraylib || (make clean && exit 1) # Clean on linking failure
Undefined symbols for architecture arm64:
"_main", referenced from:
<initial-undefines>
ld: symbol(s) not found for architecture arm64
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
rm -f main
make: *** [main] Error 1 I tried changing my Makefile to use clang, gcc, etc and got the same error with |
Here is a video of what happens when I resize the window: |
i thought “GetRenderWidth()” was a fancy name for “GetWindowWidth()”, not getting width of current buffer. anyway, if its supposed to stick to the bottom and not teleport outside RenderTexture, then why not using something like:
Not sure if this will work, my main language is Csharp. although i believe, that RenderTexture contains its resolution too, so u can use that. |
If you want to make |
When calling
GetScreenHeight()
insideBeginTextureMode()
AND window is scaled, it returns 0.Expected result after resizing: MAROON rectangle drawn at the bottom of the RenderTexture.
Result: MAROON rectangle not draw on screen (maybe drawn outside of screen)
Testing code:
The text was updated successfully, but these errors were encountered: