Table of Contents Glide Programming Guide



Download 6.22 Mb.
Page19/106
Date03.02.2023
Size6.22 Mb.
#60547
1   ...   15   16   17   18   19   20   21   22   ...   106
GLIDEPGM

4Shutting Down


After an application has completed using Glide and the Voodoo Graphics subsystem, proper shutdown must be performed. This allows Glide to de-allocate system resources like memory, timers, address space, and file handles that were used during program execution.
The function grGlideShutdown() shuts down Glide and all Voodoo Graphics subsystems previously opened with grSstWinOpen(). It should be called only when an application is finished using Glide, and should not be executed unless grGlideInit() and grSstWinOpen() have already been called.
void grGlideShutdown( void )

Example Getting Started.3 shows a minimal Glide program: it executes the four function calls that initialize the Voodoo Graphics subsystem and then terminates.


Example Getting Started.3 A minimal Glide program.
The complete program below includes the Glide initialization and termination procedure and nothing else.
#include

GrHwConfiguration hw;


void main(void)


{
grGlideInit(void);
if (! GrSstQueryHardware(&hw)) printf(“ERROR: no Voodoo Graphics!\n”);
grSstSelect(0);
grSstWinOpen( NULL, GR_RESOLUTION_640x480, GR_REFRESH_60HZ, GR_COLORFORMAT_RGBA
GR_ORIGIN_LOWER_LEFT, 2, 0);
grGlideShutdown();
}

5The Display Buffer


Glide manages several logical hardware graphics buffers, all of which are based out of the same area of memory known as the “frame buffer”. Depending on the amount of memory installed on the hardware, the frame buffer is typically arranged as three logical units: the front buffer, the back buffer, and, optionally, the auxiliary buffer.
void grRenderBuffer( GrBuffer_t buffer )

grRenderBuffer() selects the buffer for primitive drawing and buffer clears. Valid values are GR_BUFFER_FRONTBUFFER and GR_BUFFER_BACKBUFFER; the default is GR_BUFFER_BACKBUFFER.
The auxiliary buffer in a Voodoo Graphics subsystem can be used either as a depth buffer, an alpha buffer, or as a third rendering buffer for triple buffering. The auxiliary buffer is not available on systems with 2MB of frame buffer DRAM running at 800´600. However, it is always available on systems with 4MB of frame buffer DRAM installed or with the screen resolution set to 640´480.
Triple buffering allows an application to continue rendering even when a swap buffer command is pending. When triple buffering is enabled an application can act as if the hardware is operating in double buffer mode; intricacies of dealing with the third buffer are hidden from the application by the hardware. Since the auxiliary buffer can serve only a single use, depth buffering, alpha buffering, and triple buffering are mutually exclusive.
An application selects the purpose of the auxiliary buffer implicitly whenever depth buffering, alpha buffering, or triple buffering are enabled. For example, if grDepthBufferMode() is called with a parameter other than GR_DEPTHBUFFER_DISABLE (see Chapter Chapter 7. ), it is assumed that the auxiliary buffer will be used for depth buffering. Similarly, grSstWinOpen() enables triple buffering; alpha buffering is enabled if grAlphaBlendFunction() selects a destination alpha blending factor (see Chapter Chapter 6. ) or grColorMask() enables writes to the alpha buffer. The release build of Glide does not check for contention of the auxiliary buffer. Unexpected results may occur if the auxiliary buffer is used for more that one function (e.g. both depth buffering and triple buffering are enabled). The debugging version of the library will report the contention.
Note that source alpha blending can coexist with depth or triple buffering, but destination alpha blending cannot.

  1. Table Getting Started.3 Frame buffer resolution and configuration.

The frame buffer can be configured with two or three rendering buffers. In double buffer modes, an alpha or depth buffer can also be used. The available resolution depends on the amount of installed memory.



Frame buffer memory

double buffer mode

double buffer mode with 16-bit alpha/depth buffer

triple buffer mode


Download 6.22 Mb.

Share with your friends:
1   ...   15   16   17   18   19   20   21   22   ...   106




The database is protected by copyright ©ininet.org 2024
send message

    Main page