gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] gzz ./TODO gfx/anim/paper.py gfx/libos/Os-GLX.c...


From: Tuomas J. Lukka
Subject: [Gzz-commits] gzz ./TODO gfx/anim/paper.py gfx/libos/Os-GLX.c...
Date: Wed, 04 Dec 2002 10:29:15 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Tuomas J. Lukka <address@hidden>        02/12/04 10:29:15

Modified files:
        .              : TODO 
        gfx/anim       : paper.py 
        gfx/libos      : Os-GLX.cxx Os.hxx 
        gfx/progs      : fbconfsgix.cxx 

Log message:
        Work towards off-screen renderables

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/TODO.diff?tr1=1.436&tr2=1.437&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/anim/paper.py.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libos/Os-GLX.cxx.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libos/Os.hxx.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/progs/fbconfsgix.cxx.diff?tr1=1.1&tr2=1.2&r1=text&r2=text

Patches:
Index: gzz/TODO
diff -u gzz/TODO:1.436 gzz/TODO:1.437
--- gzz/TODO:1.436      Wed Dec  4 07:29:46 2002
+++ gzz/TODO    Wed Dec  4 10:29:14 2002
@@ -60,8 +60,7 @@
        -fix documentation script
     tjl:        
        - return ANKOS to Agora [ blocked by: waiting for trip to agora ]
-       - fix memleak in making movies
-           - memleak test format
+       - off-screen rendering
        - go through most important GL demos and redo the interfaces
        - fillet demo
            - fix last two screens
Index: gzz/gfx/anim/paper.py
diff -u gzz/gfx/anim/paper.py:1.5 gzz/gfx/anim/paper.py:1.6
--- gzz/gfx/anim/paper.py:1.5   Tue Dec  3 14:14:11 2002
+++ gzz/gfx/anim/paper.py       Wed Dec  4 10:29:14 2002
@@ -8,10 +8,16 @@
 
 frame = 0
 
+size = {
+    "w": 100,
+    "h": 100,
+}
+
 def _saveframe(w):
     global frame
     if frame > dry:
-        saveanim.saveframe("tmpfilm/paper%03i.jpg" % frame, w)
+        saveanim.saveframe("tmpfilm/paper%03i.jpg" % frame, w,
+           **size)
     print "Frame", frame
     frame += 1
     java.lang.System.gc()
Index: gzz/gfx/libos/Os-GLX.cxx
diff -u gzz/gfx/libos/Os-GLX.cxx:1.12 gzz/gfx/libos/Os-GLX.cxx:1.13
--- gzz/gfx/libos/Os-GLX.cxx:1.12       Mon Sep 23 14:08:46 2002
+++ gzz/gfx/libos/Os-GLX.cxx    Wed Dec  4 10:29:14 2002
@@ -58,14 +58,30 @@
 
     DBGVAR(dbg, "GLX.general");
 
+    /** Attributes for db visual.
+     */
     static int doubleBufferAttributes[] = {
-       GLX_RGBA,
-       GLX_DOUBLEBUFFER,
+       GLX_RENDER_TYPE, GLX_RGBA_BIT,
+       GLX_DOUBLEBUFFER, 1,
        GLX_RED_SIZE, 1,
        GLX_GREEN_SIZE, 1,
        GLX_BLUE_SIZE, 1,
        GLX_DEPTH_SIZE, 1, 
        GLX_STENCIL_SIZE, 1, 
+       GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
+       None
+    };
+
+    /** Attributes for db visual.
+     */
+    static int pbufferAttributes[] = {
+       GLX_RENDER_TYPE, GLX_RGBA_BIT,
+       GLX_RED_SIZE, 1,
+       GLX_GREEN_SIZE, 1,
+       GLX_BLUE_SIZE, 1,
+       GLX_DEPTH_SIZE, 1, 
+       GLX_STENCIL_SIZE, 0, 
+       GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT,
        None
     };
 
@@ -113,12 +129,23 @@
        }
     };
 
