{"size": 1629, "ext": "scrbl", "max_stars_repo_path": "scribblings/overview.scrbl", "max_stars_repo_name": "LiberalArtist/sgl", "max_stars_repo_stars_event_min_datetime": "2018-07-29T04:13:52.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-14T16:11:17.000Z", "max_issues_repo_path": "scribblings/overview.scrbl", "max_issues_repo_name": "LiberalArtist/sgl", "max_issues_repo_issues_event_min_datetime": "2017-08-25T20:26:37.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-26T17:48:40.000Z", "max_forks_repo_path": "scribblings/overview.scrbl", "max_forks_repo_name": "LiberalArtist/sgl", "max_forks_repo_forks_event_min_datetime": "2021-06-23T03:01:13.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-01T03:01:16.000Z"}
{"max_stars_count": 10, "max_issues_count": 15, "max_forks_count": 4, "avg_line_length": 50.90625, "max_line_length": 75, "alphanum_fraction": 0.7968078576}
#lang scribble/doc
@(require "common.rkt")

@title[#:tag "overview"]{Using OpenGL}

The @racketmodname[sgl/gl] library provides direct access to the
C-style OpenGL API, whereas the @racketmodname[sgl] library provides a
more Racket-like interface.  The @racketmodname[sgl/gl] library
provides a binding for each @tt{#defined} constant and for most
functions in OpenGL 1.5 and GLU 1.3.  The functions perform comparable
checking to their C-language counterparts; they check the types of
their arguments, but do not check the length of array arguments.  The
@racketmodname[sgl] library provides wrappers around many of the
functions in the @racketmodname[sgl/gl] library to present a more
Racket-friendly interface, including function names that follow Racket
conventions, and checked, symbolic enumeration arguments, and
array-length checks.

@bold{Warning on Safety:} OpenGL programming is inherently unsafe,
even when using only the @racketmodname[sgl] library.  Although
@racketmodname[sgl] checks the arguments to each function call,
violation of higher-level assumptions of the system's OpenGL library
can cause it to crash, bringing the entire Racket system down.  For
example, sending a large number of vertices in a single @tt{glBegin}
causes at least some GL implementations to crash.

Some examples are available in the @filepath{examples} directory of
the @filepath{sgl} collection in the Racket installation.  For
@filepath{alpha.rkt}, try choosing the @filepath{sk.jpg} image distritbuted
with Racket in the @filepath{icons} collection; you may have to
press the @tt{t} key a few times if the spinning cube is blank.
