   Yet Another OpenGL Alpha Masking Issue
  Hey everybody,I just wrote a particle simulation with many (~10^6) spheres colliding. I render the results via OpenGL Point Sprites. My problem is that the TGA texture I use for each particle has a black border and I can't figure out how to make it disappear. The image I use is pretty much http://helios.univ-reims.fr/Labos/LERI/membre/bittar/03OpenGL/TD16/particle.tga (loaded following NeHe lesson 33), so it's quite easy to generate an alpha map to use masking (and I did so already). Now what do I have to do to cut off the black area? (I found e.g. topic_id=535939, but I didn't find a solution though it must be easy.)I feel quite stupid to ask this, but my previous attempts just didn't work. Maybe it's because I worked all night and just can't look straight anymore...Looks nice actually - just the black border disturbs the result.Thanks in advance.Best regards,ShunyataPS:To implement the Point Sprite rendering I mainly followed http://www.ploksoftware.org/ExNihilo/pages/Tutorialpointsprite.htm , the point sprite example on http://www.codesampler.com/oglsrc/oglsrc_6.htm as well as http://www.lighthouse3d.com/opengl/billboarding/index.php3?billCheat1 (compare Adrian Boeing's recommendations).[Edited by - Shunyata on June 12, 2009 6:10:16 AM]
  After you've generated the alpha channel for masking, for any masked pixels, the RGB channels should be filled in with neighboring colours.e.g. given a small bitmap like this, where Y = yellow pixel, and X = masked pixel (black).XYYYAfter generating the alpha channel, the X pixel should become a Y pixel to avoid borders.Alternatively you can increase the alpha masking reference value to 254.   ;  Wow - Thank you very much for your ultra-fast reply. I basically understand what you say (except setting the "alpha masking reference value" ^^), but I still have no clue on how to implement it.Let's take a look at my code, which is at this point strongly based on aforementioned tutorials, so hopefully many people are quickly able to relate to it:.:: Initialisation - Loading Of Texture (called once on proram startup)if(LoadTGA(&texture[0], (char*)"particle.tga")){/* Typical Texture Generation Using Data From The TGA */glGenTextures(1, &texture[0].texID);/* Create The Texture */glBindTexture(GL_TEXTURE_2D, texture[0].texID);glTexImage2D(GL_TEXTURE_2D, 0, 3, texture[0].width, texture[0].height, 0, GL_RGB, GL_UNSIGNED_BYTE, texture[0].imageData);glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);if (texture[0].imageData){/* If Texture Image Exists */free(texture[0].imageData);/* Free The Texture Image Memory */}printf("TGA texture loaded.");}else{printf("ERROR: Couldn't load TGA texture.");}.:: Point Sprite Rendering (in glutDisplayFunc)//Initialisation:glClearColor (0.0, 0.0, 0.0, 0.0);glShadeModel (GL_FLAT);glEnable (GL_CULL_FACE);glEnable(GL_TEXTURE_2D);//Blending:glEnable(GL_BLEND);glBlendFunc(GL_SRC_ALPHA, GL_ONE);glBindTexture(GL_TEXTURE_2D, texture[0].texID);//Rendering:float quadratic[] =  { 0.0f, 0.0f, 0.01f };glPointParameterfvARB( GL_POINT_DISTANCE_ATTENUATION_ARB, quadratic );float maxSize = 0.0f;glGetFloatv( GL_POINT_SIZE_MAX_ARB, &maxSize );glPointSize( maxSize );glPointParameterfARB( GL_POINT_SIZE_MAX_ARB, maxSize );glPointParameterfARB( GL_POINT_SIZE_MIN_ARB, 1.0f );glTexEnvf( GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE );glEnable( GL_POINT_SPRITE_ARB );glBegin( GL_POINTS );{    for(i=0;i<client_g_number_of_particles;i++){glBlendFunc(GL_SRC_ALPHA,GL_ONE);glColor4f(properties.rgb_r, properties.rgb_g, properties.rgb_b,10.0f);glVertex3f(particlePtr.x,particlePtr.y,particlePtr.z);    }}glEnd();glDisable(GL_POINT_SPRITE_ARB);(And I got a second file particle_alpha.tga, which is just an inverted version of particle.tga, so the irritating borders are coloured white in there.)Now could someone guide me what to write to realize the ideas?Again: The problem is that the black border of the images (comp. http://helios.univ-reims.fr/Labos/LERI/membre/bittar/03OpenGL/TD16/particle.tga) remains clearly visible and though I understood what I have to do in theory, I still need some help on how to actually write it in code. Thanks in advance.Best regards,ShunyataPS:I'll finally get some sleep (been awake for over 30h now). Maybe tomorrow I'll see things more clearly, though I apologize for being quite a beginner in OpenGL anyway ;);  Oh my, I knew this was gonna be awkward - After some sleep I just discovered that I simply forgot to disable Z-Buffering (probably the most b00n-like mistake there is): glDisable(GL_DEPTH_TEST); and everything works fine. Thanks for giving me the time to find it myself - otherwise I'd really been embarrassed ;)Best regards,Shunyata   