[ Previous | Next | Contents | Glossary | Home | Search ]
OpenGL 1.1 for AIX: Reference Manual

glXCreateContext Subroutine

Purpose

Creates a new GLX rendering context.

Library

OpenGL C bindings library: libGL.a

C Syntax

GLXContext glXCreateContext(Display *dpy
         XVisualInfo *Visual
         GLXContext ShareList
         Bool Direct)

Description

The glXCreateContext subroutine creates a GLX rendering context and returns its handle. This context can be used to render into both windows and GLX pixmaps. If the glXCreateContext subroutine fails to create a rendering context, Null is returned.

If Direct is set to True, a direct rendering context is created if the implementation supports direct rendering and the connection is to a local X server. If Direct is set to False, a rendering context that renders through the X server is created. Direct rendering provides a performance advantage in some implementations. However, direct rendering contexts cannot be shared outside a single process or used to render to GLX pixmaps.

If ShareList is not Null, all display-list indexes and definitions are shared by both the ShareList context and the newly created context. An arbitrary number of contexts can share a single display-list space. However, all rendering contexts that share a single display-list space must exist in the same address space. Two rendering contexts share an address space if both are nondirect and use the same server, or if both are direct and owned by a single process.

If both rendering contexts are nondirect, it is not necessary for the calling threads to share an address space; however, their related rendering contexts must share the address space.

Parameters

dpy Specifies the connection to the X server.
Visual Specifies the visual that defines the frame buffer resources available to the rendering context. It is a pointer to an XVisualInfo structure, not a visual ID or a pointer to a Visual structure.
ShareList Specifies the context with which to share display lists. Null indicates no sharing.
Direct A value of True specifies that rendering be done through a direct connection to the graphics system if possible; a value of False specifies rendering through the X server.

Notes

XVisualInfo is defined in the Xutil.h file. It is a structure that includes Visual, VisualID, Screen, and Depth elements.

A process is a single execution environment, implemented in a single address space, consisting of one or more threads.

A thread is one of a set of subprocesses that share a single address space, but maintain separate program counters, stack spaces, and other related global data. A thread is the only member of its subprocess group that is equivalent to a process.

Error Codes

Null Is returned if the glXCreateContext subroutine fails to create a rendering context on the client side.
BadAlloc Is generated if the server does not have enough resources to allocate the new context.
BadMatch Is generated if the context to be created cannot share the address space or the screen of the context specified by ShareList, or the specified visual is not available.
GLXBadContext Is generated if ShareList is not a GLX context and is not Null.
BadValue Is generated if the Visual parameter specifies an invalid visual (for example, if the GLX implementation does not support it).

Files

/usr/include/GL/gl.h Contains C language constants, variable type definitions, and ANSI function prototypes for OpenGL.

Related Information

The glXDestroyContext subroutine, glXGetConfig subroutine, glXIsDirect subroutine, glXMakeCurrent subroutine.

OpenGL in the AIXwindows (GLX) Environment.

OpenGL Overview.


[ Previous | Next | Contents | Glossary | Home | Search ]