• Advertisement

Archived

This topic is now archived and is closed to further replies.

Funky alpha transparency...

This topic is 5682 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

howdy ho.. i''m having some weird texture problems, where the alpha bits aren''t lining up properly. i hadn''t noticed until recently because i was using just a black backdrop in my GL scene and black back- ground for my sprites. i''ve changed the colors on both to try to figure out what the deal is, but no dice. its not like the alpha bits are misaligned or something, more like they''ve ''grown'' a pixel or two if you read me. here''s a picture of what''s happening and here''s a gif version of the actual TGA sprite. anything magenta colored is where the alpha bits are. and finally- here''s part of my texture generation code:
  
glGenTextures(1, &texture);					

	glBindTexture(GL_TEXTURE_2D, texture);					
	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);		
	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);		

	gluBuild2DMipmaps(GL_TEXTURE_2D,
		bytesPerPixel,
		width, 
		height, 
		type, 
		GL_UNSIGNED_BYTE, 
		imageData);
  
if anybody has any ideas on why this is happening or have experienced similar troubles, please let me know. -eldee ;another space monkey; [ Forced Evolution Studios ]

::evolve::

Share this post


Link to post
Share on other sites
Advertisement
i take it the prob is the purple border around helicopoter?

if so, its caused by the buldmipmaps function to see why that is go to a paint program make a 256x256 black texture make a white square in the middle, resize that texture to say 32x32 zoom in to maximum (u will see there is now black white + GREY in the image

http://uk.geocities.com/sloppyturds/gotterdammerung.html

Share this post


Link to post
Share on other sites
Zedeek is right. The only way to correct this would be to manually build the mipmaps yourself, but I have no idea how to do this. One other thing tho: are you blending the sprites to the screen? Try using an alphaTEst instead with GL_EQUAL 1.0f as testing settings. This will drop all the interloplated values caused by the mipmapping and thus should get rid of the ''grown'' pixels.


Sander Maréchal
[Lone Wolves Production][Articles][E-mail]

Share this post


Link to post
Share on other sites
ah, i think that worked.. kinda.
before i was using glAlphaFunc(GL_GREATER, 0);
it looks like it''s missing some of the ''thinner''
areas around the prop, but i think with some tweaking
i might be able to get it working right.

-eldee
;another space monkey;
[ Forced Evolution Studios ]


::evolve::

Share this post


Link to post
Share on other sites

  • Advertisement