+    int g(Display *dpy, GLXFBConfig conf, int arg) {
+       int par;
+       if(glXGetFBConfigAttrib(dpy,conf,arg,&par)!=Success) 
+           { printf("ERROR for %d\n", arg);
+               throw Problem();
+           }
+       return par;
+    }
+
     struct LXWindowSystem : public Os::WindowSystem {
        Display              *dpy;
        XSetWindowAttributes swa;
        int swaMask;
        int numReturned;
-       XVisualInfo *vinfo;
+
+       GLXFBConfig *vinfo;
+       XVisualInfo *dbVinfo;
 
        vector<Timeout> timeouts;
 
@@ -132,16 +159,22 @@
            if(!(dpy = XOpenDisplay( NULL ))) BARF("Can't start X");
 
 
-           vinfo = glXChooseVisual(dpy, DefaultScreen(dpy), 
doubleBufferAttributes);
+           int nel;
+           vinfo = glXChooseFBConfig(dpy, DefaultScreen(dpy), 
+                       doubleBufferAttributes, &nel);
+
            if(!vinfo) BARF("Can't get dblbuf visual");
 
-           context = glXCreateContext(dpy, vinfo, 0, GL_TRUE);
+           context = glXCreateNewContext(dpy, vinfo[0], GLX_RGBA_TYPE, 
+                           0, GL_TRUE);
 
 
+           dbVinfo = glXGetVisualFromFBConfig(dpy, vinfo[0]);
            swa.border_pixel = 0;
 
            swa.colormap = XCreateColormap(dpy, DefaultRootWindow(dpy), 
-                           vinfo->visual, AllocNone);
+                           dbVinfo->visual,
+                           AllocNone);
 
            swa.background_pixmap = None;
            swa.background_pixel = 0;
@@ -167,6 +200,9 @@
 
 
        Os::Window *openWindow(int x, int y, int w, int h);
+       Os::RenderingSurface *openStableOffScreen(int w, int h) { 
+           return 0;
+       }
 
        Image *loadImageFile(const char *filename) {
            ImageRaster r = loadImage(filename);
@@ -194,6 +230,11 @@
     };
 
     // static char eventStringBuf[256];
