DGL https://delphigl.com/forum/ |
|
TGA files with alpha-channel, problems rendering in OpenGL https://delphigl.com/forum/viewtopic.php?f=19&t=6739 |
Seite 1 von 1 |
Autor: | dpm_dpmartin [ Sa Jul 07, 2007 14:09 ] |
Betreff des Beitrags: | TGA files with alpha-channel, problems rendering in OpenGL |
Hello, I am seeing something quite annoying when using TGA files with an alpha-channel set in OpenGL - I get a rough border around the image of the background colour, even though it looks really neat and separated in other programs like Paint Shop Pro or TGATool. This screenshot should illustrate what I am seeing: Sample Image (180Kb) Is there any way to avoid this? The TGA file itself is located here if anyone wanted to see if they got the same issues when using in OpenGL - I am using Textures.pas version 1.03 from 1 May 2001 which is working so well for me in all other respects. |
Autor: | Lossy eX [ Sa Jul 07, 2007 14:39 ] |
Betreff des Beitrags: | |
The Texture isnt a power of two texture. The Textures.pas using the gluBuild2dMipMaps function to upload the texturedate. Bis this function automatically resize your image to power of two. I thing it will made an 256x512 large image. The glu function interpolate the image data linear wich means that your will get an smooth gradient to red. Because the transparent background has as RGB values red. One thing what you must do is to remove the transparent red background. Fill the background with some light gray. If you stretch the texture in OpenGL the linear filtering of OpenGL will produce the same red border. But if the back is light gray (same as the controler) it will fade gray to gray. Now he faded gray to red. Second. You should rescale you controler in psp to 160x512 and then expand the image to 256x512. You have more transparent space at left and right. But so the aspect ratio is the same as the original image. On your screen you can see that the controler is much wider than original. And the gluBuild2DMipMaps dont change any on the image. [edit] I edited your post. Because the image is large. So its better for the design from the forum. |
Autor: | dpm_dpmartin [ Sa Jul 07, 2007 20:28 ] |
Betreff des Beitrags: | Good advice! |
Thank you. I am making some good progress doing what you described - it looks 10x better now anyway, with the grey instead of red. I still have a few pixel artefacts that don't look right at the bottom of the image, but I will work on seeing if I can get rid of these by, maybe, making sure the whole bottom line of pixels is the alpha-channel colour. |
Seite 1 von 1 | Alle Zeiten sind UTC + 1 Stunde |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |