Weird outline borders on texture alpha lines ??

Started by lwjgl001, July 10, 2009, 07:03:49

Previous topic - Next topic

lwjgl001

Hello!

I have an fresh start with LWJGL, my project is on frozen situtation,
i dont know why my texture builder methods return my textures with black outline.
the outline goes by the alpha line, not texture edges ??

i build my textures from modified .svg files, by using Java2D GeneralPath.

when i just use Java2D drawimage ( _returnBIMGFromSVG() , 0,0,this ); then there is no
visible black outline on alpha borders ??

i build my textures using ->
GL11.glBindTexture    ( GL11.GL_TEXTURE_2D, buffer.get(texturis) );
 GL11.glTexParameteri  ( GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR );
 GL11.glTexParameteri  ( GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_LINEAR );        
 GLU.gluBuild2DMipmaps ( GL11.GL_TEXTURE_2D, GL11.GL_RGBA, w,h, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, bytebuffer );


My temperary address to my project -> http://temp4321.dy.fi/dist5/appletloader.php

i want all the clouds to be without black outline !!

( i believe this is just a some way java handles images, im just too green with Java to know all the 2D tricks )
//----

Thanks,,

lwjgl001

Yet!

I have the following blendfunction ->

_GLColW ( ); //Color 1,1,1,1
GL11.glBlendFunc ( GL11.GL_SRC_ALPHA, GL11.GL_ONE );
_DrawAmmoes ();                                                
GL11.glBlendFunc ( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA );
_DrawClouds ();
_DrawPlanes ();


i dont know how or to what to change my glblendfunc ??
I still have black outline with my clouds ??

demo -> http://temp4321.dy.fi/dist5/appletloader.php

how to fix ??

//----

Thanks,,

Ciardhubh

Maybe there's an issue with the conversion from SVG to ByteBuffer? You could print the ByteBuffer to the console and check if the values are ok.

Your planes' motion blur trail is also vanishing in front of clouds. I wonder if the black cloud border could be the result of some weird depth/alpha testing setting ... hm ...

lwjgl001

Yeps!

I inserted the following code to my game loop ->

GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glAlphaFunc(GL11.GL_GREATER, 0.40f);
_DrawClouds ();
GL11.glDisable(GL11.GL_ALPHA_TEST);


This "fixed" the problem by visuality, but, those black outlines still exist on my textures.
so, does any of you, have any experience with similiar problems, when converting Java2D to OpenGL ??

//----

Thanks,,

tomb

The black outlines are caused by filtering reading the color in the transparent areas. The best fix is to replace the color of the transparent areas with a color that matches the opaque areas.

lwjgl001

Quote from: tomb on July 11, 2009, 18:31:14
The black outlines are caused by filtering reading the color in the transparent areas. The best fix is to replace the color of the transparent areas with a color that matches the opaque areas.

Hei!

Heh, yeps that was the best solution, i get it a bit before your message, i changed the transparent value to alpha 0x0 and rgb to 0x777777,
i now have a very very light gray outline, i may change on later projects the transparent rgb color to stroke/fill color !!

lot better look on my game now !!

//----

Thanks,,