+    //
+    struct LXPBuffer : public Os::RenderingSurface {
+       LXWindowSystem *ws;
+       GLXPbuffer pbuf;
+    };
 
     struct LXWindow : public Os::Window {
        LXWindowSystem *ws;
@@ -209,14 +250,14 @@
 
        LXWindow(LXWindowSystem *ws, int x, int y, int w, int h) : ws(ws), 
                    needRepaint(true), eventhandler(0) {
-           DBG(dbg) << "Create win: "<<ws->vinfo->depth<<" 
"<<ws->vinfo->visual << " ";
-           DBG(dbg) << ws->vinfo->visualid <<"\n";
+           DBG(dbg) << "Create win: "<<ws->dbVinfo->depth<<" 
"<<ws->dbVinfo->visual << " ";
+           DBG(dbg) << ws->dbVinfo->visualid <<"\n";
            DBG(dbg) << "Coords: "<<x<<" "<<y<<" "<<w<<" "<<h<<"\n";
            xw = XCreateWindow( ws->dpy, 
-                       RootWindow(ws->dpy, ws->vinfo->screen),
+                       RootWindow(ws->dpy, ws->dbVinfo->screen),
                        x, y, w, h,
-                       0, ws->vinfo->depth, InputOutput, 
-                       ws->vinfo->visual, 
+                       0, ws->dbVinfo->depth, InputOutput, 
+                       ws->dbVinfo->visual, 
                        ws->swaMask, &ws->swa
                    );
            DBG(dbg) << "Got window "<<xw<<"\n";
Index: gzz/gfx/libos/Os.hxx
diff -u gzz/gfx/libos/Os.hxx:1.12 gzz/gfx/libos/Os.hxx:1.13
--- gzz/gfx/libos/Os.hxx:1.12   Wed Dec  4 04:27:59 2002
+++ gzz/gfx/libos/Os.hxx        Wed Dec  4 10:29:14 2002
@@ -83,7 +83,6 @@
        virtual bool setCurrent() = 0;
        virtual bool releaseCurrent() = 0;
 
-       virtual void resize(int w, int h) = 0;
        virtual void getSize(int *xywh) = 0;
     };
 
@@ -109,6 +108,7 @@
 
        virtual void swapBuffers() = 0;
 
+       virtual void resize(int w, int h) = 0;
        virtual void move(int x, int y) = 0;
 
        /** Call EventHandler->timeout at least X milliseconds 
@@ -136,6 +136,9 @@
        virtual ~WindowSystem() {}
 
        virtual Window *openWindow(int x, int y, int w, int h) = 0;
+       /** Open a reliable off-screen rendering surface.
+        */
+       virtual RenderingSurface *openStableOffScreen(int w, int h) = 0;
        virtual Image *loadImageFile(const char *filename) = 0;
        virtual Image *loadImageData(const char *imageData, int len) = 0;
        virtual Text::Font *loadFont(const char *javaName, 
Index: gzz/gfx/progs/fbconfsgix.cxx
diff -u gzz/gfx/progs/fbconfsgix.cxx:1.1 gzz/gfx/progs/fbconfsgix.cxx:1.2
--- gzz/gfx/progs/fbconfsgix.cxx:1.1    Wed Dec  4 08:25:05 2002
+++ gzz/gfx/progs/fbconfsgix.cxx        Wed Dec  4 10:29:14 2002
@@ -1,13 +1,43 @@
 #include </doc/nvidia-glx-dev/include/GL/glx.h>
 #include <stdio.h>
 
+int attrs[] = {
+    GLX_DRAWABLE_TYPE, GLX_PIXMAP_BIT,
+    0
+};
+
+Display *dpy;
+
+int g(GLXFBConfig conf, int arg) {
+    int par;
+    if(glXGetFBConfigAttrib(dpy,conf,arg,&par)!=Success) 
+       { printf("ERROR for %d\n", arg);}
+    return par;
+}
+
 int main() {
-    Display *dpy = XOpenDisplay(0);
+    dpy = XOpenDisplay(0);
     int nel;
-    GLXFBConfigSGIX *conf = glXChooseFBConfigSGIX(dpy, 0, 0, &nel);
+    // GLXFBConfig *conf = glXChooseFBConfig(dpy, 0, attrs, &nel);
+    GLXFBConfig *conf = glXGetFBConfigs(dpy, 0, &nel);
     for(int i=0; i<nel; i++) {
-       int par[100];
-#define G(a,b,c,d) if(glXGetFBConfigAttribSGIX(a,b,c,d)!=Success) { 
printf("ERROR for %d\n", c);}
+       int par;
+#define G(n) g(conf[i], GLX_##n)
+       printf("%d Cav %d (%d %d %d %d : %d %d %d) - dou %d r(%d %d)\n",
+           G(X_VISUAL_TYPE),
+           G(VISUAL_CAVEAT_EXT),
+           G(RED_SIZE),
+           G(GREEN_SIZE),
+           G(BLUE_SIZE),
+           G(ALPHA_SIZE),
+           G(DEPTH_SIZE),
+           G(STENCIL_SIZE),
+           G(BUFFER_SIZE),
+           G(DOUBLEBUFFER),
+           G(RENDER_TYPE),
+           G(DRAWABLE_TYPE)
+             );
+       /*
        G(dpy, conf[i], GLX_VISUAL_CAVEAT_EXT, par+0);
        G(dpy, conf[i], GLX_RED_SIZE, par+1);
        G(dpy, conf[i], GLX_GREEN_SIZE, par+2);
@@ -15,15 +45,27 @@
        G(dpy, conf[i], GLX_ALPHA_SIZE, par+4);
        G(dpy, conf[i], GLX_DOUBLEBUFFER, par+5);
        G(dpy, conf[i], GLX_AUX_BUFFERS, par+6);
+       G(dpy, conf[i], GLX_MAX_PBUFFER_WIDTH, par+7);
+       G(dpy, conf[i], GLX_MAX_PBUFFER_HEIGHT, par+8);
+       G(dpy, conf[i], GLX_MAX_PBUFFER_PIXELS, par+9);
+       G(dpy, conf[i], GLX_RENDER_TYPE, par+10);
+       G(dpy, conf[i], GLX_DRAWABLE_TYPE, par+11);
        // printf("Vis %d rgba (%d %d %d %d) db %d aux %d samp %d %d dep %d 
sten %d accrgba(%d %d %d %d) vt %d\n",
-       printf("Vis %d rgba (%d %d %d %d) db %d aux %d\n",
+       printf("Vis %d rgba (%d %d %d %d) db %d aux %d pbuf(%dx%d, %d) typ(%d 
%d)\n",
                par[0],
                par[1],
                par[2],
                par[3],
                par[4],
                par[5],
-               par[6]);
+               par[6],
+               par[7],
+               par[8],
+               par[9],
+               par[10],
+               par[11]
+               );
+               */
     }
 
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]