# Cels

## Cel Rendering Speed

Q: What affects cel rendering speed?

A: Several factors influence rendering speed:

- If the image is scaled 1:1 and not rotated, rendering time should be a function of the size of the image source data and on the amount of screen area the image covers.

- If the image is scaled down, rendering time can speed up a little, but not significantly.

- If the image is scaled up, rendering slows down.

- If the image is rotated, rendering slows down.

- If only one of the two corner engines is enabled, rendering slows down.

- If the image uses frame buffer data in its pixel processing calculations, rendering time almost doubles.

- If areas of the image extend over the edges of the screen, the cel engine still processes those areas, but does not take the same amount of time processing them as it would rendering them to the screen.

Almost all of these factors relate directly to bus bandwidth. How much data is traveling across the bus (at 50 MB/s) is by far the most critical factor affecting cel rendering speed.

A new feature called super clipping helps speed things up when portions of a cel extend beyond the boundaries of the screen.

Q: I am drawing a cel in a variety of shapes and sizes. Are there any guidelines to determine the optimum size (number of pixels) for the original image?

A: Here are two hints for drawing cels quickly:

- Packed cels with transparency render faster than unpacked cels.
- Small cels render faster than big ones, even when scaled.

See also: Huge Cels Draw Slowly.

## CPU and DMA

Q: The 3DO system uses the DMA when displaying cels. Can the CPU do other work during that time?

A: When the cel engine is running, the CPU can't operate. When the cel engine finishes, the CPU can operate again.

Remember, however, that the cel engine renders graphics much faster than the CPU.

The cel engine pauses for CPU interrupts so that time critical events to maintain the system still function.

## When Cel-Display Calls Return

Q: I need to determine when a display process starts and be notified when it's finished.

A: A `DisplayScreen()` call returns immediately. The specified screen is displayed after the next vertical blank.

A `DrawCels()` call does not return until the cels have been rendered.

## Displaying Text as a Cel

Q: How do I render text into a cel so that I can take advantage of the cel engine's features. None of the text calls takes or returns a CCB.

A: Currently text routines can only render into a bitmap, so you need to have the cel engine extract the text from an off-screen bitmap.

Make sure the CCB for the extracting cel correctly represents the data in the off-screen bitmap. Pay special attention to the CCB preamble words.

## Using Relative Addressing with Cels

Below is a code snippet. The trick is to use the call `MakeCCBRelative`.

``

    CCB* testCelP;
    CCB* nextCelP;
        // assign the relative offset to the next cel
    testCelP->ccb_NextPtr = (CCB*)MakeCCBRelative(&testCelP->ccb_NextPtr,
    nextCelP);
        // be sure to clear this bit!
    ClearFlag(testCelP->ccb_Flags, CCB_NPABS);
    The macros MakeCCBRelative and ClearFlag are defined in
    graphics.h.