Japanese
SGL User's Manual
SGL TUTORIAL

PROGRAMMER'S TUTORIAL


1. About Sega Saturn 3D Game Library

1-1.Programming work flow
Host machine settings
ICE settings
Makefile settings/execution
Debugger startup/initial settings
Loading and running the program
debug
1-2. Precautions when using the library
Numbers used in the library
Coordinate system

2. Drawing

2-1.Polygon
2-2.Polygon in SGL
Polygon drawing routine
Parameters required for drawing polygons
2-3. Combination of multiple polygons
Creating a cube
2-4. Polygon distortion problem
Note: SGL library functions that appeared in this chapter

3. Light source

3-1.Light source
3-2.Light source settings
Note: SGL library functions that appeared in this chapter

4.Coordinate transformation

4-1.Coordinate system
4-2. Projection transformation
Perspective transformation
viewing volume
4-3.Modeling conversion
Rotating an object
Moving objects
Scaling objects
Special modeling transformations
Differences in results due to conversion order
4-4. Clipping
2D clipping
3D clipping
4-5.Window
window concept
Window settings in SGL
Resetting the default window
sample program
Range of influence by window
Note: SGL library functions that appeared in this chapter

[Demo program A: Bouncing Cube]

5. Matrix

5-1.Matrix
5-2. Object representation using hierarchical structure
stack
Hierarchy concept
Definition of hierarchical structure by Sega Saturn
5-3.Matrix function
Note: SGL library functions that appeared in this chapter

[Demo program B: Matrix Animation]

6. Camera

6-1. Camera definition and settings
6-2. Camera settings using “slLookAt”
6-3.Actual camera operation
Note: SGL library functions that appeared in this chapter

7. Polygon surface attributes

7-1.Attributes
7-2.Plane
7-3.Sort
7-4.Texture
7-5.Color
7-6.Gouraud
7-7.Mode
7-8.Dir
7-9.Option

8. Scroll

8-1.Scroll in SGL
8-2. Scroll unit
8-3.Screen mode
8-4.Scroll screen
8-5. Storing scroll data in memory
Scroll data type
Storing scroll data in VRAM
Notes on storing data in VRAM 1
Notes on storing data in VRAM 2
Color RAM
Data storage in color RAM
8-6.Scroll function settings
About VRAM access restrictions
character pattern
Scroll restrictions based on number of character colors
Scroll restrictions due to VRAM access
pattern name data
Data type of pattern name data
About auxiliary data
page
plane
map
Reduce settings
Function settings specific to rotating scroll screen 1
Function settings specific to rotating scroll screen 2
Scroll setting flow
8-7.Drawing a scroll
Back screen settings
Display position setting
scroll registration
Notes on scroll registration
Start drawing
Flow of scroll drawing
8-8.Normal scroll screen
Moving the normal scroll screen
Scaling the normal scroll screen
8-9. Rotating scroll screen
rotation scroll movement
Rotating scroll screen scaling
Rotate scroll screen rotation
8-10.Special scrolling function
ASCII scroll
transparent color bit
color calculation
line color screen
color offset
8-11.Priority
8-12.Character numerical display
Note: SGL library functions that appeared in this chapter

9. Controller input

9-1. Input system used in Sega Saturn
9-2. Actual operation
Bits used for input system
Bit operation by input
Handling of device information in SGL
Determining input data
9-3.Sample program
9-4.Library functions used in the sample
sprite function
Other functions
Note: SGL library functions that appeared in this chapter

10. Event control

10-1.Event structure
Event processing
EVENT structure
event list
10-2.Event processing using SGL functions
Initializing the event
Creating an event list
Event format
Executing an event
10-3. Change event list
Add event
Inserting an event
Delete event
Changing the event list while an event is running
10-4.Expanding the USER area
Expansion of user area using work area
Expansion of user area using event area
10-5. Notes on event processing
10-6. Flow of event processing
10-7.Example of using events
Note: SGL library functions that appeared in this chapter

11. Arithmetic functions

11-1. General arithmetic functions
11-2. Trigonometric functions
11-3. Special calculation functions
Note: SGL library functions that appeared in this chapter

[Demo program C: Walking Akira]

12. CD-ROM library

12-1.About CD-ROM library
12-2.CD-ROM access
Logical structure of CD-ROM
Load file
Separate file loading
About the read-ahead function
Playing CDDA files
Other general matters
12-3.CD library functions
CDHN file handle
CDKEY Key for classifying sector data
CDBUF read area information
Sint32 slCdInit (Sint32 nfile, void *work) Initialize
Sint32 slCdChgDir (Sint8 *pathname) Change directory
CDHN slCdOpen (Sint8 *pathname, CDKEY key[]) File open
Sint32 slCdLoadFile (CDHN cdhn, CDBUF buf[]) Load file
Sint32 slCdTrans (CDHN cdhn, CDBUF buf[], Sint32 ndata[]) Stream transfer
Bool slCdResetBuf (CDHN cdhn, CDKEY *key) Reset transfer area
Sint32 slCdAbort (CDHN cdhn) Loading abort
Sint32 slCdPause (CDHN cdhn) Pause reading
Sint32 slCdGetStatus (CDHN cdhn, Sint32 ndata[]) Get status
Error code

13. Backup Library

13-1. Features of backup library
device
File
Deploying the library
13-2.Basic processing flow
13-3.Sample program
Note: Backup library functions

14. Sound Library

14-1. Overview of sound control
14-2.Sound driver settings
Set up the sound driver and start up the MC68000
set of sound data
BGM performance
Sound effect output
Output of sound effects using PCM sound source
Functions that affect the overall sound output
14-3.Memory map
14-4.Sample program
Sample program for BGM and sound effect playback test
Sample program for PCM sound source playback test
Note: Sound library functions that appeared in this chapter

Demo program summary

[Demo program A: Bouncing Cube]
[Demo program B: Matrix Animation]
[Demo program C: Walking Akira]

SGL User's Manual
Copyright SEGA ENTERPRISES, LTD., 1997