#include "glcontextmodes.h"
#include "glheader.h"
-static void ChangeDrawableAttribute( Display * dpy, GLXDrawable drawable,
- const CARD32 * attribs, size_t num_attribs );
-
-static void DestroyPbuffer( Display * dpy, GLXDrawable drawable );
-
-static GLXDrawable CreatePbuffer( Display *dpy,
- const __GLcontextModes * fbconfig, unsigned int width, unsigned int height,
- const int *attrib_list, GLboolean size_in_attribs );
-
-static int GetDrawableAttribute( Display *dpy, GLXDrawable drawable,
- int attribute, unsigned int *value );
-
/**
* Change a drawable's attribute.
{
__GLXdisplayPrivate *priv = __glXInitialize(dpy);
CARD32 * output;
-
+ CARD8 opcode;
if ( (dpy == NULL) || (drawable == 0) ) {
return;
}
+ opcode = __glXSetupForCommand(dpy);
+ if (!opcode)
+ return;
LockDisplay(dpy);
GetReqExtra( GLXChangeDrawableAttributes, 8 + (8 * num_attribs), req );
output = (CARD32 *) (req + 1);
- req->reqType = __glXSetupForCommand(dpy);
+ req->reqType = opcode;
req->glxCode = X_GLXChangeDrawableAttributes;
req->drawable = drawable;
req->numAttribs = (CARD32) num_attribs;
GetReqExtra( GLXVendorPrivateWithReply, 4 + (8 * num_attribs), vpreq );
output = (CARD32 *) (vpreq + 1);
- vpreq->reqType = __glXSetupForCommand(dpy);
+ vpreq->reqType = opcode;
vpreq->glxCode = X_GLXVendorPrivateWithReply;
vpreq->vendorCode = X_GLXvop_ChangeDrawableAttributesSGIX;
DestroyPbuffer( Display * dpy, GLXDrawable drawable )
{
__GLXdisplayPrivate *priv = __glXInitialize(dpy);
+ CARD8 opcode;
if ( (dpy == NULL) || (drawable == 0) ) {
return;
}
+ opcode = __glXSetupForCommand(dpy);
+ if (!opcode)
+ return;
LockDisplay(dpy);
if ( (priv->majorVersion > 1) || (priv->minorVersion >= 3) ) {
xGLXDestroyPbufferReq * req;
- GetReqExtra( GLXDestroyPbuffer, 4, req );
- req->reqType = __glXSetupForCommand(dpy);
+ GetReq( GLXDestroyPbuffer, req );
+ req->reqType = opcode;
req->glxCode = X_GLXDestroyPbuffer;
req->pbuffer = (GLXPbuffer) drawable;
}
data[0] = (CARD32) drawable;
- vpreq->reqType = __glXSetupForCommand(dpy);
+ vpreq->reqType = opcode;
vpreq->glxCode = X_GLXVendorPrivateWithReply;
vpreq->vendorCode = X_GLXvop_DestroyGLXPbufferSGIX;
}
__GLXdisplayPrivate *priv;
xGLXGetDrawableAttributesReply reply;
CARD32 * data;
+ CARD8 opcode;
unsigned int length;
unsigned int i;
unsigned int num_attributes;
*value = 0;
-
+ opcode = __glXSetupForCommand(dpy);
+ if (!opcode)
+ return 0;
+
LockDisplay(dpy);
if ( use_glx_1_3 ) {
xGLXGetDrawableAttributesReq *req;
GetReqExtra( GLXGetDrawableAttributes, 4, req );
- req->reqType = __glXSetupForCommand(dpy);
+ req->reqType = opcode;
req->glxCode = X_GLXGetDrawableAttributes;
req->drawable = drawable;
}
data = (CARD32 *) (vpreq + 1);
data[0] = (CARD32) drawable;
- vpreq->reqType = __glXSetupForCommand(dpy);
+ vpreq->reqType = opcode;
vpreq->glxCode = X_GLXVendorPrivateWithReply;
vpreq->vendorCode = X_GLXvop_GetDrawableAttributesSGIX;
}
xGLXCreateWindowReq * req;
CARD32 * data;
unsigned int i;
+ CARD8 opcode;
i = 0;
if (attrib_list) {
i++;
}
+ opcode = __glXSetupForCommand(dpy);
+ if (!opcode)
+ return None;
+
LockDisplay(dpy);
GetReqExtra( GLXCreateWindow, 8 * i, req );
data = (CARD32 *) (req + 1);
- req->reqType = __glXSetupForCommand(dpy);
+ req->reqType = opcode;
req->glxCode = glxCode;
req->screen = (CARD32) fbconfig->screen;
req->fbconfig = fbconfig->fbconfigID;
DestroyDrawable( Display * dpy, GLXDrawable drawable, CARD32 glxCode )
{
xGLXDestroyPbufferReq * req;
+ CARD8 opcode;
if ( (dpy == NULL) || (drawable == 0) ) {
return;
}
+ opcode = __glXSetupForCommand(dpy);
+ if (!opcode)
+ return;
+
LockDisplay(dpy);
GetReqExtra( GLXDestroyPbuffer, 4, req );
- req->reqType = __glXSetupForCommand(dpy);
+ req->reqType = opcode;
req->glxCode = glxCode;
req->pbuffer = (GLXPbuffer) drawable;
__GLXdisplayPrivate *priv = __glXInitialize(dpy);
GLXDrawable id = 0;
CARD32 * data;
+ CARD8 opcode;
unsigned int i;
i = 0;
i++;
}
+ opcode = __glXSetupForCommand(dpy);
+ if (!opcode)
+ return None;
+
LockDisplay(dpy);
id = XAllocID(dpy);
GetReqExtra( GLXCreatePbuffer, (8 * (i + extra)), req );
data = (CARD32 *) (req + 1);
- req->reqType = __glXSetupForCommand(dpy);
+ req->reqType = opcode;
req->glxCode = X_GLXCreatePbuffer;
req->screen = (CARD32) fbconfig->screen;
req->fbconfig = fbconfig->fbconfigID;
GetReqExtra( GLXVendorPrivate, 20 + (8 * i), vpreq );
data = (CARD32 *) (vpreq + 1);
- vpreq->reqType = __glXSetupForCommand(dpy);
+ vpreq->reqType = opcode;
vpreq->glxCode = X_GLXVendorPrivate;
vpreq->vendorCode = X_GLXvop_CreateGLXPbufferSGIX;
PUBLIC GLXPbuffer
glXCreatePbuffer(Display *dpy, GLXFBConfig config, const int *attrib_list)
{
+ int i, width, height;
+
+ width = 0;
+ height = 0;
+
+ for (i = 0; attrib_list[i * 2]; i++) {
+ switch (attrib_list[i * 2]) {
+ case GLX_PBUFFER_WIDTH:
+ width = attrib_list[i * 2 + 1];
+ break;
+ case GLX_PBUFFER_HEIGHT:
+ height = attrib_list[i * 2 + 1];
+ break;
+ }
+ }
+
return (GLXPbuffer) CreatePbuffer( dpy, (__GLcontextModes *) config,
- 0, 0,
+ width, height,
attrib_list, GL_TRUE );
}