basic API work for FBConfigs & Pbuffers
authorBrian Paul <brian.paul@tungstengraphics.com>
Sat, 6 Dec 2003 17:17:42 +0000 (17:17 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Sat, 6 Dec 2003 17:17:42 +0000 (17:17 +0000)
include/GL/miniglx.h
src/glx/mini/miniglx.c

index 7720d35..4416e58 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: miniglx.h,v 1.1 2003/08/23 01:25:30 jonsmirl Exp $ */
+/* $Id: miniglx.h,v 1.2 2003/12/06 17:17:42 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -92,6 +92,15 @@ typedef struct MiniGLXXVisualInfoRec {
 } XVisualInfo;
 
 /**
+ * \brief GLX Frame Buffer Configuration (for pbuffers)
+ * \sa \ref datatypes.
+ */
+typedef struct MiniGLXFBConfigRec {
+   XVisualInfo *visInfo;
+} GLXFBConfig;
+
+
+/**
  * \brief Display handle.
  *
  * Alias for the private ::MiniGLXDisplayRec structure.
@@ -133,6 +142,17 @@ typedef struct MiniGLXWindowRec   *Drawable;
 typedef struct MiniGLXWindowRec   *GLXDrawable;
 
 /**
+ * \brief GLX pbuffer.
+ *
+ * Alias for the private ::MiniGLXWindowRec structure.
+ * 
+ * Same as #Drawable.
+ *
+ * \sa \ref datatypes.
+ */
+typedef struct MiniGLXWindowRec   *GLXPbuffer;
+
+/**
  * \brief GLX context.
  * 
  * Alias for the private ::MiniGLXContext structure.
@@ -282,6 +302,8 @@ typedef union _XEvent {
 /*@{*/
 /** \brief Defined if version 1.0 of Mini GLX is supported. */
 #define MINI_GLX_VERSION_1_0    1
+/** \brief Defined if version 1.1 of Mini GLX is supported. */
+#define MINI_GLX_VERSION_1_1    1
 /*@}*/
 
 
@@ -355,7 +377,8 @@ extern void
 XFree( void *data );
 
 extern XVisualInfo *
-XGetVisualInfo( Display *display, long vinfo_mask, XVisualInfo *vinfo_template, int *nitems_return );
+XGetVisualInfo( Display *display, long vinfo_mask,
+                XVisualInfo *vinfo_template, int *nitems_return );
 /*@}*/
 
 
@@ -394,6 +417,21 @@ glXGetProcAddress( const GLubyte *procname );
 
 extern Bool
 glXQueryVersion( Display *dpy, int *major, int *minor );
+
+/* Added in MiniGLX 1.1 */
+extern GLXPbuffer
+glXCreatePbuffer( Display *dpy, GLXFBConfig config, const int *attribList );
+
+extern void
+glXDestroyPbuffer( Display *dpy, GLXPbuffer pbuf );
+
+extern GLXFBConfig *
+glXChooseFBConfig( Display *dpy, int screen, const int *attribList,
+                   int *nitems );
+
+extern XVisualInfo *
+glXGetVisualFromFBConfig( Display *dpy, GLXFBConfig config );
+
 /*@}*/
 
 
index 15563df..5cec09c 100644 (file)
@@ -31,7 +31,7 @@
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
-/* $Id: miniglx.c,v 1.2 2003/10/21 06:05:40 jonsmirl Exp $ */
+/* $Id: miniglx.c,v 1.3 2003/12/06 17:18:09 brianp Exp $ */
 
 /**
  * \mainpage Mini GLX
@@ -1935,6 +1935,10 @@ glXGetProcAddress( const GLubyte *procName )
       { "XFreeColormap", (void *) XFreeColormap },
       { "XFree", (void *) XFree },
       { "XGetVisualinfo", (void *) XGetVisualInfo },
+      { "glXCreatePbuffer", (void *) glXCreatePbuffer },
+      { "glXDestroyPbuffer", (void *) glXDestroyPbuffer },
+      { "glXChooseFBConfig", (void *) glXChooseFBConfig },
+      { "glXGetVisualFromFBConfig", (void *) glXGetVisualFromFBConfig },
       { NULL, NULL }
    };
    const struct name_address *entry;
@@ -1972,4 +1976,48 @@ glXQueryVersion( Display *dpy, int *major, int *minor )
 }
 
 
+/**
+ * \brief Create a new pbuffer.
+ */
+GLXPbuffer
+glXCreatePbuffer( Display *dpy, GLXFBConfig config, const int *attribList )
+{
+   return NULL;
+}
+
+
+void
+glXDestroyPbuffer( Display *dpy, GLXPbuffer pbuf )
+{
+   free(pbuf);
+}
+
+
+GLXFBConfig *
+glXChooseFBConfig( Display *dpy, int screen, const int *attribList,
+                   int *nitems )
+{
+   GLXFBConfig *f = (GLXFBConfig *) malloc(sizeof(GLXFBConfig));
+   f->visInfo = glXChooseVisual( dpy, screen, (int *) attribList );
+   if (f->visInfo) { 
+      *nitems = 1;
+      return f;
+   }
+   else {
+      *nitems = 0;
+      free(f);
+      return NULL;
+   }
+}
+
+
+XVisualInfo *
+glXGetVisualFromFBConfig( Display *dpy, GLXFBConfig config )
+{
+   /* XVisualInfo and GLXFBConfig are the same structure */
+   (void) dpy;
+   return config.visInfo;
+}
+
+
 /*@}*/