Module GLX


module GLX: sig .. end
OCaml bindings for the GLX library.




Types


type uint = int 
type glXContext 
type glXFBConfigID 

type opengl_rendering_modes =
| GLX_RGBA_BIT
| GLX_COLOR_INDEX_BIT

type drawable_type =
| GLX_WINDOW_BIT
| GLX_PIXMAP_BIT
| GLX_PBUFFER_BIT

type x_visual_type =
| GLX_TRUE_COLOR
| GLX_DIRECT_COLOR
| GLX_PSEUDO_COLOR
| GLX_STATIC_COLOR
| GLX_GRAY_SCALE
| GLX_STATIC_GRAY

type config_caveat =
| GLX_CONFIG_CAVEAT_NONE
| GLX_SLOW_CONFIG
| GLX_NON_CONFORMANT_CONFIG

type transparent_type =
| GLX_TRANSPARENT_NONE
| GLX_TRANSPARENT_RGB
| GLX_TRANSPARENT_INDEX
module FBConfig: sig .. end
module Visual: sig .. end

type attrib_bit =
| GLX_ACCUM_BUFFER_BIT
| GLX_COLOR_BUFFER_BIT
| GLX_CURRENT_BIT
| GLX_DEPTH_BUFFER_BIT
| GLX_ENABLE_BIT
| GLX_EVAL_BIT
| GLX_FOG_BIT
| GLX_HINT_BIT
| GLX_LIGHTING_BIT
| GLX_LINE_BIT
| GLX_LIST_BIT
| GLX_MULTISAMPLE_BIT
| GLX_PIXEL_MODE_BIT
| GLX_POINT_BIT
| GLX_POLYGON_BIT
| GLX_POLYGON_STIPPLE_BIT
| GLX_SCISSOR_BIT
| GLX_STENCIL_BUFFER_BIT
| GLX_TEXTURE_BIT
| GLX_TRANSFORM_BIT
| GLX_VIEWPORT_BIT
This parameter is in fact an OpenGL GL-enum with a GL_ prefix. This enum is included here in order to avoid a dependency across any ocaml-opengl bindings (there are 3 ones). The GL_ prefix was changed for a GLX_ prefix in order to not collide with this parameter in the OpenGL module.

glXDrawable


type 'a glXDrawable 
type _glXWindow 
type glXWindow = GLX._glXWindow glXDrawable 
type _glXPbuffer 
type glXPbuffer = GLX._glXPbuffer glXDrawable 
type _glXPixmap 
type glXPixmap = GLX._glXPixmap glXDrawable 
all { glxWindow, glxPixmap, glxPbuffer and Xlib.window } are some glxDrawable
val glXDrawable_of_window : win:Xlib.window -> 'a glXDrawable

Initialization


val glXQueryExtension : dpy:Xlib.display -> unit

man
val glXQueryVersion : dpy:Xlib.display -> int * int

returns (major, minor)

GLX Versioning


val glXQueryExtensionsString : dpy:Xlib.display -> screen:Xlib.screen_number -> string

man

type glx_name =
| GLX_VENDOR
| GLX_VERSION
| GLX_EXTENSIONS
val glXQueryServerString : dpy:Xlib.display -> screen:Xlib.screen_number -> name:glx_name -> string

man
val glXGetClientString : dpy:Xlib.display -> name:glx_name -> string

man

Configuration Management


type glXFBConfig 
val glXChooseFBConfig : dpy:Xlib.display ->
screen:Xlib.screen_number ->
attribs:FBConfig.attrib list -> glXFBConfig list

man

To free the resources associated with the returned list, provide this list unchanged to

val glXGetFBConfigs : dpy:Xlib.display -> screen:Xlib.screen_number -> glXFBConfig list

man

To free the resources associated with the returned list, provide this list unchanged to

val xFree_glXFBConfig : glXFBConfig list -> unit

Frees the resources associated with the list returned by glXGetFBConfigs or glXChooseFBConfig, you have to provide the list unchanged.
val glXGetVisualFromFBConfig : dpy:Xlib.display -> config:glXFBConfig -> Xlib.xVisualInfo

man

On Screen Rendering


val glXCreateWindow : dpy:Xlib.display ->
config:glXFBConfig -> win:Xlib.window -> glXWindow

man
val glXDestroyWindow : dpy:Xlib.display -> win:glXWindow -> unit

man

