Path: utzoo!mnetor!uunet!husc6!endor!olson From: olson@endor.harvard.edu (Eric K. Olson) Newsgroups: comp.sys.mac Subject: Re: Dual Video Card Problem Message-ID: <4515@husc6.harvard.edu> Date: 2 May 88 16:22:33 GMT References: <4WSbwyy00XoCMPY0Mi@andrew.cmu.edu> Sender: news@husc6.harvard.edu Reply-To: olson@endor.UUCP (Eric K. Olson) Organization: Lexington Software Design, Lexington, MA Lines: 69 In a recent article Jude Anand George writes: >I have two video cards in my Mac II, a 16-bit one driving an Apple color >monitor and a 4 bit one driving an Apple greyscale monitor. I have recently >upgraded the latter from 4 to 16-bit, expecting to get 256 shades on each >monitor. Not so. Although they both show up as having 256 in the 'monitors' >CDEV, one will display 256 while the other displays something between 16 and >256. The one that works properly is always the monitor that currently has the >menu bar set to it (with the monitors CDEV); therefore it doesn't seem to be >hardware dependent. Also, if I take either video card out and just use the >other one, it works fine, with the maximum 256 colors. (I am testing this by >running the MandelColor program). The problem isn't with the individual >monitors, either, since I have swapped them and the problem remains the same. >I have also put the cards in various slots with no effect. It seems to be >dependent only on which monitor currently has the menu bar in it (i.e., is the >main screen). It does not depend on whether or not I have it set to color or >greyscale in the CDEV. What you are experiencing is due in part to poor programming in the software you are using to test, and in part due to Apple's not providing a simple way to do things correctly. Everything on a Mac II has a CLUT. PixMaps (multi-bit Bitmaps), Windows, Cursors, and Video Cards all have CLUT (color lookup tables). In order to display a PixMap on a monitor EXACTLY the way it was intended to look, the video card's CLUT must match the PixMap's CLUT. Apple provides two disjoint methods of setting the video card's clut: The Color Manager, and the Palette Manager. In the Color Manager model, the programmer explicitly sets the colors in the video card's CLUT. If there are two video cards, the programmer must set both CLUTs appropriately. In the Palette Manager model, the programmer associates a CLUT with a window and calls ActivatePalette() in response to a window becoming frontmost. The Palette Manager determines which video card(s) the window exists on and sets the CLUTs appropriately. For 256-gray-level images, the CLUT should just be set to a ramp, where Black = R 0, G 0, B 0, and White = R 65536, G 65536, B 65536, and an even distribution of Grays in between. Unfortunately, Apple has provided no way to tell the Palette Manager that a window requires EXACTLY a particular CLUT, with entries in a particular order. Had Apple done this (and had they released the Palette Manager interfaces earlier), many programs that don't work on multiple screens now might have had a fighting chance. My own code goes to great pains to emulate the Palette Manager's behavior, but with the ability to set a video card's CLUT EXACTLY. It is possible to get the Palette Manager to set all the colors in the video card's CLUT, but not in a particular order. This slows down Blitting to the screen significantly. Most code just sets the MainDevice's CLUT explicitly (this is what you are seeing). Blits onto other screens (whose CLUTs are still the Apple default) show about 12 Grey levels, because that's how many are in the default CLUT. The system software is VERY good about always showing you the best fit it can manage for the CLUTs it has to work with. There are other problems with multiple screens: the most annoying is that Pop-Up menus ALWAYS appear on the screen with the MenuBar. Apparently the Menu Manager doesn't know how to deal with multiple screens. Getting your software to work well with multiple screens is no easy task. -Eric Lexington Software Design: Tomorrow's Software Yesterday Eric K. Olson olson@endor.harvard.edu harvard!endor!olson D0760 (Name) (ArpaNet) (UseNet) (AppleLink)