[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Another Long Day Compliments of Object Graphics

Hi Folks,

Just to give you another example of how a five minute
task can turn into most of the afternoon. (I was thinking
about Pavel, just now.)

Someone reported a small bug with my vertical color bar 
object. Since I had the thing open I decided to fool
around with a couple of enhancements I wanted to make
to it so it could easily be called by the XObjView
object graphics viewer. (A *very* handy little gadget
that is easily overlooked, I think.)

Basically, I wanted to put the color bar image into
a polygon, since you can rotate polygons in 3D space,
but you can't rotate images. (There is no practical
purpose in rotating a color bar in 3D space that I know
of, but I always find I learn as much about IDL 
by doing these silly little things as I learn by
doing something I'm likely to get paid for.)

So, it's a simple matter of making the image a texture
map of the polygon. Simple. I got lost a couple of times
in the whole scaling thing, and had the image taking up
the whole window, then taking up a single pixel in the
window, etc. The usual object graphics rigamarole.
But I soon got everything sorted out and scaled correctly.

Only the polygon was black. Not shades of gray, like a 
color bar, but black. Humm. 

I'll make a story that was much too long short by
quoting from the IDL IDLgrPolygon documentation:

   The default color is [0, 0, 0] (white).

Uh, actually the default color is [0,0,0] (**BLACK**).

That fixed it! When I really made the polygon white
the colors showed through. 

I wouldn't go to the trouble of pointing this out to
you if it wasn't the fourth or fifth time I've been
bit by the same snake. I have a new rule of thumb I
have written down and taped to the top of my
computer: *Always* assign colors to objects yourself.
*Never* rely on colors to be what you "think" they are!



David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155