lights FAQ Forum github.com/luapower/opengl
This package
opengl

Support Libs
opengl
cbframe
unixperms
pixman
lua-headers
shm
llvm
freetype
harfbuzz
fribidi
libunibreak
lx
ffi_reflect
jsmin
linebuffer

opengl

OpenGL C API


The OpenGL API is not usually found in a OS as a straight C library, or at least not all of it is. Instead, the OS supplies a loader API (called WGL in Windows, GLX in Linux, CGL in MacOS X) through which you retrieve pointers to actual OpenGL functions. So while the OpenGL functions and constants themselves are standard, you can only get access to a working OpenGL namespace through a platform-specific API.

local gl = require'winapi.gl11'

Get an OpenGL 1.1 namespace via WGL.

local gl = require'winapi.gl21'

Get an OpenGL 2.1 namespace via WGL.

Functions are discovered automatically through WGL and their pointers memoized for later calls. Below are the function prototypes and constants that are accessible in the gl namespace depending on which OpenGL version you loaded:

Pointer types like eg. PFNGLDRAWARRAYSINDIRECTPROC will be accessible as gl.glDrawArraysIndirect().

local glu = require'glu'

The GLU API contains auxiliary utilities that let you set a perspective transform or an orthogonal transform or move the camera, among other things. glu_lua implements a few of these for environments that don’t have a GLU implementation.

local glut = require'glut'

The GLUT API lets you render the Utah Teapot (other stuff not included).

local wgl = require'winapi'

require'winapi.wgl'

The WGL API provides wglCreateContext for creating an OpenGL context on a HDC. It also provides wglGetProcAddress for discovery of OpenGL functions.

For a straight application of the WGL API see module winapi.wglpanel.

local wglex = require'winapi'

require'winapi.wglext'

The WGLEXT API provides various Windows-specific OpenGL extensions.

TODO

  • make OpenGL constants C enums and access them through a proxy table into ffi.C.
  • make a binding to regal?

Last updated: 8 years ago | Edit on GitHub

Package:opengl
Pkg type:Lua+ffi
Version: 997418e
Last commit:
License: Public Domain

Requires: luajit  winapi.wglpanel  winapi  +glue 

Required by: winapi.wglpanel 


Top