Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GL_TEXTURE_2D on ATI 9600 and 9800



Hi Lorenzo, 

This sounds like it might be a Radeon 9000 driver bug.
Have you filed a radar?
If not, could you do so?
If so, could you tell us the number?

Thanks.

    - Jeremy

ATI Research, Inc.





> From: Lorenzo <email@hidden>
> Date: Wed, 17 Nov 2004 17:00:54 +0100
> To: Alex Eddy <email@hidden>
> Cc: <email@hidden>
> Subject: Re: GL_TEXTURE_2D on ATI 9600 and 9800
> 
> Hi Alex,
> yes it is ATI 9000, it was my mistake at copying the number.
> And both the machines have MacOS X 10.3.5.
> The PowerBook has the build 7M34. The G5 has the build 7P134. Could be this
> the cause of the problem? The old build 7M34?
> 
> I create the texture this way:
> 
> 
> - (BOOL)BuildMap
> {    
>     NSString            *resFolder, *imagePath;
>     NSBitmapImageRep    *imageRep;
>     NSData              *imageData;
> 
>     resFolder = [[NSBundle bundleForClass:[self class]] resourcePath];
>     imagePath = [resFolder stringByAppendingPathComponent:@"myMap.bmp"];
>     
>     imageData = [NSData dataWithContentsOfFile:imagePath];
>     imageRep = [NSBitmapImageRep imageRepWithData:imageData];
>     if(!imageRep) return NO;
>     
>     glGenTextures(1, &gMyMap[0]);
>     return [self GetMyMapFromRep:imageRep];
> }
> 
> 
> 
> - (BOOL)GetMyMapFromRep:(NSBitmapImageRep*)theImage
> {
>     if(theImage == nil) return NO;
>     
>     glActiveTexture(GL_TEXTURE1);
>     glEnable(GL_TEXTURE_2D);
>     glDisable(GL_TEXTURE_RECTANGLE_EXT);
>     
>     int                bitsPPixel, bytesPRow;
>     unsigned char      *theImageData;
>     int                rowNum, destRowNum;
>     GLenum             texFormat = GL_RGB;
>     
>     bitsPPixel = [theImage bitsPerPixel];
>     bytesPRow = [theImage bytesPerRow];
>     
>     glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE);
>     
>     if(bitsPPixel == 24) texFormat = GL_RGB;          // No Alpha
>     else if(bitsPPixel == 32) texFormat = GL_RGBA;    // Yes Alpha
> 
>     NSSize  texSize;
>     texSize.width = [theImage pixelsWide];
>     texSize.height = [theImage pixelsHigh];
>     
>     char    *texBytes = calloc(bytesPRow * texSize.height, 1);
>     if(texBytes == NULL) return NO;
>     
>     theImageData = [theImage bitmapData];
>     for(rowNum = texSize.height - 1, destRowNum = 0;
>         rowNum >= 0; rowNum--, destRowNum++){
>         // ŠŠŠŠŠŠ Copy the entire row in one shot
>         memcpy(texBytes + (destRowNum * bytesPRow), theImageData +
>                 (rowNum * bytesPRow), bytesPRow);
>     }
>     
>     // ŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠ Create mipmapped gMyMap
>     glBindTexture(GL_TEXTURE_2D, gMyMap[0]);
>     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
>     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
>                     GL_LINEAR_MIPMAP_NEAREST);
>     glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
>     glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
>     gluBuild2DMipmaps(GL_TEXTURE_2D, 4, texSize.width, texSize.height,
>                         texFormat, GL_UNSIGNED_BYTE, texBytes);
>     free(texBytes);
>     
>     return YES;
> }
> 
> 
> Then I bind the texture this way:
> ----------------------------------
>     glActiveTexture(GL_TEXTURE1);
>     glDisable(GL_TEXTURE_RECTANGLE_EXT);
>     glEnable(GL_TEXTURE_2D);
>     glEnable(GL_TEXTURE_GEN_S);
>     glEnable(GL_TEXTURE_GEN_T);
>     glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
>     glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
>     glBindTexture(GL_TEXTURE_2D, gMyMap[0]);
> 
> On my ATI 9800 it works all the time. On my ATI 9000 it works only if I set
>     glActiveTexture(GL_TEXTURE0);
> And I tried with this unique texture. I don't do anything else.
> Any idea?
> 
> 
> Best Regards
> -- 
> Lorenzo
> email: email@hidden
> 
>> From: Alex Eddy <email@hidden>
>> Date: Tue, 16 Nov 2004 15:57:51 -0800
>> To: Lorenzo Forum <email@hidden>
>> Cc: email@hidden
>> Subject: Re: GL_TEXTURE_2D on ATI 9600 and 9800
>> 
>> On Nov 16, 2004, at 12:07 PM, email@hidden wrote:
>>> I would like to ask a question about ATI 9600 and 9800.
>>> On my 9800 I can see a Texture2D calling GL_TEXTURE0 or 1 or 2 or 3...
>>> and
>>> it works well.
>>> On my ATI 9600 I can see a Texture2D only if I call GL_TEXTURE0...
>>> Why?
>> 
>> First of all, there is no functional difference between the 9600 and
>> 9800. They both have 8 texture units, with the same extensions and
>> capabilities. If your code is working on one and not the other, it's
>> due to something else (like, the OS version, or you have some
>> conditional execution, or you forgot to initialize a variable somewhere
>> and are getting random results.)
>> 
>> 
>>> On my PowerBook G4 1GHz with an ATI Radeon 9600 (GL_MAX_TEXTURE_UNITS
>>> = 6,
>>> 64 RAM)
>> 
>> There is no such PowerBook configuration. These are the 1GHz configs
>> Apple has sold:
>> 
>> * 1GHz 15" Titanium, 64M Radeon 9000 (6 texture units) introduced Nov
>> 2002
>> * 1GHz 17" Aluminum, 64M GF4MX (2 texture units) introduced Jan 2003
>> * 1GHz 15" Aluminum, 64M Radeon 9600 (8 texture units) introduced Apr
>> 2004
>> 
>> If you have the TiBook, then it is possible that some 9000 driver
>> problem is causing different behavior from your 9800 machine, but I
>> doubt it. If you have the 9600 AlBook, it should behave identically to
>> your 9800 machine.
>> 
>> 
>>>  I can see my texture I made with
>>>     glEnable(GL_TEXTURE_2D);
>>>     glEnable(GL_TEXTURE_GEN_S);
>>>     glEnable(GL_TEXTURE_GEN_T);
>>>     glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
>>>     glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
>>> 
>>> only if I call GL_TEXTURE0. In facts when I set GL_TEXTURE1, I see
>>> garbage.
>> 
>> You have to bind each texture unit to a valid texture ID which has had
>> valid texture data defined.
>> I have no trouble using any available texture unit on my AlBook with
>> 64M Radeon 9600, with or without glTexGen.
>> 
>> 
>>> I don't want to believe that my ATI 9600 can run one GL_TEXTURE_2D
>>> only, and
>>> just the number 0 only, even because GL_MAX_TEXTURE_UNITS return 6
>> 
>> If it really says 6, then it isn't a 9600. The 9600 has 8 units. The
>> 8500, 9000, and 9200 have 6. Of those, only the 9000 was used in
>> PowerBooks. Maybe you have a 9000.
>> 
>> If it is a 9000, then it very well could have different behavior from
>> the 9800 depending what else you are doing. For example
>> ARB_fragment_program won't work. But if you're only doing regular fixed
>> function multitexturing, it should work fine, with up to 6 texture
>> units.
>> 
>> 
>>> So, where should I check for my error?
>> 
>> I would look at your texture creation and binding.
>> 
>> 
>> 
>> On Nov 16, 2004, at 12:07 PM, Gordon Erlebacher wrote:
>>>> I never saw the glActiveTexture command. Ever. It is not in the man
>>>> pages of my powerbook. Why do you need it at all?
>> 
>> The original command was glActiveTextureARB, and the man page for that
>> is still there. The ARB multitexture extension was rolled into the GL
>> core in OpenGL 1.2.1, but the man pages haven't been updated since
>> then. :/
>> 
> 
>  _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Mac-opengl mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/mac-opengl/email@hidden
> 
> This email sent to email@hidden


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Mac-opengl mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/mac-opengl/email@hidden

This email sent to email@hidden

References: 
 >Re: GL_TEXTURE_2D on ATI 9600 and 9800 (From: Lorenzo <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.