• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Name
2
3    ARB_get_proc_address
4
5Name Strings
6
7    GLX_ARB_get_proc_address
8
9Contact
10
11    Brian Paul (brian_paul 'at' mesa3d.org)
12    Jon Leech (ljp 'at' sgi.com)
13
14Notice
15
16    Copyright (c) 1999-2013 The Khronos Group Inc. Copyright terms at
17        http://www.khronos.org/registry/speccopyright.html
18
19Specification Update Policy
20
21    Khronos-approved extension specifications are updated in response to
22    issues and bugs prioritized by the Khronos OpenGL Working Group. For
23    extensions which have been promoted to a core Specification, fixes will
24    first appear in the latest version of that core Specification, and will
25    eventually be backported to the extension document. This policy is
26    described in more detail at
27        https://www.khronos.org/registry/OpenGL/docs/update_policy.php
28
29Status
30
31    Complete. Approved by ARB on 12/8/1999
32
33Version
34
35    Last Modified Date: January 3, 2000
36
37Number
38
39    ARB Extension #2
40
41Dependencies
42
43    The extension is written against the GLX 1.3 Specification.
44    May be implemented in any version of GLX and OpenGL.
45
46Overview
47
48    This extension adds a function to return the address of GLX
49    and GL extension functions, given the function name. This is
50    necessary with (for example) heterogenous implementations where
51    hardware drivers may implement extension functions not known to the
52    link library; a similar situation on Windows implementations
53    resulted in the wglGetProcAddress function.
54
55IP Status
56
57    No IP is believed to be involved (dynamic querying of library entry
58    points is supported in all modern operating systems).
59
60Issues
61
62    * Is this extension properly named?
63
64        Yes. If it does not achieve ARB approval, it will be implemented
65        as an EXT.
66
67    * Should a typedef be used for the return type?
68
69        typedef void (*GLfunction)();
70        extern GLfunction glXGetProcAddressARB(const GLubyte *procName);
71
72        Not needed - see the function declaration
73
74        void (*glXGetProcAddressARB(const GLubyte *procName))();
75
76    * Should GetProcAddressARB allow querying of itself?
77
78        Yes, for sake of completeness.
79
80    * There's a recursion problem with this feature. The purpose of
81      GetProcAddressARB is to return pointers to extension functions and
82      GetProcAddressARB is itself such a function! This presents a
83      puzzle to the application developer.
84
85        Implementations must export the glXGetProcAddressARB entry point
86        statically.
87
88    * Should extension functions in GLU and GLX be queryable through
89      this extension?
90
91        GLX: Yes. GLU: No. Because the pointers returned are
92        context-independent, the query was lifted from GL (in which all
93        behavior is necessarily context-dependent) into GLX, where
94        context management occurs. Since GLU is a client library using
95        GL, GLU extensions are unlikely to need to be dynamically
96        queryable. This capability could be added in a future extension.
97
98    * GLU library may not be loaded at runtime, making GLU queries fail
99
100        No longer relevant, since GLU functions cannot be queries now.
101        The previous resolution was:
102
103        True. However, the GL/GLX/GLU specifications say nothing about
104        "libraries" and link/runtime issues in any event, and the same
105        criticism might be applied to GL or GLX queries depending on how
106        the development and runtime tools on a particular platform
107        operate. Requiring a link against a "GLU library" in this case
108        should be in the release notes for a platform.
109
110    * Should corresponding functions exist in the window-system specific
111      layer on non-GLX implementations?
112
113        Yes. wglGetProcAddress already exists for Microsoft Windows, and
114        Apple has stated they will support aglGetProcAddress.
115        Unfortunately, there is an unavoidable inconsistency with
116        wglGetProcAddress, which returns context-dependent pointers.
117        This should be made abundantly clear in the documentation, so
118        that portable applications assume context-dependent behavior.
119
120    * Should the core functions added to GL and GLX since their 1.0
121      versions be queryable?
122
123        Yes. This will allow maximum portability of applications across
124        OpenGL 1.1 and 1.2 library implementations.
125
126    * Should the core functions in GL 1.0 and GLX 1.0 be queryable?
127
128        Yes. Adds consistency at the cost of a much larger lookup
129        mechanism.
130
131    * Are function pointers context-independent?
132
133        Yes. The pointer to an extension function can be used with any
134        context which supports the extension. Concern was expressed that
135        function dispatch for context-independent pointers would incur
136        overheads compared to context-dependent pointers.
137
138        The working group has proposed several implementation strategies
139        which would make this overhead negligible to nonexistent, and
140        the benefits of lifting the context/pointer management burden
141        from applications were considerable. The implementation
142        strategies are moderately complex and reach down all the way to
143        the toplevel dispatch mechanism used by drivers.
144
145    * Should the pointers returned be required to be equal to the
146      addresses of the corresponding static functions (if they exist?)
147
148        No. This may make implementation more difficult and is of little
149        apparent value to applications.
150
151    * Should the query return NULL for entry points not supported
152      by the implementation, or a pointer to a function which
153      generates an error?
154
155        NULL. There is no consistent way to generate errors
156        when either GL or GLX functions may be queried.
157
158New Procedures and Functions
159
160    void (*glXGetProcAddressARB(const GLubyte *procName))(...)
161
162New Tokens
163
164    None.
165
166Additions to Chapter 2 of the OpenGL 1.2.1 Specification (OpenGL Operation)
167
168    None
169
170Additions to Chapter 3 of the OpenGL 1.2.1 Specification (Rasterization)
171
172    None
173
174Additions to Chapter 4 of the OpenGL 1.2.1 Specification (Per-Fragment
175Operations and the Frame Buffer)
176
177    None
178
179Additions to Chapter 5 of the OpenGL 1.2.1 Specification (Special
180Functions)
181
182    None
183
184Additions to Chapter 6 of the OpenGL 1.2.1 Specification (State and State
185Requests)
186
187    None
188
189Additions to Appendix A of the OpenGL 1.2.1 Specification (Invariance)
190
191    None
192
193Additions to the GLX Specification
194
195    Add a new section numbered 3.3.12:
196
197    3.3.12 Obtaining Extension Function Pointers
198
199    The GL and GLX extensions which are available to a client
200    application may vary at runtime. Therefore, the address of extension
201    functions may be queried at runtime. The function
202
203        void (*glXGetProcAddressARB(const ubyte *procName)();
204
205    returns the address of the extension function named by procName. The
206    pointer returned should be cast to a function pointer type matching
207    the extension function's definition in that extension specification.
208    A return value of NULL indicates that the specified function does
209    not exist for the implementation.
210
211    A non-NULL return value for glXGetProcAddressARB does not guarantee
212    that an extension function is actually supported at runtime. The
213    client must must also query glGetString(GL_EXTENSIONS) or
214    glXQueryExtensionsString to determine if an extension is supported
215    by a particular context.
216
217    GL function pointers returned by glXGetProcAddressARB are
218    independent of the currently bound context and may be used by any
219    context which supports the extension.
220
221    glXGetProcAddressARB may be queried for all of the following functions:
222
223      - All GL and GLX extension functions supported by the
224        implementation (whether those extensions are supported by the
225        current context or not).
226
227      - All core (non-extension) functions in GL and GLX from version
228        1.0 up to and including the versions of those specifications
229        supported by the implementation, as determined by
230        glGetString(GL_VERSION) and glXQueryVersion queries.
231
232GLX Protocol
233
234    None
235
236Errors
237
238    None
239
240New State
241
242    None
243
244Conformance Testing
245
246    Rather than testing directly, the existing tkProcInit() mechanism in
247    the OpenGL 1.2 conformance tests will be modified to use
248    glXGetProcAddress when it's available, so that other ARB extensions
249    will fail conformance if the query does not work.
250
251    An alternative method which directly tests the query is to perform
252    an extremely simple rendering test (e.g. glClearColor/glClear) using
253    GL core function pointers returned by the query.
254
255Revision History
256
257    * Revision 1.1 (January 3, 2000) - Final ARB-approved version.
258      Specify that GL function pointers are context independent. Specify
259      that all core and extension GL and GLX functions may be queried.
260