macroquad icon indicating copy to clipboard operation
macroquad copied to clipboard

Incorrect drawing scale

Open murolem opened this issue 3 months ago • 5 comments

Drawn rects are twice as big. Haven't tested other shapes.

Code:

use macroquad::{color, prelude::*};

fn window_conf() -> Conf {
    Conf {
        window_width: 1600, // Set your desired width here
        window_height: 1200, // Set your desired height here
        window_resizable: false, // Set to true to allow manual resizing by the user
        ..Default::default() // Other default settings
    }
}

#[macroquad::main(window_conf)]
async fn main() {
    let rect_size_px = 100.0;
    loop {
        for i in 0..10 {
            for j in 0..10 {
                draw_rectangle(
                    j as f32 * rect_size_px, 
                    i as f32 * rect_size_px,
                    rect_size_px, 
                    rect_size_px, 
                    color::GREEN
                );
            }
        }

        next_frame().await;
    }
}
Image

A window with rects filling part of the window was expected.


Macroquad 0.4.14

System info: Operating System: Kubuntu 25.04 KDE Plasma Version: 6.3.4 KDE Frameworks Version: 6.12.0 Qt Version: 6.8.3 Kernel Version: 6.14.0-32-generic (64-bit) Graphics Platform: Wayland Processors: 16 × AMD Ryzen 7 5800X 8-Core Processor Memory: 31,3 GiB of RAM Graphics Processor: NVIDIA GeForce RTX 4090 Manufacturer: Micro-Star International Co., Ltd. Product Name: MS-7D52 System Version: 1.0

murolem avatar Sep 28 '25 18:09 murolem

Mmh, works for me. Also note that the green rectangle picture that you attached is 1600px wide. I am running arch with new kde, too. (I set the rectangle_width to 159px, to visually check a ten pixel black border to the right + used KRuler). 🤷 Works on both of my screens.

fwolfst avatar Sep 29 '25 16:09 fwolfst

Mmh, works for me. Also note that the green rectangle picture that you attached is 1600px wide. I am running arch with new kde, too. (I set the rectangle_width to 159px, to visually check a ten pixel black border to the right + used KRuler). 🤷 Works on both of my screens.

Ohh good catch. Yeah I used the default measures that pop up when taking a screenshot. Now seeing that they are incorrect. So only the rect size issue remains then.

Note: I've updated the issue body and title to reflect only this problem.

murolem avatar Sep 29 '25 16:09 murolem

Maybe set high_dpi to false explicitly? I dont have a high_dpi setup to test.

fwolfst avatar Sep 29 '25 16:09 fwolfst

Maybe set high_dpi to false explicitly? I dont have a high_dpi setup to test.

No difference. It says it should be false by default.

murolem avatar Sep 29 '25 19:09 murolem

Same issue here. Here the system I'm using:

System:
  Kernel: 6.14.0-33-generic arch: x86_64 bits: 64 compiler: gcc v: 13.3.0 clocksource: tsc
  Desktop: Cinnamon v: 6.4.8 tk: GTK v: 3.24.41 wm: Muffin v: 6.4.1 vt: 7 dm: LightDM v: 1.30.0
    Distro: Linux Mint 22.2 Zara base: Ubuntu 24.04 noble
Machine:
  Type: Laptop System: SLIMBOOK product: CREA15-A8-RTX v: Standard serial: <superuser required>
  Mobo: SLIMBOOK model: CREA15-A8-RTX v: Standard serial: <superuser required>
    part-nu: CREA15-A8-RTX uuid: <superuser required> UEFI: American Megatrends LLC. v: N.1.09GOS01
    date: 04/29/2025
