Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
tayloraswift authored Jun 26, 2017
1 parent 21e78bb commit 12f0fc4
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,31 @@
# opengl

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

*OpenGL* is a function loader which allows you to call OpenGL GPU functions from swift programs. These functions are loaded lazily at runtime by *OpenGL*. *OpenGL* also diagnoses invalid OpenGL function calls due to the function not being available on a particular GPU and OpenGL version.

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

```swift
var tex_id:UInt32 = 0
glGenTextures(1, &tex_id)
glBindTexture(GL_TEXTURE_2D, tex_id)
glTexImage2D(target : GL_TEXTURE_2D,
level : 0,
internalformat : GL_RGBA8,
width : h,
height : k,
border : 0,
format : GL_RGBA,
type : GL_UNSIGNED_BYTE,
pixels : pixbuf)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)
```

*OpenGL* also provides typealias definitions for OpenGL types.

```swift
let tex_id1:GLuint
let tex_id2:UInt32
```

0 comments on commit 12f0fc4

Please sign in to comment.