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