CPU:
  Info: 8-core model: AMD Ryzen 7 8845HS w/ Radeon 780M Graphics bits: 64 type: MT MCP smt: enabled
    arch: Zen 4 rev: 2 cache: L1: 512 KiB L2: 8 MiB L3: 16 MiB
  Speed (MHz): avg: 3850 high: 4842 min/max: 400/5137 boost: enabled cores: 1: 4841 2: 3235
    3: 4841 4: 4841 5: 4837 6: 3227 7: 4842 8: 3226 9: 4832 10: 3227 11: 3377 12: 3586 13: 1100
    14: 3526 15: 4839 16: 3226 bogomips: 121376
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
Graphics:
  Device-1: NVIDIA AD106M [GeForce RTX 4070 Max-Q / Mobile] vendor: Tongfang Hongkong
    driver: nvidia v: 580.65.06 arch: Lovelace pcie: speed: 16 GT/s lanes: 8 ports: active: none
    off: HDMI-A-1 empty: DP-6,eDP-2 bus-ID: 01:00.0 chip-ID: 10de:2820 class-ID: 0300
  Device-2: AMD Phoenix3 vendor: Tongfang Hongkong driver: amdgpu v: kernel arch: RDNA-3 pcie:
    speed: 16 GT/s lanes: 16 ports: active: eDP-1 empty: DP-1, DP-2, DP-3, DP-4, DP-5, Writeback-1
    bus-ID: 07:00.0 chip-ID: 1002:1900 class-ID: 0300 temp: 42.0 C
  Device-3: Kingcome FHD WebCam driver: uvcvideo type: USB rev: 2.0 speed: 480 Mb/s lanes: 1
    bus-ID: 1-3:3 chip-ID: 2b7e:c858 class-ID: fe01 serial: <filter>
  Display: x11 server: X.Org v: 21.1.11 with: Xwayland v: 23.2.6 driver: X: loaded: amdgpu,nvidia
    unloaded: fbdev,modesetting,nouveau,vesa dri: radeonsi
    gpu: amdgpu,nv_platform,nvidia,nvidia-nvswitch display-ID: :0 screens: 1
  Screen-1: 0 s-res: 7680x2880 s-dpi: 144 s-size: 1355x508mm (53.35x20.00")
    s-diag: 1447mm (56.97")
  Monitor-1: HDMI-A-1 mapped: HDMI-0 note: disabled pos: primary,right model: H27D9
    res: 5120x2880 dpi: 247 size: 527x296mm (20.75x11.65") diag: 685mm (27") modes: max: 2560x1440
    min: 640x480
  Monitor-2: eDP-1 mapped: eDP-1-0 pos: left model: BOE Display 0x0c85 res: 2560x1600 hz: 120
    dpi: 198 size: 329x206mm (12.95x8.11") diag: 388mm (15.3") modes: max: 2560x1600 min: 640x480
  API: EGL v: 1.5 hw: drv: nvidia nouveau drv: nvidia drv: amd radeonsi platforms: device: 0
    drv: nvidia device: 1 drv: nouveau device: 2 drv: radeonsi device: 3 drv: swrast gbm: drv: nvidia
    surfaceless: drv: nvidia x11: drv: nvidia inactive: wayland
  API: OpenGL v: 4.6.0 compat-v: 4.5 vendor: nvidia mesa v: 580.65.06 glx-v: 1.4
    direct-render: yes renderer: NVIDIA GeForce RTX 4070 Laptop GPU/PCIe/SSE2
Audio:
  Device-1: NVIDIA vendor: Tongfang Hongkong driver: snd_hda_intel v: kernel pcie: speed: 16 GT/s
    lanes: 8 bus-ID: 01:00.1 chip-ID: 10de:22bd class-ID: 0403
  Device-2: AMD Rembrandt Radeon High Definition Audio vendor: Tongfang Hongkong
    driver: snd_hda_intel v: kernel pcie: speed: 16 GT/s lanes: 16 bus-ID: 07:00.1 chip-ID: 1002:1640
    class-ID: 0403
  Device-3: AMD ACP/ACP3X/ACP6x Audio Coprocessor vendor: Tongfang Hongkong driver: snd_pci_ps
    v: kernel pcie: speed: 16 GT/s lanes: 16 bus-ID: 07:00.5 chip-ID: 1022:15e2 class-ID: 0480
  Device-4: AMD Family 17h/19h HD Audio vendor: Tongfang Hongkong driver: snd_hda_intel v: kernel
    pcie: speed: 16 GT/s lanes: 16 bus-ID: 07:00.6 chip-ID: 1022:15e3 class-ID: 0403
  API: ALSA v: k6.14.0-33-generic status: kernel-api
  Server-1: PipeWire v: 1.0.5 status: active with: 1: pipewire-pulse status: active
    2: wireplumber status: active 3: pipewire-alsa type: plugin
Network:
  Device-1: Realtek RTL8111/8168/8211/8411 PCI Express Gigabit Ethernet vendor: Tongfang Hongkong
    RTL8111/8168/8411 driver: r8169 v: kernel pcie: speed: 2.5 GT/s lanes: 1 port: e000
    bus-ID: 03:00.0 chip-ID: 10ec:8168 class-ID: 0200
  IF: enp3s0 state: up speed: 1000 Mbps duplex: full mac: <filter>
  Device-2: MEDIATEK MT7922 802.11ax PCI Express Wireless Network Adapter vendor: AzureWave
    driver: mt7921e v: kernel pcie: speed: 5 GT/s lanes: 1 bus-ID: 04:00.0 chip-ID: 14c3:7922
    class-ID: 0280
  IF: wlp4s0 state: down mac: <filter>
Info:
  Memory: total: 32 GiB note: est. available: 30.64 GiB used: 8.93 GiB (29.1%)
  Processes: 441 Power: uptime: 46m states: freeze,mem,disk suspend: s2idle wakeups: 0
    hibernate: platform Init: systemd v: 255 target: graphical (5) default: graphical
  Compilers: gcc: 13.3.0 Client: Cinnamon v: 6.4.8 inxi: 3.3.34

I had no problem with my old Win 10 system (I'll put system info later) or with driver nvidia v: 535.274.02a

Faust90 avatar Oct 03 '25 21:10 Faust90