Offset issue with DrawBar

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Blue Shadow
Posts: 4906
Joined: Sun Nov 14, 2010 12:59 am
Graphics Processor: ATI/AMD (Modern GZDoom)

Offset issue with DrawBar

Post by Blue Shadow »

Tested/produced with: 3.1.0 64-bit, 3.2pre-64-g2ff492d 64-bit


There seems to be an offset problem with DrawBar when drawing the bar reversed (passing SHADER_REVERSE flag):

(Click for full size)
Image

The two bars you see are drawn exactly the same, with the exception that the bottom one is drawn in reverse, yet it's offset by on pixel to the left. Oddly, if you scale the HUD up like say 2x, the bar is drawn correctly.

(Click for full size)
Image

Now, this appears to affect some screen resolution, like 800x600 and 1024x768. On 1366x768, the biggest I can test this on, the bar is drawn fine.

Here is a demo file:
bar_test.pk3
To test, load it with Doom. Switch to the fullscreen HUD while making sure to disable scaling. From the console: 'give ammo'. Fire your pistol seven times.

And as not to overlook this: the non-reversed bar (the top one) is drawn perfectly fine regardless of resolution or HUD scale.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 48361
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Offset issue with DrawBar

Post by Graf Zahl »

If you do not draw at the same coordinates there's no guarantee that it will end up at the same coordinate.
This is simply a rounding problem when the values get scaled. Since ultimately they end up on a display consisting of discrete pixels it can just happen that the values differ by 1.
Sorry, but this cannot be changed.
Blue Shadow
Posts: 4906
Joined: Sun Nov 14, 2010 12:59 am
Graphics Processor: ATI/AMD (Modern GZDoom)

Re: Offset issue with DrawBar

Post by Blue Shadow »

I know this is closed and all, but please, bear with me.

Since I have never encountered this issue with SBARINFO before, I thought I'd recreate the demo, only this time using SBARINFO instead of ZScript. The result of the test? No offset issue whatsoever.

Here's the file:
bar_test_sbar.pk3
So in light of that, I'd like if this issue is looked into again.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 48361
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Offset issue with DrawBar

Post by Graf Zahl »

I can only repeat what I said: If you do not use the same coordinates to draw at you depend on how scaling is performed and how the rendering hardware handles slight coordinate mismatches. It may work in some resolutions but not in others - but at the end of the day the entire thing depends on floating point rounding. This is mathematically not fixable with a low level approach.

Return to “Closed Bugs [GZDoom]”