Off Screen Rendering


val glXCreatePixmap : dpy:Xlib.display ->
config:glXFBConfig ->
pixmap:Xlib.pixmap -> attribs:'a list -> glXPixmap

man
val glXDestroyPixmap : dpy:Xlib.display -> pixmap:glXPixmap -> unit

man

type pbuf_attrib =
| GLX_PBUFFER_WIDTH of int
| GLX_PBUFFER_HEIGHT of int
| GLX_LARGEST_PBUFFER of bool
| GLX_PRESERVED_CONTENTS of bool
val glXCreatePbuffer : dpy:Xlib.display -> config:glXFBConfig -> glXPbuffer

man
val glXDestroyPbuffer : dpy:Xlib.display -> pbuf:glXPbuffer -> unit

Querying Attributes



Rendering Contexts



type render_type =
| GLX_RGBA_TYPE
| GLX_COLOR_INDEX_TYPE
val glXCreateNewContext : dpy:Xlib.display ->
config:glXFBConfig ->
render_type:render_type ->
share_list:glXContext option -> direct:bool -> glXContext

man
val glXDestroyContext : dpy:Xlib.display -> ctx:glXContext -> unit

man
val glXIsDirect : dpy:Xlib.display -> ctx:glXContext -> bool

man
val glXMakeContextCurrent : dpy:Xlib.display ->
draw:'a glXDrawable ->
read:'a glXDrawable -> ctx:glXContext -> unit
val glXMakeContextCurrent_release : dpy:Xlib.display -> unit

man
val glXCopyContext : dpy:Xlib.display ->
ctx:glXContext -> mask:attrib_bit list -> glXContext

man

Events



Synchronization Primitives


val glXWaitGL : unit -> unit

man
val glXWaitX : unit -> unit

man

Double Buffering


val glXSwapBuffers : dpy:Xlib.display -> drawable:'a glXDrawable -> unit

man

Access to X Fonts


val glXUseXFont : font:Xlib.font -> first:int -> count:int -> gl_list:int -> unit

man

Backwards Compatibility



GLX 1.2 functions which are deprecated in GLX 1.4


val glXChooseVisual : dpy:Xlib.display ->
screen:Xlib.screen_number ->
attribs:Visual.attrib list -> Xlib.xVisualInfo

man
val glXCreateContext : dpy:Xlib.display ->
vis:Xlib.xVisualInfo ->
share_list:glXContext option -> direct:bool -> glXContext

man
val glXMakeCurrent : dpy:Xlib.display -> drawable:'a glXDrawable -> ctx:glXContext -> unit
val glXMakeCurrentNone : dpy:Xlib.display -> unit

man

Work in Progress



Warning: This module is currently under construction.
module GetConf: sig .. end
module GetConfEXT: sig .. end
type _a 
a fake type to make a hack, read the doc of the function glXGetFBConfigAttrib

