[Bugfix] UIGrid: RenderTexture hard-coded to 1080p causes issues at higher resolutions #228

Closed
opened 2026-01-22 15:49:01 +00:00 by john · 0 comments
Owner

Summary

UIGrid's RenderTexture is hard-coded to 1920x1080, causing rendering errors at resolutions above 1080p.

Root Cause

In UIGrid.cpp line 76:

renderTexture.create(1920, 1080); // TODO - renderTexture should be window size

The existing TODO acknowledges this issue.

Symptoms

  • Grid content clipped or missing at resolutions > 1080p
  • Visual artifacts when grid viewport exceeds texture bounds

Proposed Fix

Options:

  1. Dynamic sizing: Create texture based on actual window/game resolution
  2. On-demand resize: Recreate texture when grid box size changes
  3. Tiled rendering: Use multiple smaller textures (like GridLayers chunk system)
// Option 1: Use game resolution
sf::Vector2u resolution = Resources::game->getGameResolution();
renderTexture.create(resolution.x, resolution.y);

// Option 2: Use grid's box size (simpler, sufficient for most cases)
renderTexture.create(
    static_cast<unsigned int>(box.getSize().x),
    static_cast<unsigned int>(box.getSize().y)
);

Option 2 is probably sufficient since the grid only needs to render what's visible in its viewport.

## Summary UIGrid's RenderTexture is hard-coded to 1920x1080, causing rendering errors at resolutions above 1080p. ## Root Cause In `UIGrid.cpp` line 76: ```cpp renderTexture.create(1920, 1080); // TODO - renderTexture should be window size ``` The existing TODO acknowledges this issue. ## Symptoms - Grid content clipped or missing at resolutions > 1080p - Visual artifacts when grid viewport exceeds texture bounds ## Proposed Fix Options: 1. **Dynamic sizing**: Create texture based on actual window/game resolution 2. **On-demand resize**: Recreate texture when grid box size changes 3. **Tiled rendering**: Use multiple smaller textures (like GridLayers chunk system) ```cpp // Option 1: Use game resolution sf::Vector2u resolution = Resources::game->getGameResolution(); renderTexture.create(resolution.x, resolution.y); // Option 2: Use grid's box size (simpler, sufficient for most cases) renderTexture.create( static_cast<unsigned int>(box.getSize().x), static_cast<unsigned int>(box.getSize().y) ); ``` Option 2 is probably sufficient since the grid only needs to render what's visible in its viewport.
john closed this issue 2026-01-28 23:51:03 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
john/McRogueFace#228
No description provided.