Handmade Hero»Forums»Code
David Salvisberg
2 posts
Slightly off center rendering of textures
On day 256 you talked about how the software renderer might be slightly sloppy about its pixel centers vs the hardware renderer.

Thinking about why this might happen I remembered that for the software renderer to make bilinear scaling easier we added an implicit one pixel apron around the textures.

I don't really have any time to confirm this for myself but I suspect that this is at least one of the causes for textures looking slightly different in the software renderer vs the hardware renderer. It shouldn't put the textures off center but lower resolution textures especially should at least visibly look bigger with the software renderer.

The hardware renderer will presumably consider the apron to be a proper part of the texture rather than something to be discarded. So this would actually eventually show up as a bug in the hardware path rather than the software path and might be worth fixing sooner rather than later.
Casey Muratori
801 posts / 1 project
Casey Muratori is a programmer at Molly Rocket on the game 1935 and is the host of the educational programming series Handmade Hero.
Slightly off center rendering of textures
NICE CATCH! That is an excellent point Daverball! I forgot we did that. We should go look and see if we need to adjust our OpenGL texture coordinates to account for the apron.

- Casey