[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]
OpenGL 1.2 for AIX: Reference Manual

glXCreateNewContext Subroutine

Purpose

Creates a new GLX rendering context.

Library

OpenGL C bindings library: libGL.a

C Syntax

GLXContext glXCreateNewContext(Display *dpy

                               GLXFBConfig config
                               int renderType
                               GLXContext ShareList
                               Bool Direct)

Description

The glXCreateNewContext subroutine creates a GLX rendering context and returns its handle. This context can be used to render into GLX windows, GLX pixmaps and GLX pbuffers. If the glXCreateNewContext 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 a direct rendering context cannot be created, then an attempt to create an indirect context instead.

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.
config Specifies the GLX FBConfig that defines the frame buffer resources available to the rendering context.
renderType Specifies the type of rendering that the context will support. One of the following values can be used:
GLX_RGBA_TYPE This is used if the context is to support RGBA rendering.
GLX_COLOR_INDEX_TYPE This is used if the context is to support color index rendering.
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

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 glXCreateNewContext 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 is not available.
BadValue Is generated if the renderType parameter specifies an invalid rendering type.
GLXBadContext Is generated if ShareList is not a GLX context and is not Null.
GLXBadFBConfig Is generated if config is not a valid GLX FBConfig.

Files

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

Related Information

glXDestroyContext subroutine, glXGetFBConfigAttrib subroutine, glXIsDirect subroutine, glXMakeContextCurrent subroutine.

OpenGL in the AIXwindows (GLX) Environment.

OpenGL Overview.


[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]