Contents

tayloraswift/swift-opengl

An OpenGL function loader written in pure swift. To use it, `import GL` in your swift file.

Functions

OpenGL provides access to OpenGL functions both with labeled and unlabeled arguments. This can help you avoid common argument ordering bugs.

glClearColor(0.15, 0.15, 0.15, 1)
glClearColor(red: 0.15, green: 0.15, blue: 0.15, alpha: 1)

The function names are the same as the OpenGL C specification, and the argument labels are the same as the parameter names in the C specification, with two exceptions: ` in: has been renamed to input:, and func: has been renamed to f:` to avoid conflicts with Swift keywords.

Constants

OpenGL imports OpenGL constants under the scope GL. Unless doing so would cause the constant’s name to start with a digit, the constant’s redundant GL_ prefix is dropped.

glBlendFunc(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA)

Note: The GL scope is not the same as the module scope which is also called GL. The fully qualified name of an OpenGL enum or an OpenGL type is GL.GL.symbolname. The fully qualified name of an OpenGL function is just GL.functionname.

All OpenGL constants are of one of the following types: GL.Enum, GL.Bitfield, or GL.UInt64. (Int32, UInt32, or UInt64, respectively.)

Types

OpenGL provides typealias definitions for OpenGL types. The typealiases are given Swifty names, and are also scoped to GL.

var tex_id:GL.UInt = 0

| OpenGL C type | OpenGL Swift typealias | OpenGL Swift type | | ----------------- | ----------------- | ------------------------- | | GLboolean | GL.Bool | Bool | | GLdouble | GL.Double | Double | | GLclampd | GL.ClampDouble | Double | | GLfloat | GL.Float | Float | | GLclampf | GL.ClampFloat | Float | | GLbyte | GL.Byte | Int8 | | GLchar | GL.Char | Int8 | | GLcharARB | GL.CharARB | Int8 | | GLshort | GL.Short | Int16 | | GLint | GL.Int | Int32 | | GLsizei | GL.Size | Int32 | | GLenum | GL.Enum | Int32 | | GLfixed | GL.Fixed | Int32 | | GLclampx | GL.ClampX | Int32 | | GLint64 | GL.Int64 | Int64 | | GLint64EXT | GL.Int64EXT | Int64 | | GLintptr | GL.IntPointer | Int | | GLintptrARB | GL.IntPointerARB | Int | | GLsizeiptr | GL.SizePointer | Int | | GLsizeiptrARB | GL.SizePointerARB | Int | | GLvdpauSurfaceNV | GL.VdpauSurfaceNV | Int | | GLubyte | GL.UByte | UInt8 | | GLushort | GL.UShort | UInt16 | | GLhalfNV | GL.HalfNV | UInt16 | | GLuint | GL.UInt | UInt32 | | GLbitfield | GL.Bitfield | UInt32 | | GLuint64 | GL.UInt64 | UInt64 | | GLuint64EXT | GL.UInt64EXT | UInt64 | | GLhandleARB | GL.HandleARB | UnsafeMutableRawPointer? | | GLeglImageOES | GL.EGLImageOES | UnsafeMutableRawPointer? | | GLsync | GL.Sync | OpaquePointer? |

Package Metadata

Repository: tayloraswift/swift-opengl

Default branch: master

README: README.md