Index: [thread] [date] [subject] [author]
  From: Brian Julin <bri@forcade.calyx.net>
  To  : ggi-develop@eskimo.com
  Date: Fri, 5 Mar 1999 18:34:36 -0500 (EST)

RE: Sprites in video memory

On Sat, 6 Mar 1999, Adrian Ratnapala wrote:

> Or Elnekaveh writes:
>  > be able to point the visual into
>  > drawing into it.
>  > It does mean changing a few values within the visual, but it is the mode/gc
>  > and some other thing.  Then you should be able to draw something on VRAM
>  > using hardware acceleration.
>  > 
>  > Just an idea...
> 
> A seconded idea.  If only I'd known "Surface" was a DD term :)

How do we create a "Surface" or "DrawMap" (Lets use "DrawMap")
that is efficient and elegant?  I mean, you have your functions that 
operate on a visual in the LibGGI api, for example 
GGIPutPixel(vis,x,y,color).  To make the same visual operate on a 
different "DrawMap" that is only slightly different (size and start 
address changed, or maybe just start address), you have two choices.  
One is to alter the gc to point to "DrawMap" #N, perform the operation, 
and then alter the gc again when you want to draw on another "Surface".
That's a bit tedious.  Maybe it would work well for threading or maybe
not. 

The other choice is to duplicate (through an extension) 
all the drawing operations so the API takes the index number of the 
surface to work on in the function, e.g. add 
GGIDrawMapPutPixel(vis,mapnum,x,y,color).  This adds yucky duplicates
to the API and makes it harder to reuse code written for regular
visuals.

I don't like either option.  Can anyone suggest an alternate?
A hacky way to do it would be to store the data that defines drawmaps
in an array in the private area of the visual/gc, and send a typecast
pointer to the location in the array instead of to the visual itself, 
with the drawing library for the visual trained to know how to find 
the parent visual (it registers arrays of drawmaps so it knows to
what parent visual they pertain).  That could provide pretty good 
performance, as the visual could go right to work dereferencing the 
pointer to get the address of the "DrawMap".

--
P.C.M.C.I.A. stands for "Plastic Connectors May Crack If Adjusted"
                                                             -- me
--
Brian S. Julin

Index: [thread] [date] [subject] [author]