OpenGL

1.0.0

pure swift OpenGL function loading
tayloraswift/swift-opengl

What's New

Swift OpenGL

2017-06-26T02:10:18Z

Initial release

Platforms Release tag Build Issues Language License Queen

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 can load any OpenGL function up to OpenGL 4.5.

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

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.

let tex_id1:GLuint
let tex_id2:UInt32

Description

  • Swift Tools 4.0.0
View More Packages from this Author

Dependencies

  • XMLunspecified
Last updated: Fri Oct 18 2024 19:31:02 GMT-0900 (Hawaii-Aleutian Daylight Time)