blob: 52dad65170fd3e8abb05b4c25ff97d5f435f1f6b [file] [log] [blame]
Adam Jacksoncb3610e2004-10-25 21:09:16 +00001/*
2 * (C) Copyright IBM Corporation 2004
3 * All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * on the rights to use, copy, modify, merge, publish, distribute, sub
9 * license, and/or sell copies of the Software, and to permit persons to whom
10 * the Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
14 * Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
19 * IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 */
24
25/**
26 * \file glx_pbuffer.c
27 * Implementation of pbuffer related functions.
28 *
29 * \author Ian Romanick <idr@us.ibm.com>
30 */
31
32#include <inttypes.h>
33#include "glxclient.h"
Brian Paul82dfd4b2005-08-11 14:18:53 +000034#include <X11/extensions/extutil.h>
35#include <X11/extensions/Xext.h>
Adam Jacksoncb3610e2004-10-25 21:09:16 +000036#include <assert.h>
37#include <string.h>
38#include "glapi.h"
39#include "glxextensions.h"
40#include "glcontextmodes.h"
Adam Jackson489ccef2004-12-15 17:18:06 +000041#include "glheader.h"
Adam Jacksoncb3610e2004-10-25 21:09:16 +000042
Adam Jacksoncb3610e2004-10-25 21:09:16 +000043
44/**
45 * Change a drawable's attribute.
46 *
47 * This function is used to implement \c glXSelectEvent and
48 * \c glXSelectEventSGIX.
49 *
50 * \note
51 * This function dynamically determines whether to use the SGIX_pbuffer
52 * version of the protocol or the GLX 1.3 version of the protocol.
53 *
54 * \todo
55 * This function needs to be modified to work with direct-rendering drivers.
56 */
57static void
58ChangeDrawableAttribute( Display * dpy, GLXDrawable drawable,
59 const CARD32 * attribs, size_t num_attribs )
60{
61 __GLXdisplayPrivate *priv = __glXInitialize(dpy);
62 CARD32 * output;
Kristian Høgsbergc25eb992006-06-13 01:41:18 +000063 CARD8 opcode;
Adam Jacksoncb3610e2004-10-25 21:09:16 +000064
65 if ( (dpy == NULL) || (drawable == 0) ) {
66 return;
67 }
68
Kristian Høgsbergc25eb992006-06-13 01:41:18 +000069 opcode = __glXSetupForCommand(dpy);
70 if (!opcode)
71 return;
Adam Jacksoncb3610e2004-10-25 21:09:16 +000072
73 LockDisplay(dpy);
74
75 if ( (priv->majorVersion > 1) || (priv->minorVersion >= 3) ) {
76 xGLXChangeDrawableAttributesReq *req;
77
78 GetReqExtra( GLXChangeDrawableAttributes, 8 + (8 * num_attribs), req );
79 output = (CARD32 *) (req + 1);
80
Kristian Høgsbergc25eb992006-06-13 01:41:18 +000081 req->reqType = opcode;
Adam Jacksoncb3610e2004-10-25 21:09:16 +000082 req->glxCode = X_GLXChangeDrawableAttributes;
83 req->drawable = drawable;
84 req->numAttribs = (CARD32) num_attribs;
85 }
86 else {
87 xGLXVendorPrivateWithReplyReq *vpreq;
88
89 GetReqExtra( GLXVendorPrivateWithReply, 4 + (8 * num_attribs), vpreq );
90 output = (CARD32 *) (vpreq + 1);
91
Kristian Høgsbergc25eb992006-06-13 01:41:18 +000092 vpreq->reqType = opcode;
Adam Jacksoncb3610e2004-10-25 21:09:16 +000093 vpreq->glxCode = X_GLXVendorPrivateWithReply;
94 vpreq->vendorCode = X_GLXvop_ChangeDrawableAttributesSGIX;
95
96 output[0] = (CARD32) drawable;
97 output++;
98 }
99
100 (void) memcpy( output, attribs, sizeof( CARD32 ) * 2 * num_attribs );
101
102 UnlockDisplay(dpy);
103 SyncHandle();
104
105 return;
106}
107
108
109/**
110 * Destroy a pbuffer.
111 *
112 * This function is used to implement \c glXDestroyPbuffer and
113 * \c glXDestroyGLXPbufferSGIX.
114 *
115 * \note
116 * This function dynamically determines whether to use the SGIX_pbuffer
117 * version of the protocol or the GLX 1.3 version of the protocol.
118 *
119 * \todo
120 * This function needs to be modified to work with direct-rendering drivers.
121 */
122static void
123DestroyPbuffer( Display * dpy, GLXDrawable drawable )
124{
125 __GLXdisplayPrivate *priv = __glXInitialize(dpy);
Kristian Høgsbergc25eb992006-06-13 01:41:18 +0000126 CARD8 opcode;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000127
128 if ( (dpy == NULL) || (drawable == 0) ) {
129 return;
130 }
131
Kristian Høgsbergc25eb992006-06-13 01:41:18 +0000132 opcode = __glXSetupForCommand(dpy);
133 if (!opcode)
134 return;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000135
136 LockDisplay(dpy);
137
138 if ( (priv->majorVersion > 1) || (priv->minorVersion >= 3) ) {
139 xGLXDestroyPbufferReq * req;
140
Brian7fcf2312007-05-17 15:25:26 -0600141 GetReq( GLXDestroyPbuffer, req );
Kristian Høgsbergc25eb992006-06-13 01:41:18 +0000142 req->reqType = opcode;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000143 req->glxCode = X_GLXDestroyPbuffer;
144 req->pbuffer = (GLXPbuffer) drawable;
145 }
146 else {
147 xGLXVendorPrivateWithReplyReq *vpreq;
148 CARD32 * data;
149
150 GetReqExtra( GLXVendorPrivateWithReply, 4, vpreq );
151 data = (CARD32 *) (vpreq + 1);
152
153 data[0] = (CARD32) drawable;
154
Kristian Høgsbergc25eb992006-06-13 01:41:18 +0000155 vpreq->reqType = opcode;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000156 vpreq->glxCode = X_GLXVendorPrivateWithReply;
157 vpreq->vendorCode = X_GLXvop_DestroyGLXPbufferSGIX;
158 }
159
160 UnlockDisplay(dpy);
161 SyncHandle();
162
163 return;
164}
165
166
167/**
168 * Get a drawable's attribute.
169 *
170 * This function is used to implement \c glXGetSelectedEvent and
171 * \c glXGetSelectedEventSGIX.
172 *
173 * \note
174 * This function dynamically determines whether to use the SGIX_pbuffer
175 * version of the protocol or the GLX 1.3 version of the protocol.
176 *
177 * \todo
178 * The number of attributes returned is likely to be small, probably less than
179 * 10. Given that, this routine should try to use an array on the stack to
180 * capture the reply rather than always calling Xmalloc.
181 *
182 * \todo
183 * This function needs to be modified to work with direct-rendering drivers.
184 */
185static int
186GetDrawableAttribute( Display *dpy, GLXDrawable drawable,
187 int attribute, unsigned int *value )
188{
Adam Jacksond25ad502006-04-07 00:05:50 +0000189 __GLXdisplayPrivate *priv;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000190 xGLXGetDrawableAttributesReply reply;
191 CARD32 * data;
Kristian Høgsbergc25eb992006-06-13 01:41:18 +0000192 CARD8 opcode;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000193 unsigned int length;
194 unsigned int i;
195 unsigned int num_attributes;
Adam Jacksond25ad502006-04-07 00:05:50 +0000196
197 if ( (dpy == NULL) || (drawable == 0) ) {
198 return 0;
199 }
200
201 priv = __glXInitialize(dpy);
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000202 GLboolean use_glx_1_3 = ((priv->majorVersion > 1)
203 || (priv->minorVersion >= 3));
204
Brian Paul42725d62006-02-07 00:39:56 +0000205 *value = 0;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000206
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000207
Kristian Høgsbergc25eb992006-06-13 01:41:18 +0000208 opcode = __glXSetupForCommand(dpy);
209 if (!opcode)
210 return 0;
211
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000212 LockDisplay(dpy);
213
214 if ( use_glx_1_3 ) {
215 xGLXGetDrawableAttributesReq *req;
216
217 GetReqExtra( GLXGetDrawableAttributes, 4, req );
Kristian Høgsbergc25eb992006-06-13 01:41:18 +0000218 req->reqType = opcode;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000219 req->glxCode = X_GLXGetDrawableAttributes;
220 req->drawable = drawable;
221 }
222 else {
223 xGLXVendorPrivateWithReplyReq *vpreq;
224
225 GetReqExtra( GLXVendorPrivateWithReply, 4, vpreq );
226 data = (CARD32 *) (vpreq + 1);
227 data[0] = (CARD32) drawable;
228
Kristian Høgsbergc25eb992006-06-13 01:41:18 +0000229 vpreq->reqType = opcode;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000230 vpreq->glxCode = X_GLXVendorPrivateWithReply;
231 vpreq->vendorCode = X_GLXvop_GetDrawableAttributesSGIX;
232 }
233
234 _XReply(dpy, (xReply*) &reply, 0, False);
235
Brian Paul42725d62006-02-07 00:39:56 +0000236 if (reply.type == X_Error)
237 {
238 UnlockDisplay(dpy);
239 SyncHandle();
240 return 0;
241 }
242
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000243 length = reply.length;
Brian Paul42725d62006-02-07 00:39:56 +0000244 if (length)
245 {
246 num_attributes = (use_glx_1_3) ? reply.numAttribs : length / 2;
247 data = (CARD32 *) Xmalloc( length * sizeof(CARD32) );
248 if ( data == NULL ) {
249 /* Throw data on the floor */
250 _XEatData(dpy, length);
251 } else {
252 _XRead(dpy, (char *)data, length * sizeof(CARD32) );
253
254 /* Search the set of returned attributes for the attribute requested by
255 * the caller.
256 */
257 for ( i = 0 ; i < num_attributes ; i++ ) {
258 if ( data[i*2] == attribute ) {
259 *value = data[ (i*2) + 1 ];
260 break;
261 }
262 }
263
264 Xfree( data );
265 }
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000266 }
267
268 UnlockDisplay(dpy);
269 SyncHandle();
270
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000271 return 0;
272}
273
274
275/**
276 * Create a non-pbuffer GLX drawable.
277 *
278 * \todo
279 * This function needs to be modified to work with direct-rendering drivers.
280 */
281static GLXDrawable
282CreateDrawable( Display *dpy, const __GLcontextModes * fbconfig,
283 Drawable drawable, const int *attrib_list,
284 CARD8 glxCode )
285{
286 xGLXCreateWindowReq * req;
287 CARD32 * data;
Ian Romanickb47731f2005-03-04 17:53:24 +0000288 unsigned int i;
David Reveman342d1de2006-04-11 12:07:41 +0000289 CARD8 opcode;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000290
Ian Romanickb47731f2005-03-04 17:53:24 +0000291 i = 0;
292 if (attrib_list) {
293 while (attrib_list[i * 2] != None)
294 i++;
295 }
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000296
Kristian Høgsbergc25eb992006-06-13 01:41:18 +0000297 opcode = __glXSetupForCommand(dpy);
298 if (!opcode)
299 return None;
David Reveman342d1de2006-04-11 12:07:41 +0000300
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000301 LockDisplay(dpy);
Ian Romanickb47731f2005-03-04 17:53:24 +0000302 GetReqExtra( GLXCreateWindow, 8 * i, req );
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000303 data = (CARD32 *) (req + 1);
304
David Reveman342d1de2006-04-11 12:07:41 +0000305 req->reqType = opcode;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000306 req->glxCode = glxCode;
307 req->screen = (CARD32) fbconfig->screen;
308 req->fbconfig = fbconfig->fbconfigID;
309 req->window = (GLXPbuffer) drawable;
Ian Romanickb47731f2005-03-04 17:53:24 +0000310 req->glxwindow = (GLXWindow) XAllocID(dpy);
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000311 req->numAttribs = (CARD32) i;
312
Ian Romanickb47731f2005-03-04 17:53:24 +0000313 memcpy( data, attrib_list, 8 * i );
314
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000315 UnlockDisplay(dpy);
316 SyncHandle();
317
Ian Romanickb47731f2005-03-04 17:53:24 +0000318 return (GLXDrawable)req->glxwindow;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000319}
320
321
322/**
323 * Destroy a non-pbuffer GLX drawable.
324 *
325 * \todo
326 * This function needs to be modified to work with direct-rendering drivers.
327 */
328static void
329DestroyDrawable( Display * dpy, GLXDrawable drawable, CARD32 glxCode )
330{
331 xGLXDestroyPbufferReq * req;
Kristian Høgsbergc25eb992006-06-13 01:41:18 +0000332 CARD8 opcode;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000333
334 if ( (dpy == NULL) || (drawable == 0) ) {
335 return;
336 }
337
338
Kristian Høgsbergc25eb992006-06-13 01:41:18 +0000339 opcode = __glXSetupForCommand(dpy);
340 if (!opcode)
341 return;
342
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000343 LockDisplay(dpy);
344
345 GetReqExtra( GLXDestroyPbuffer, 4, req );
Kristian Høgsbergc25eb992006-06-13 01:41:18 +0000346 req->reqType = opcode;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000347 req->glxCode = glxCode;
348 req->pbuffer = (GLXPbuffer) drawable;
349
350 UnlockDisplay(dpy);
351 SyncHandle();
352
353 return;
354}
355
356
357/**
358 * Create a pbuffer.
359 *
360 * This function is used to implement \c glXCreatePbuffer and
361 * \c glXCreateGLXPbufferSGIX.
362 *
363 * \note
364 * This function dynamically determines whether to use the SGIX_pbuffer
365 * version of the protocol or the GLX 1.3 version of the protocol.
366 *
367 * \todo
368 * This function needs to be modified to work with direct-rendering drivers.
369 */
370static GLXDrawable
371CreatePbuffer( Display *dpy, const __GLcontextModes * fbconfig,
372 unsigned int width, unsigned int height,
373 const int *attrib_list, GLboolean size_in_attribs )
374{
375 __GLXdisplayPrivate *priv = __glXInitialize(dpy);
376 GLXDrawable id = 0;
377 CARD32 * data;
Kristian Høgsbergc25eb992006-06-13 01:41:18 +0000378 CARD8 opcode;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000379 unsigned int i;
380
Ian Romanickb47731f2005-03-04 17:53:24 +0000381 i = 0;
382 if (attrib_list) {
383 while (attrib_list[i * 2])
384 i++;
385 }
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000386
Kristian Høgsbergc25eb992006-06-13 01:41:18 +0000387 opcode = __glXSetupForCommand(dpy);
388 if (!opcode)
389 return None;
390
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000391 LockDisplay(dpy);
392 id = XAllocID(dpy);
393
394 if ( (priv->majorVersion > 1) || (priv->minorVersion >= 3) ) {
395 xGLXCreatePbufferReq * req;
396 unsigned int extra = (size_in_attribs) ? 0 : 2;
397
398 GetReqExtra( GLXCreatePbuffer, (8 * (i + extra)), req );
399 data = (CARD32 *) (req + 1);
400
Kristian Høgsbergc25eb992006-06-13 01:41:18 +0000401 req->reqType = opcode;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000402 req->glxCode = X_GLXCreatePbuffer;
403 req->screen = (CARD32) fbconfig->screen;
404 req->fbconfig = fbconfig->fbconfigID;
405 req->pbuffer = (GLXPbuffer) id;
406 req->numAttribs = (CARD32) (i + extra);
407
408 if ( ! size_in_attribs ) {
409 data[(2 * i) + 0] = GLX_PBUFFER_WIDTH;
410 data[(2 * i) + 1] = width;
411 data[(2 * i) + 2] = GLX_PBUFFER_HEIGHT;
412 data[(2 * i) + 3] = height;
413 data += 4;
414 }
415 }
416 else {
417 xGLXVendorPrivateReq *vpreq;
418
419 GetReqExtra( GLXVendorPrivate, 20 + (8 * i), vpreq );
420 data = (CARD32 *) (vpreq + 1);
421
Kristian Høgsbergc25eb992006-06-13 01:41:18 +0000422 vpreq->reqType = opcode;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000423 vpreq->glxCode = X_GLXVendorPrivate;
424 vpreq->vendorCode = X_GLXvop_CreateGLXPbufferSGIX;
425
426 data[0] = (CARD32) fbconfig->screen;
427 data[1] = (CARD32) fbconfig->fbconfigID;
428 data[2] = (CARD32) id;
429 data[3] = (CARD32) width;
430 data[4] = (CARD32) height;
431 data += 5;
432 }
433
434 (void) memcpy( data, attrib_list, sizeof(CARD32) * 2 * i );
435
436 UnlockDisplay(dpy);
437 SyncHandle();
438
439 return id;
440}
441
442
443/**
444 * Create a new pbuffer.
445 */
Adam Jackson489ccef2004-12-15 17:18:06 +0000446PUBLIC GLXPbufferSGIX
Ian Romanickab7c6ff2005-07-26 22:53:38 +0000447glXCreateGLXPbufferSGIX(Display *dpy, GLXFBConfigSGIX config,
448 unsigned int width, unsigned int height,
449 int *attrib_list)
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000450{
451 return (GLXPbufferSGIX) CreatePbuffer( dpy, (__GLcontextModes *) config,
452 width, height,
453 attrib_list, GL_FALSE );
454}
455
456
457/**
458 * Create a new pbuffer.
459 */
Adam Jackson489ccef2004-12-15 17:18:06 +0000460PUBLIC GLXPbuffer
Ian Romanickab7c6ff2005-07-26 22:53:38 +0000461glXCreatePbuffer(Display *dpy, GLXFBConfig config, const int *attrib_list)
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000462{
Kristian Høgsberg8b204112007-08-27 14:16:30 -0400463 int i, width, height;
464
465 width = 0;
466 height = 0;
467
468 for (i = 0; attrib_list[i * 2]; i++) {
469 switch (attrib_list[i * 2]) {
470 case GLX_PBUFFER_WIDTH:
471 width = attrib_list[i * 2 + 1];
472 break;
473 case GLX_PBUFFER_HEIGHT:
474 height = attrib_list[i * 2 + 1];
475 break;
476 }
477 }
478
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000479 return (GLXPbuffer) CreatePbuffer( dpy, (__GLcontextModes *) config,
Kristian Høgsberg8b204112007-08-27 14:16:30 -0400480 width, height,
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000481 attrib_list, GL_TRUE );
482}
483
484
485/**
486 * Destroy an existing pbuffer.
487 */
Adam Jackson489ccef2004-12-15 17:18:06 +0000488PUBLIC void
Ian Romanickab7c6ff2005-07-26 22:53:38 +0000489glXDestroyPbuffer(Display *dpy, GLXPbuffer pbuf)
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000490{
491 DestroyPbuffer( dpy, pbuf );
492}
493
494
495/**
496 * Query an attribute of a drawable.
497 */
Adam Jackson489ccef2004-12-15 17:18:06 +0000498PUBLIC void
Ian Romanickab7c6ff2005-07-26 22:53:38 +0000499glXQueryDrawable(Display *dpy, GLXDrawable drawable,
500 int attribute, unsigned int *value)
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000501{
502 GetDrawableAttribute( dpy, drawable, attribute, value );
503}
504
505
506/**
507 * Query an attribute of a pbuffer.
508 */
Adam Jackson489ccef2004-12-15 17:18:06 +0000509PUBLIC int
Ian Romanickab7c6ff2005-07-26 22:53:38 +0000510glXQueryGLXPbufferSGIX(Display *dpy, GLXPbufferSGIX drawable,
511 int attribute, unsigned int *value)
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000512{
513 return GetDrawableAttribute( dpy, drawable, attribute, value );
514}
515
516
517/**
518 * Select the event mask for a drawable.
519 */
Adam Jackson489ccef2004-12-15 17:18:06 +0000520PUBLIC void
Ian Romanickab7c6ff2005-07-26 22:53:38 +0000521glXSelectEvent(Display *dpy, GLXDrawable drawable, unsigned long mask)
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000522{
523 CARD32 attribs[2];
524
525 attribs[0] = (CARD32) GLX_EVENT_MASK;
526 attribs[1] = (CARD32) mask;
527
528 ChangeDrawableAttribute( dpy, drawable, attribs, 1 );
529}
530
531
532/**
533 * Get the selected event mask for a drawable.
534 */
Adam Jackson489ccef2004-12-15 17:18:06 +0000535PUBLIC void
Ian Romanickab7c6ff2005-07-26 22:53:38 +0000536glXGetSelectedEvent(Display *dpy, GLXDrawable drawable, unsigned long *mask)
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000537{
538 unsigned int value;
539
540
541 /* The non-sense with value is required because on LP64 platforms
542 * sizeof(unsigned int) != sizeof(unsigned long). On little-endian
543 * we could just type-cast the pointer, but why?
544 */
545
546 GetDrawableAttribute( dpy, drawable, GLX_EVENT_MASK_SGIX, & value );
547 *mask = value;
548}
549
550
Adam Jackson489ccef2004-12-15 17:18:06 +0000551PUBLIC GLXPixmap
Ian Romanickab7c6ff2005-07-26 22:53:38 +0000552glXCreatePixmap( Display *dpy, GLXFBConfig config, Pixmap pixmap,
553 const int *attrib_list )
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000554{
555 return CreateDrawable( dpy, (__GLcontextModes *) config,
556 (Drawable) pixmap, attrib_list,
557 X_GLXCreatePixmap );
558}
559
560
Adam Jackson489ccef2004-12-15 17:18:06 +0000561PUBLIC GLXWindow
Ian Romanickab7c6ff2005-07-26 22:53:38 +0000562glXCreateWindow( Display *dpy, GLXFBConfig config, Window win,
563 const int *attrib_list )
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000564{
565 return CreateDrawable( dpy, (__GLcontextModes *) config,
566 (Drawable) win, attrib_list,
567 X_GLXCreateWindow );
568}
569
570
Adam Jackson489ccef2004-12-15 17:18:06 +0000571PUBLIC void
Ian Romanickab7c6ff2005-07-26 22:53:38 +0000572glXDestroyPixmap(Display *dpy, GLXPixmap pixmap)
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000573{
574 DestroyDrawable( dpy, (GLXDrawable) pixmap, X_GLXDestroyPixmap );
575}
576
577
Adam Jackson489ccef2004-12-15 17:18:06 +0000578PUBLIC void
Ian Romanickab7c6ff2005-07-26 22:53:38 +0000579glXDestroyWindow(Display *dpy, GLXWindow win)
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000580{
581 DestroyDrawable( dpy, (GLXDrawable) win, X_GLXDestroyWindow );
582}
583
584
Adam Jackson489ccef2004-12-15 17:18:06 +0000585PUBLIC GLX_ALIAS_VOID(glXDestroyGLXPbufferSGIX,
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000586 (Display *dpy, GLXPbufferSGIX pbuf),
587 (dpy, pbuf),
588 glXDestroyPbuffer)
589
Adam Jackson489ccef2004-12-15 17:18:06 +0000590PUBLIC GLX_ALIAS_VOID(glXSelectEventSGIX,
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000591 (Display *dpy, GLXDrawable drawable, unsigned long mask),
592 (dpy, drawable, mask),
593 glXSelectEvent)
594
Adam Jackson489ccef2004-12-15 17:18:06 +0000595PUBLIC GLX_ALIAS_VOID(glXGetSelectedEventSGIX,
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000596 (Display *dpy, GLXDrawable drawable, unsigned long *mask),
597 (dpy, drawable, mask),
598 glXGetSelectedEvent)