Jake
2005.05.05, 08:06 PM
I use Cocoa to load my textures for GL Golf, and for my trees I just use a simple pass fail test for transparencies instead of blending. Before tiger my transparencies had black edges, found below. They looked cool because they gave the edges some detail. BUT now tiger has made those edges white, which looks horrible.
http://nuclearnova.com/images2/glgolf1.1.jpg
How can I fix this. Here is my code to load the texture (PNG with alpha)
glGenTextures( NUMBER_OF_TEXTURES, &texture[0] );
for (textureOn=0; textureOn<NUMBER_OF_TEXTURES; textureOn++)
{
image[textureOn] = [[NSImage alloc] initWithContentsOfFile: path[textureOn]];
imageRep[textureOn] = [[NSBitmapImageRep alloc] initWithData: [image[textureOn] TIFFRepresentation]];
// Create mipmapped texture with an alpha
if ((mode[textureOn] == 2) && (alph[textureOn] == TRUE))
{
glBindTexture( GL_TEXTURE_2D, texture[ textureOn ] );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST );
gluBuild2DMipmaps( GL_TEXTURE_2D, GL_RGBA, size[textureOn], size[textureOn], GL_RGBA,GL_UNSIGNED_BYTE, [imageRep[textureOn] bitmapData]);
}
Can I still use this method or do I need to get a new loader (if so links would be greatly appreciated)
http://nuclearnova.com/images2/glgolf1.1.jpg
How can I fix this. Here is my code to load the texture (PNG with alpha)
glGenTextures( NUMBER_OF_TEXTURES, &texture[0] );
for (textureOn=0; textureOn<NUMBER_OF_TEXTURES; textureOn++)
{
image[textureOn] = [[NSImage alloc] initWithContentsOfFile: path[textureOn]];
imageRep[textureOn] = [[NSBitmapImageRep alloc] initWithData: [image[textureOn] TIFFRepresentation]];
// Create mipmapped texture with an alpha
if ((mode[textureOn] == 2) && (alph[textureOn] == TRUE))
{
glBindTexture( GL_TEXTURE_2D, texture[ textureOn ] );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST );
gluBuild2DMipmaps( GL_TEXTURE_2D, GL_RGBA, size[textureOn], size[textureOn], GL_RGBA,GL_UNSIGNED_BYTE, [imageRep[textureOn] bitmapData]);
}
Can I still use this method or do I need to get a new loader (if so links would be greatly appreciated)