View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0003078 | FSSCP | HUD | public | 2014-07-24 15:40 | 2014-07-31 10:09 |
Reporter | zookeeper | Assigned To | Yarn | ||
Priority | normal | Severity | major | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 3.7.2 | ||||
Target Version | 3.7.2 | ||||
Summary | 0003078: Cockpit displays broken | ||||
Description | Cockpit displays seem to have been broken since r10844. | ||||
Steps To Reproduce | Use attached testmod; it adds a silly test cockpit to GTF Ulysses, and draws the player shields gauge at the center of it. Prior to r10844 everything works correctly: https://dl.dropboxusercontent.com/u/63964618/fs/cockpitdisplaystest.png However, after r10844 the gauge won't show up on the model at all. | ||||
Tags | No tags attached. | ||||
|
|
|
All right, I'll have a look to see what exactly is causing this. In the future, though, keep in mind that you should not specify minimum and maximum resolutions in HUD tables unless they're really necessary. Those fields are not required, and the game has no problem with scaling down gauges. Since my resolution is not at least 1280x1024 (I was running in 1024x768 in windowed mode), I had to remove those fields myself to make the gauge appear in revision 10843. |
|
The problem appears to be that the clip area for the gauge is being placed in the upper-left corner of the texture rather than where the gauge really is. The clip area at least seems to be the right size, though. I still haven't figured out why this is happening. |
|
It turns out that the problem was caused by gr_set_screen_scale() setting the unscaled screen area, which didn't happen before revision 10844. This needs to be done to properly display main halls of any resolution, but it's not appropriate when rendering to a texture. I have attached a patch that makes gr_set_screen_scale() and gr_reset_screen_scale() account for this. It also fixes a pre-10844 bug where scaling down a cockpit gauge would cause the gauge to be improperly clipped if it was close enough to the right or bottom edge of the texture. |
|
mantis3078.patch (2,707 bytes)
Index: code/graphics/2d.cpp =================================================================== --- code/graphics/2d.cpp (revision 10947) +++ code/graphics/2d.cpp (working copy) @@ -151,21 +151,23 @@ gr_screen.custom_size = (w != max_w || h != max_h); - gr_screen.max_w_unscaled = w; - gr_screen.max_h_unscaled = h; + if (gr_screen.rendering_to_texture == -1) { + gr_screen.max_w_unscaled = w; + gr_screen.max_h_unscaled = h; - if (do_zoom) { - gr_screen.max_w_unscaled_zoomed = gr_screen.max_w_unscaled + fl2i(Gr_menu_offset_X * 2.0f / Gr_resize_X); - gr_screen.max_h_unscaled_zoomed = gr_screen.max_h_unscaled + fl2i(Gr_menu_offset_Y * 2.0f / Gr_resize_Y); - if (gr_screen.max_w_unscaled_zoomed > gr_screen.max_w_unscaled) { + if (do_zoom) { + gr_screen.max_w_unscaled_zoomed = gr_screen.max_w_unscaled + fl2i(Gr_menu_offset_X * 2.0f / Gr_resize_X); + gr_screen.max_h_unscaled_zoomed = gr_screen.max_h_unscaled + fl2i(Gr_menu_offset_Y * 2.0f / Gr_resize_Y); + if (gr_screen.max_w_unscaled_zoomed > gr_screen.max_w_unscaled) { + gr_screen.max_w_unscaled_zoomed = gr_screen.max_w_unscaled; + } + if (gr_screen.max_h_unscaled_zoomed > gr_screen.max_h_unscaled) { + gr_screen.max_h_unscaled_zoomed = gr_screen.max_h_unscaled; + } + } else { gr_screen.max_w_unscaled_zoomed = gr_screen.max_w_unscaled; - } - if (gr_screen.max_h_unscaled_zoomed > gr_screen.max_h_unscaled) { gr_screen.max_h_unscaled_zoomed = gr_screen.max_h_unscaled; } - } else { - gr_screen.max_w_unscaled_zoomed = gr_screen.max_w_unscaled; - gr_screen.max_h_unscaled_zoomed = gr_screen.max_h_unscaled; } } @@ -185,8 +187,10 @@ gr_screen.custom_size = Save_custom_screen_size; - gr_screen.max_w_unscaled = gr_screen.max_w_unscaled_zoomed = (gr_screen.res == GR_1024) ? 1024 : 640; - gr_screen.max_h_unscaled = gr_screen.max_h_unscaled_zoomed = (gr_screen.res == GR_1024) ? 768 : 480; + if (gr_screen.rendering_to_texture == -1) { + gr_screen.max_w_unscaled = gr_screen.max_w_unscaled_zoomed = (gr_screen.res == GR_1024) ? 1024 : 640; + gr_screen.max_h_unscaled = gr_screen.max_h_unscaled_zoomed = (gr_screen.res == GR_1024) ? 768 : 480; + } } /** Index: code/graphics/gropengl.cpp =================================================================== --- code/graphics/gropengl.cpp (revision 10947) +++ code/graphics/gropengl.cpp (working copy) @@ -384,6 +384,10 @@ int max_w = ((to_resize) ? gr_screen.max_w_unscaled : gr_screen.max_w); int max_h = ((to_resize) ? gr_screen.max_h_unscaled : gr_screen.max_h); + if ((gr_screen.rendering_to_texture != -1) && to_resize) { + gr_unsize_screen_pos(&max_w, &max_h); + } + if (x >= max_w) { x = max_w - 1; } |
|
Downloaded test mod; couldn't reproduce issue at 1080p, so I set res to 1024x960 to match the screenshot and it showed up immediately. Applied patch, rebuilt, and... problem fails to go away. http://deviance.duckish.net/pictures/fs2_open_3_7_1_AVX-DEBUG%202014-07-30%2012-48-01-58.png |
|
Did you open the HUD table and remove the minimum resolution? The HUD in this particular mod has that set to 1280x1024, so if you don't change or remove the minimum from the table, then the HUD won't appear at any resolution lower than that. |
|
Okay, well, that makes the screenshot demonstrating the issue at 1024x960 a bit silly, but yeah, it works now. Code changes are simple and patch does what it's supposed to do. |
|
ok, I'll see about committing this tonight |
|
Fix committed to trunk@10965. |
fs2open: trunk r10965 2014-07-31 06:35 Ported: N/A Details Diff |
Fix mantis 3078 (From Yarn) Don't set / reset unscaled screen area when rendering to texture Also fix a pre-10844 bug where scaling down a cockpit gauge would cause the gauge to be improperly clipped if it was close enough to the right or bottom edge of the texture. |
Affected Issues 0003078 |
|
mod - /trunk/fs2_open/code/graphics/gropengl.cpp | Diff File | ||
mod - /trunk/fs2_open/code/graphics/2d.cpp | Diff File |
Date Modified | Username | Field | Change |
---|---|---|---|
2014-07-24 15:40 | zookeeper | New Issue | |
2014-07-24 15:40 | zookeeper | Status | new => assigned |
2014-07-24 15:40 | zookeeper | Assigned To | => Yarn |
2014-07-24 15:40 | zookeeper | File Added: cockpittestmod.zip | |
2014-07-24 19:44 | Yarn | Note Added: 0016124 | |
2014-07-24 22:28 | Yarn | Note Added: 0016125 | |
2014-07-27 02:34 | Yarn | File Added: mantis3078.patch | |
2014-07-27 02:34 | Yarn | Note Added: 0016136 | |
2014-07-27 02:34 | Yarn | Status | assigned => code review |
2014-07-27 02:38 | Yarn | File Deleted: mantis3078.patch | |
2014-07-27 02:38 | Yarn | File Added: mantis3078.patch | |
2014-07-30 19:24 | MageKing17 | Note Added: 0016160 | |
2014-07-30 20:31 | Yarn | Note Added: 0016161 | |
2014-07-30 20:45 | MageKing17 | Note Added: 0016162 | |
2014-07-31 01:55 | niffiwan | Note Added: 0016163 | |
2014-07-31 10:09 | niffiwan | Changeset attached | => fs2open trunk r10965 |
2014-07-31 10:09 | niffiwan | Note Added: 0016165 | |
2014-07-31 10:09 | niffiwan | Status | code review => resolved |
2014-07-31 10:09 | niffiwan | Resolution | open => fixed |