Re: Textures with AlphaChannel not working on OS X system
- To: mathgroup at smc.vnet.net
- Subject: [mg125386] Re: Textures with AlphaChannel not working on OS X system
- From: Bob Hanlon <hanlonr357 at gmail.com>
- Date: Sun, 11 Mar 2012 04:07:06 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <201203101115.GAA08119@smc.vnet.net>
It works on a 64-bit Mac with Intel Core 2 Duo, OS X - 10.7.3, and NVIDIA GeForce 320M running Mathematica 8.0.4.0 Bob Hanlon On Sat, Mar 10, 2012 at 6:15 AM, bcomnes <bcomnes at gmail.com> wrote: > Hi, > > I am running into some interesting problems when working with textures on 3D surfaces on my Mac OS X system. First off, system specs of my test systems: > Mac System: > OS X 10.6.8 > Intel Core Duo x86 (32-Bit) > ATI Radeon x1600 > Mathematica 8.0.1 - 8.0.4 > > Windows System: > Windows 7 x64 > Intel Core 2 Duo 3Ghz x64 (64-bit) > Nvidia 260 > Mathematica 8.0.1 > > > Everything seems to be working well on my PC, but on my mac, whenever there are textures involved, there seems to be problems. Apple has made some changes that has caused a lot of compatibility issues with 32 bit systems and recent versions of applications, and this is what I suspect to be the cause of this, but I am not sure. > > Basically, whenever there is a 3D surface that has a texture that has been converted to ImageData so that the alpha channels are respected when applied to the surface, the textured object won't show up when running on my mac. Sometimes it will even result in an unrecoverable crash as soon as the textured object is on screen. > > Is this a know bug? Are there workarounds? > > I included a program that illustrates this issue. I did not write it, but it does not require any image data, so I figured it would work well for this medium. Basically, on my PC, the text "This is a label" is shown. On my mac, it does not show up. > > > label3D[s_, pos_, xVec_, tiltAngle_, opts : OptionsPattern[]] := > Module[{ra, width, height, r}, > ra = Rasterize[ > Style[HoldForm[s], FilterRules[{opts}, Options[Style]], > Magnification -> 10], > Evaluate@ > Apply[Sequence, FilterRules[{opts}, Options[Rasterize]]]]; > {width, height} = ImageDimensions[ra]; > r = SetAlphaChannel[ra, > With[{color = > Apply[List, > ColorConvert[ > "TransparentColor" /. {opts} /. {"TransparentColor" -> > Apply[RGBColor, ImageData[ra][[2, 2]]]}, "RGB"]]}= , > Binarize[ra, (Norm[# - color] > .005) &]]]; > Translate[(* //to make lefthand corner pos*) > Rotate[(* //around z axis*) > Rotate[(* //around y axis*) > Rotate[(* //tilt around x axis*) > Scale[(*//to make width equal| > xVec|*){EdgeForm[FrameStyle /. {opts} /. FrameStyle -> Non= e], > Texture[ImageData@r],(* // > Texture fills polygon initially in the xz plane*) > Polygon[{{0, 0, 0}, {width, 0, 0}, {width, 0, height}, {0= , 0, > height}}, > VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {= 0, > 1}}]}, Norm[xVec]/width, {0, 0, 0}], > tiltAngle, {1, 0, 0}],(* //x rotation*) > Arg[Norm[xVec[[1 ;; 2]]] + I xVec[[3]]], {0, -1, 0}],(* // > y rotation*)Arg[xVec[[1]] + I xVec[[2]]], {0, 0, 1}],(* // > z rotation*)pos]]; > SetAttributes[label3D, HoldFirst]; > > With[{position = {0, 0, 0}, direction = {1.5, 0, 1.3}, > tiltAngle = -.8}, > Graphics3D[{{Glow[White], > label3D["This is a label", position, direction, tiltAngle, > FontColor -> Orange, FontSize -> 18, FontFamily -> "Helvetica", > FontWeight -> Bold, Magnification -> 4, > FrameStyle -> Directive[Purple, Thick]]}}, Boxed -> False, > SphericalRegion -> True, Background -> Cyan]] >
- References:
- Textures with AlphaChannel not working on OS X system
- From: bcomnes <bcomnes@gmail.com>
- Textures with AlphaChannel not working on OS X system