-/* $Id: fakeglx.c,v 1.60 2002/03/15 18:24:53 brianp Exp $ */
+/* $Id: fakeglx.c,v 1.66 2002/06/16 03:56:11 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 4.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
ximageFlag = GL_TRUE;
}
else {
- fprintf(stderr, "Mesa: invalid value for MESA_BACK_BUFFER ");
- fprintf(stderr, "environment variable, using an XImage.\n");
+ _mesa_warning(NULL, "Mesa: invalid value for MESA_BACK_BUFFER environment variable, using an XImage.");
}
}
}
/* Create a new visual and add it to the list. */
- if (NumVisuals>=MAX_VISUALS) {
- fprintf( stderr, "GLX Error: maximum number of visuals exceeded\n");
+ if (NumVisuals >= MAX_VISUALS) {
+ _mesa_problem(NULL, "GLX Error: maximum number of visuals exceeded");
return NULL;
}
}
}
else {
- fprintf(stderr,"Mesa: error in glXCreateContext: bad visual\n");
+ _mesa_warning(NULL, "Mesa: error in glXCreateContext: bad visual\n");
return NULL;
}
}
}
}
- fprintf( stderr, "Mesa: GLX unable to find visual class=%s, depth=%d.\n",
- type, depth );
+ {
+ char s[1000];
+ sprintf(s, "Mesa: GLX unable to find visual class=%s, depth=%d.\n",
+ type, depth );
+ _mesa_warning(NULL, s);
+ }
+
return NULL;
}
XMesaVisual glxvis;
struct fake_glx_context *glxCtx;
struct fake_glx_context *shareCtx = (struct fake_glx_context *) share_list;
+
+ if (!dpy || !visinfo)
+ return 0;
+
glxCtx = CALLOC_STRUCT(fake_glx_context);
if (!glxCtx)
return 0;
if (XMesaMakeCurrent2(xmctx, drawBuffer, readBuffer)) {
((__GLXcontext *) ctx)->currentDpy = dpy;
((__GLXcontext *) ctx)->currentDrawable = draw;
+#ifndef GLX_BUILT_IN_XMESA
((__GLXcontext *) ctx)->currentReadable = read;
-#ifdef GLX_BUILT_IN_XMESA
+#else
__glXSetCurrentContext(ctx);
#endif
return True;
XMesaDestroyBuffer(b);
}
else if (getenv("MESA_DEBUG")) {
- fprintf( stderr, "Mesa: glXDestroyGLXPixmap: invalid pixmap\n");
+ _mesa_warning(NULL, "Mesa: glXDestroyGLXPixmap: invalid pixmap\n");
}
}
Fake_glXCopyContext( Display *dpy, GLXContext src, GLXContext dst,
unsigned long mask )
{
- XMesaContext xm_src = (XMesaContext) src;
- XMesaContext xm_dst = (XMesaContext) dst;
+ struct fake_glx_context *fakeSrc = (struct fake_glx_context *) src;
+ struct fake_glx_context *fakeDst = (struct fake_glx_context *) dst;
+ XMesaContext xm_src = fakeSrc->xmesaContext;
+ XMesaContext xm_dst = fakeDst->xmesaContext;
(void) dpy;
_mesa_copy_context( xm_src->gl_ctx, xm_dst->gl_ctx, (GLuint) mask );
}
XMesaSwapBuffers(buffer);
}
else if (getenv("MESA_DEBUG")) {
- fprintf(stderr, "Mesa Warning: glXSwapBuffers: invalid drawable\n");
+ _mesa_warning(NULL, "Mesa: glXSwapBuffers: invalid drawable\n");
}
}
XMesaCopySubBuffer(buffer, x, y, width, height);
}
else if (getenv("MESA_DEBUG")) {
- fprintf(stderr, "Mesa Warning: glXCopySubBufferMESA: invalid drawable\n");
+ _mesa_warning(NULL, "Mesa: glXCopySubBufferMESA: invalid drawable\n");
}
}
return 0;
}
else {
- /*fprintf( stderr, "Mesa: Error in glXGetConfig: bad visual\n");*/
return GLX_BAD_VISUAL;
}
}
+/* PBUFFER */
static GLXFBConfig *
Fake_glXChooseFBConfig( Display *dpy, int screen,
const int *attribList, int *nitems )
}
+/* PBUFFER */
static int
Fake_glXGetFBConfigAttrib( Display *dpy, GLXFBConfig config,
int attribute, int *value )
*value = False; /* XXX ??? */
break;
case GLX_X_VISUAL_TYPE:
+#if defined(__cplusplus) || defined(c_plusplus)
+ switch (v->vishandle->c_class) {
+#else
switch (v->vishandle->class) {
+#endif
case GrayScale:
*value = GLX_GRAY_SCALE;
break;
}
+/* PBUFFER */
static GLXFBConfig *
Fake_glXGetFBConfigs( Display *dpy, int screen, int *nelements )
{
+ /* Get list of all X visuals, create FBconfigs from them */
(void) dpy;
(void) screen;
- (void) nelements;
+ nelements = 0;
return 0;
}
+/* PBUFFER */
static XVisualInfo *
Fake_glXGetVisualFromFBConfig( Display *dpy, GLXFBConfig config )
{
}
+/* PBUFFER */
static GLXWindow
Fake_glXCreateWindow( Display *dpy, GLXFBConfig config, Window win,
const int *attribList )
}
+/* PBUFFER */
static GLXPbuffer
Fake_glXCreatePbuffer( Display *dpy, GLXFBConfig config,
const int *attribList )
}
+/* PBUFFER */
static void
Fake_glXDestroyPbuffer( Display *dpy, GLXPbuffer pbuf )
{
}
+/* PBUFFER */
static void
Fake_glXQueryDrawable( Display *dpy, GLXDrawable draw, int attribute,
unsigned int *value )
}
+/* PBUFFER */
static int
Fake_glXQueryContext( Display *dpy, GLXContext ctx, int attribute, int *value )
{
}
+/* PBUFFER */
static void
Fake_glXSelectEvent( Display *dpy, GLXDrawable drawable, unsigned long mask )
{
}
+/* PBUFFER */
static void
Fake_glXGetSelectedEvent( Display *dpy, GLXDrawable drawable,
unsigned long *mask )
static Bool
Fake_glXMakeCurrentReadSGI(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx)
{
- (void) dpy;
- (void) draw;
- (void) read;
- (void) ctx;
- return False;
+ return Fake_glXMakeContextCurrent( dpy, draw, read, ctx );
}
/* not used