Single-pixel precision issues with GTX 500 series
dthompson

I'm noticing that there are single-pixel misalignments in both primitives and texture coords when running my game on my desktop's GTX card. My laptop's Intel graphics (and other Geforce cards I've tried) seem absolutely fine, though I've only run it on Linux thus far. All are capable of multisampling, and I have it turned on in all cases.

In the screenshot below, you'll note the stars in the background look to be 'between pixels', and the orb sprite (which is rotated) is displaying an edge from something else on the spritesheet. These artifacts aren't there on other cards.

Any ideas?

{"name":"611768","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/9\/b\/9bae262f6badaf078a5bb31e10b6d9f6.png","w":606,"h":402,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/9\/b\/9bae262f6badaf078a5bb31e10b6d9f6"}611768

Chris Katko

Are you using correct pixel coordinates?

https://www.allegro.cc/manual/5/primitives.html

[edit] And the same/newest version of Allegro on each system?

dthompson

Yes to both - as I said, the graphics seem fine on other cards.

Even if I wasn't offsetting the graphics' positions by 0.5, surely this wouldn't explain why the misalignment we're seeing is (in the majority) only vertical and not horizontal?

Chris Katko

To be clear:

1 - I am trying to help.

2 - Those questions I asked may actually provide clues.

Can you post a minimal code example and I'll run it?

dthompson said:

Even if I wasn't offsetting the graphics' positions by 0.5, surely this wouldn't explain why the misalignment we're seeing is (in the majority) only vertical and not horizontal?

When you use wrong coordinates, it does whatever the driver wants to do. It may simply be "undefined" and you've got different drivers choosing a different fix.

What systems are you trying on? 3 Linux boxes? One intel, one geforce, and one geforce 560? All running the same Linux and driver versions? (Note: Linux supports both open-source and nVidia drivers for GeForce cards.)

- You're not stretching the bitmap or window, right? (all bases covered)

- Are you using any Allegro or OpenGL transformations?

- Have you made sure mip-mapping is off?

- What Allegro version? Is it the newest?

dthompson

Sorry - wasn't trying to come off as resentful :P of course, I appreciate the help.

The most minimal example I can think of would be:

#SelectExpand
1#include <allegro5/allegro5.h> 2#include <allegro5/allegro_primitives.h> 3 4int main() 5{ 6 al_init(); 7 al_set_new_display_option(ALLEGRO_SAMPLE_BUFFERS, 1, ALLEGRO_SUGGEST); 8 al_set_new_display_option(ALLEGRO_SAMPLES, 8, ALLEGRO_SUGGEST); 9 ALLEGRO_DISPLAY* disp = al_create_display(100, 100); 10 11 ALLEGRO_EVENT_QUEUE* queue = al_create_event_queue(); 12 13 al_init_primitives_addon(); 14 15 // draw code: 16 al_clear_to_color(al_map_rgb_f(0,0,0)); 17 al_draw_line(0.5, 0.5, 0.5, 3.5, al_map_rgb_f(1,1,1), 1); 18 al_flip_display(); 19 20 ALLEGRO_EVENT e; 21 do 22 { 23 al_wait_for_event(queue, &e); 24 } while(e.type != ALLEGRO_EVENT_KEY_DOWN); 25 26 al_destroy_display(disp); 27 al_destroy_event_queue(queue); 28 return 0; 29}

On other cards, this draws a solid line from (0,0) to (0,2). On the GTX, this results in blurs:

611769

In answer to your questions-

  • Yes, the three Linux boxes I've tried are Intel, (some newer) Geforce M card, and my desktop's GTX 560. All used their latest stable proprietary drivers (390.77 for Geforce)

  • Nope, no stretching or scaling in their window managers

  • My original code used various transforms, but the above doesn't

  • Mipmapping was on in my original code; do you reckon this is causing the texture issues? (if so, why card-specific?)

  • Every example I ran used Allegro 5.2.4

Elias

Use 0.5/0.0 to 0.5/3.0 of you want your line to cover just the three pixels.

Thread #617633. Printed from Allegro.cc