type bind_to_tex_target =
| GLX_TEXTURE_1D_BIT_EXT
| GLX_TEXTURE_2D_BIT_EXT
| GLX_TEXTURE_RECTANGLE_BIT_EXT
val _GLX_FBCONFIG_ID : GetConf.req_attribute * (GLX._a -> glXFBConfigID)
val _GLX_BUFFER_SIZE : GetConf.req_attribute * (GLX._a -> bool)
val _GLX_LEVEL : GetConf.req_attribute * (GLX._a -> int)
val _GLX_DOUBLEBUFFER : GetConf.req_attribute * (GLX._a -> bool)
val _GLX_STEREO : GetConf.req_attribute * (GLX._a -> bool)
val _GLX_AUX_BUFFERS : GetConf.req_attribute * (GLX._a -> uint)
val _GLX_RED_SIZE : GetConf.req_attribute * (GLX._a -> uint)
val _GLX_GREEN_SIZE : GetConf.req_attribute * (GLX._a -> uint)
val _GLX_BLUE_SIZE : GetConf.req_attribute * (GLX._a -> uint)
val _GLX_ALPHA_SIZE : GetConf.req_attribute * (GLX._a -> uint)
val _GLX_DEPTH_SIZE : GetConf.req_attribute * (GLX._a -> uint)
val _GLX_STENCIL_SIZE : GetConf.req_attribute * (GLX._a -> uint)
val _GLX_ACCUM_RED_SIZE : GetConf.req_attribute * (GLX._a -> uint)
val _GLX_ACCUM_GREEN_SIZE : GetConf.req_attribute * (GLX._a -> uint)
val _GLX_ACCUM_BLUE_SIZE : GetConf.req_attribute * (GLX._a -> uint)
val _GLX_ACCUM_ALPHA_SIZE : GetConf.req_attribute * (GLX._a -> int)
val _GLX_RENDER_TYPE : GetConf.req_attribute * (GLX._a -> render_type list)
val _GLX_DRAWABLE_TYPE : GetConf.req_attribute * (GLX._a -> drawable_type list)
val _GLX_X_RENDERABLE : GetConf.req_attribute * (GLX._a -> bool)
val _GLX_VISUAL_ID : GetConf.req_attribute * (GLX._a -> Xlib.visualID option)
val _GLX_X_VISUAL_TYPE : GetConf.req_attribute * (GLX._a -> x_visual_type option)
val _GLX_CONFIG_CAVEAT : GetConf.req_attribute * (GLX._a -> config_caveat list)
val _GLX_TRANSPARENT_TYPE : GetConf.req_attribute * (GLX._a -> transparent_type)
val _GLX_TRANSPARENT_INDEX_VALUE : GetConf.req_attribute * (GLX._a -> int)
val _GLX_TRANSPARENT_RED_VALUE : GetConf.req_attribute * (GLX._a -> int)
val _GLX_TRANSPARENT_GREEN_VALUE : GetConf.req_attribute * (GLX._a -> int)
val _GLX_TRANSPARENT_BLUE_VALUE : GetConf.req_attribute * (GLX._a -> int)
val _GLX_TRANSPARENT_ALPHA_VALUE : GetConf.req_attribute * (GLX._a -> int)
val _GLX_MAX_PBUFFER_WIDTH : GetConf.req_attribute * (GLX._a -> uint)
val _GLX_MAX_PBUFFER_HEIGHT : GetConf.req_attribute * (GLX._a -> uint)
val _GLX_MAX_PBUFFER_PIXELS : GetConf.req_attribute * (GLX._a -> uint)
val _GLX_BIND_TO_TEXTURE_TARGETS_EXT : GetConfEXT.req_attribute * (GLX._a -> bind_to_tex_target list)
val _GLX_BIND_TO_TEXTURE_RGBA_EXT : GetConfEXT.req_attribute * (GLX._a -> bool)
val _GLX_BIND_TO_TEXTURE_RGB_EXT : GetConfEXT.req_attribute * (GLX._a -> bool)
val _GLX_Y_INVERTED_EXT : GetConfEXT.req_attribute * (GLX._a -> bool)
val glXGetFBConfigAttrib : dpy:Xlib.display ->
config:glXFBConfig -> attrib:GetConf.req_attribute -> GLX._a
val glXGetFBConfigAttribEXT : dpy:Xlib.display ->
config:glXFBConfig -> attrib:GetConfEXT.req_attribute -> GLX._a
val glXGetFBConfigAttrib : dpy:Xlib.display ->
config:glXFBConfig ->
attrib:GetConf.req_attribute * (GLX._a -> 'a) -> 'a

as this function may return different types, instead of using for example GLX_DRAWABLE_TYPE, just use _GLX_DRAWABLE_TYPE
val glXGetFBConfigAttribEXT : dpy:Xlib.display ->
config:glXFBConfig ->
attrib:GetConfEXT.req_attribute * (GLX._a -> 'a) -> 'a

same than glXGetFBConfigAttrib but with additions from the GLX_EXT_texture_from_pixmap extension

should be transfered to GLX_P2T

Debug


type glXFBConfig2 
val glXGetFBConfigs2 : dpy:Xlib.display -> Xlib.screen_number -> glXFBConfig2 array

type attribute_and_value =
| D_GLX_DRAWABLE_TYPE of drawable_type
| D_GLX_BIND_TO_TEXTURE_TARGETS_EXT of bind_to_tex_target
| D_GLX_BIND_TO_TEXTURE_RGBA_EXT of bool
| D_GLX_BIND_TO_TEXTURE_RGB_EXT of bool
| D_GLX_Y_INVERTED_EXT of bool
val glXHasFBConfigAttrib : dpy:Xlib.display -> glXFBConfig2 -> attribute_and_value -> bool
val choosePixmapFBConfig : dpy:Xlib.display -> glXFBConfig * float * float