[comp.sys.amiga.tech] Multiple ViewPorts

baldwin@usceast.UUCP (Chuck Baldwin) (03/25/88)

[Not being entirely sure where this should go, I post to both]

I am trying to perform a conceptually simple task, of showing two
different views of a large bitmap by using two ViewPorts.  My code
is not in obvious error, and I get bizarre but repeatable results.

Allocate a View, two ViewPorts, two RasInfos, one RastPort, and one BitMap
Initialize these items appropriately:
   Point both RasInfo to BitMap
   Give each ViewPort it's own RasInfo
   Link two ViewPorts through vp.Next field
   Link ViewPorts into View
Do arcane things to generate copper lists
ON_DISPLAY;


The problem is this ... the first ViewPort has graphics correctly
rendered, but the second doesn't. In fact, the second ViewPort is black, which
is not the currently defined background color.  It's as if the display 
is not spewing electrons for the bottom half of the screen.

The program exits okay, so it's not as if I were corrupting system structures
or anything similarly catastrophic.

Anybody able to shed some light on this?  If you really need to see the
code, I can post it, but it's almost exactly like the example code in
RKM vol1 about using Views and ViewPorts.  Really!

                                         Mitch

(Hiding out here under an assumed name ...)

BITNET:   {SXA00051, SXAA00052} @ BAGAMCOK
UUCP:     seismo!ncr-sd!ncrcae!usceast!baldwin
          nosc!crash!pro-carolina!mitch

ewhac@well.UUCP (Leo 'Bols Ewhac' Schwab) (03/27/88)

In article <2554@usceast.UUCP> baldwin@usceast.UUCP (Chuck Baldwin) writes:
>I am trying to perform a conceptually simple task, of showing two
>different views of a large bitmap by using two ViewPorts.  My code
>is not in obvious error, and I get bizarre but repeatable results.
>
	I'm assuming that you've got one viewport on top of another, sort of
like a dragged screen effect.

>[ Outlines his procedure... ]
>
>The problem is this ... the first ViewPort has graphics correctly
>rendered, but the second doesn't. In fact, the second ViewPort is black, which
>is not the currently defined background color.  It's as if the display 
>is not spewing electrons for the bottom half of the screen.
>
	Sounds like it's not making it to the second ViewPort.  I would check
to make sure that the ViewPort.{DxOffset,DyOffset} variables are set up
correctly.  You must leave at least on blank video line between the bottom
of one viewport, and the top of the next one.

	It's hard to say what's going on without looking at the relevant
code section; this is only my suspicion.

_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
Leo L. Schwab -- The Guy in The Cape	ihnp4!ptsfa -\
 \_ -_		Recumbent Bikes:	      dual ---> !{well,unicom}!ewhac
O----^o	      The Only Way To Fly.	      hplabs / (pronounced "AE-wack")
"Work FOR?  I don't work FOR anybody!  I'm just having fun."  -- The Doctor

steveb@cbmvax.UUCP (Steve Beats) (03/28/88)

In article <2554@usceast.UUCP> baldwin@usceast.UUCP (Chuck Baldwin) writes:
>
>[Not being entirely sure where this should go, I post to both]
>
>I am trying to perform a conceptually simple task, of showing two
>different views of a large bitmap by using two ViewPorts.  My code
>is not in obvious error, and I get bizarre but repeatable results.
>
>Allocate a View, two ViewPorts, two RasInfos, one RastPort, and one BitMap
>Initialize these items appropriately:
>   Point both RasInfo to BitMap
>   Give each ViewPort it's own RasInfo
>   Link two ViewPorts through vp.Next field
>   Link ViewPorts into View
>Do arcane things to generate copper lists
>ON_DISPLAY;
>
>
>The problem is this ... the first ViewPort has graphics correctly
>rendered, but the second doesn't. In fact, the second ViewPort is black, which
>is not the currently defined background color.  It's as if the display 
>is not spewing electrons for the bottom half of the screen.
>
I suspect the line where you 'Do arcane things to generate copper lists'.  I
had a similar problem with linked ViewPorts.  When you call MakeVPort(v, vp)
it is not enough to call it with a pointer to the first ViewPort in your list.
YOU MUST CALL MakeVPort() FOR EVERY VIEWPORT LINKED TO vp.Next!!  I am pretty
sure this will fix your problems (poof).

	Steve

BBOURBIN@UMDD.BITNET (Brett S Bourbin) (04/26/88)

I am trying to write a program which uses multiple viewports so that I can
have a double buffered upper screen, which is 352 X 130 lines (overscanned)
and a bottom section which is 288 by 108 lines (narrow screen).  I am setting
the DxOffset and DyOffsets to -16 and -16 for the top and 16 and 110 for the
bottom section.  The routine I wrote is not working.  Matter of fact, it will
not even execute my second ViewPort initialization code.  Could any please
send me a code fragment which sets up two viewports to use different color
palettes and different size screens?

Thanks for any help you can offer.
Brett S Bourbin
bbourbin@umdd.BITNET

avery@puff.cs.wisc.edu (Aaron Avery) (04/29/88)

In article <8804251835.AA01654@jade.berkeley.edu> BBOURBIN@UMDD.BITNET (Brett S Bourbin) writes:
>I am trying to write a program which uses multiple viewports so that I can
>have a double buffered upper screen, which is 352 X 130 lines (overscanned)
>and a bottom section which is 288 by 108 lines (narrow screen).  I am setting
>the DxOffset and DyOffsets to -16 and -16 for the top and 16 and 110 for the
>bottom section.  The routine I wrote is not working.  Matter of fact, it will
>not even execute my second ViewPort initialization code.  Could any please
>send me a code fragment which sets up two viewports to use different color
>palettes and different size screens?

If you examine those DyOffsets carefully, you'll find that 130 (from the
height of the upper screen) plus -16 (it's DyOffset) is more than 110 (from
the DyOffset for the bottom screen). That is -- 130 + (-16) = 114, and
114 > 110. I think you're trying to open overlapping ViewPorts, which the
system will not let you do. One additional note: you must allow at least
one scan line between the two ViewPorts, so that the copper can stuff the
new bitplane pointers, color registers, and screen dimention info into the
appropriate registers. I hope that's your only problem, as you SHOULD be able
to do what you're trying to do quite easily, especially since you seem to be
able to open the top screen already!

-- 
Aaron Avery (avery@puff.cs.wisc.edu)
	    ({seismo,caip,allegra,harvard,rutgers,ihnp4}!uwvax!puff!avery)