gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz/gfx/librenderables renderables.py


From: Matti Katila
Subject: [Gzz-commits] gzz/gfx/librenderables renderables.py
Date: Tue, 15 Oct 2002 11:17:11 -0400

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Matti Katila <address@hidden>   02/10/15 11:17:11

Modified files:
        gfx/librenderables: renderables.py 

Log message:
        with great help of jvk finally paperquad works fluently on OpenGL 1.1

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/renderables.py.diff?tr1=1.104&tr2=1.105&r1=text&r2=text

Patches:
Index: gzz/gfx/librenderables/renderables.py
diff -c gzz/gfx/librenderables/renderables.py:1.104 
gzz/gfx/librenderables/renderables.py:1.105
*** gzz/gfx/librenderables/renderables.py:1.104 Mon Oct 14 06:01:44 2002
--- gzz/gfx/librenderables/renderables.py       Tue Oct 15 11:17:10 2002
***************
*** 348,354 ****
              lightParam.Light_w = 0.0;
  
            DBG(dbg_paperquad) << "Paperquad: " <<
!                   lightParam.orig << " " <<
                    lightParam.e0 << " " <<
                    lightParam.e1 << " " <<
                    lightParam.e2 << " " <<
--- 348,354 ----
              lightParam.Light_w = 0.0;
  
            DBG(dbg_paperquad) << "Paperquad: " <<
!                   lightParam.orig << " " <<
                    lightParam.e0 << " " <<
                    lightParam.e1 << " " <<
                    lightParam.e2 << " " <<
***************
*** 410,416 ****
  
            for(Paper::Paper::iterator it = paper->begin(); it != paper->end(); 
++it) {
  
!                 if (flags & VERTEX_PROGRAM) {
                      DBG(dbg_paperquad) << "Pass\\n";
                      GLERR
                      (*it).setUp_VP(&lightParam);
--- 410,416 ----
  
            for(Paper::Paper::iterator it = paper->begin(); it != paper->end(); 
++it) {
  
!                 if (flags & PAPERQUAD_USE_VERTEX_PROGRAM) {
                      DBG(dbg_paperquad) << "Pass\\n";
                      GLERR
                      (*it).setUp_VP(&lightParam);
***************
*** 425,443 ****
                  
                      GLERR
                      DBG(dbg_paperquad) << "Pass over\\n";
                  } else {
                      DBG(dbg_paperquad) << "Pass\\n";
                      GLERR
                      (*it).setUp_explicit(&lightParam);
                      
!                     DBG(dbg_paperquad) << "Going to draw elements\\n";
                      GLERR
!                     for(int i=0; i<dice-1; i++) {
!                        if (*(counts+i)>0)
!                           glDrawElements(GL_QUAD_STRIP, *(counts+i),
!                              GL_UNSIGNED_INT, (const GLvoid *) *(indps+i));
                      }
  
                      DBG(dbg_paperquad) << "Teardown\\n";
                      GLERR
                      (*it).tearDown_explicit();
--- 425,456 ----
                  
                      GLERR
                      DBG(dbg_paperquad) << "Pass over\\n";
+ 
                  } else {
                      DBG(dbg_paperquad) << "Pass\\n";
                      GLERR
                      (*it).setUp_explicit(&lightParam);
                      
!                     DBG(dbg_paperquad) << "Going to set texcoords 
explicit\\n";
                      GLERR
! 
! 
!                     for(int ix = 0; ix<dice-1; ix++) {
!                         glBegin(GL_QUAD_STRIP);
!                         for(int iy = 0; iy<dice; iy++) {
! 
!                              float tmp[4] = { vertices[ix][iy][0], 
vertices[ix][iy][1], 0 ,1 };
!                              (*it).texcoords_explicit( tmp );
!                              glVertex3fv( (vertices[ix][iy]+2) );
!                                 
!                              float tmp2[4] = { vertices[ix+1][iy][0], 
vertices[ix+1][iy][1], 0 ,1 };
!                              (*it).texcoords_explicit( tmp2 );
!                              glVertex3fv( (vertices[ix+1][iy]+2) );
!                          }
!                          glEnd();
                      }
  
+ 
                      DBG(dbg_paperquad) << "Teardown\\n";
                      GLERR
                      (*it).tearDown_explicit();
***************
*** 594,600 ****
  
            for(Paper::Paper::iterator it = paper->begin(); it != paper->end(); 
++it) {
  
!                 if (flags & VERTEX_PROGRAM) {
                    DBG(dbg_paperquad) << "Pass\\n";
                      (*it).setUp_VP(&lightParam);
  
--- 607,613 ----
  
            for(Paper::Paper::iterator it = paper->begin(); it != paper->end(); 
++it) {
  
!                 if (flags & PAPERQUAD_USE_VERTEX_PROGRAM) {
                    DBG(dbg_paperquad) << "Pass\\n";
                      (*it).setUp_VP(&lightParam);
  
***************
*** 609,628 ****
                      DBG(dbg_paperquad) << "Pass over\\n";
                  } else {
                    DBG(dbg_paperquad) << "Pass\\n";
-                     (*it).setUp_VP(&lightParam);
                      (*it).setUp_explicit(&lightParam);
-                 
  
                      DBG(dbg_paperquad) << "Going to draw elements\\n";
                      GLERR
  
!                     for(int i=0; i<dice-1; i++) {
!                         if (*(counts+i)>0)
!                            glDrawElements(GL_QUAD_STRIP, *(counts+i),
!                            GL_UNSIGNED_INT, (const GLvoid *) *(indps+i));
                      }
  
- 
                      DBG(dbg_paperquad) << "Teardown\\n";
                      GLERR
                      (*it).tearDown_explicit();
--- 622,647 ----
                      DBG(dbg_paperquad) << "Pass over\\n";
                  } else {
                    DBG(dbg_paperquad) << "Pass\\n";
                      (*it).setUp_explicit(&lightParam);
  
                      DBG(dbg_paperquad) << "Going to draw elements\\n";
                      GLERR
  
!                     for(int ix = 0; ix<dice-1; ix++) {
!                         glBegin(GL_QUAD_STRIP);
!                         for(int iy = 0; iy<dice; iy++) {
! 
!                              float tmp[4] = { vertices[ix][iy][0], 
vertices[ix][iy][1], 0 ,1 };
!                              (*it).texcoords_explicit( tmp );
!                              glVertex3fv( (vertices[ix][iy]+2) );
!                                 
!                              float tmp2[4] = { vertices[ix+1][iy][0], 
vertices[ix+1][iy][1], 0 ,1 };
!                              (*it).texcoords_explicit( tmp2 );
!                              glVertex3fv( (vertices[ix+1][iy]+2) );
!                          }
!                          glEnd();
                      }
  
                      DBG(dbg_paperquad) << "Teardown\\n";
                      GLERR
                      (*it).tearDown_explicit();
***************
*** 1245,1251 ****
  headercode += """
  namespace Renderables {
  
!    const int VERTEX_PROGRAM = 0x0001;
  
  """
  
--- 1264,1270 ----
  headercode += """
  namespace Renderables {
  
!    const int PAPERQUAD_USE_VERTEX_PROGRAM = 0x0001;
  
  """
  
***************
*** 1340,1392 ****
  
  public class GLRen extends GL {
  
!     public static final int VERTEX_PROGRAM = 0x0001;
  
  
      // ----  Shorthands.
      public static PaperQuad createPaperQuad(Paper paper, 
            float x0, float y0, float x1, float y1, float dicefactor) {
  
              int flags = 0;
!             if (GL.hasExtension("GL_NV_vertex_program1_1")) {
!                flags |= VERTEX_PROGRAM;
              } else {
!                flags &= ~VERTEX_PROGRAM;
              }
              
        return createPaperQuad(paper, x0, y0, x1, y1, 1, dicefactor, flags);
      }
      public static PaperQuad createPaperQuad(Paper paper, 
            float x0, float y0, float x1, float y1, float dicefactor, int 
flags) {
        return createPaperQuad(paper, x0, y0, x1, y1, 1, dicefactor, flags);
      }
  
      public static CulledPaperQuad createCulledPaperQuad(Paper paper, 
            float x0, float y0, float x1, float y1, float dicefactor) {
              
              int flags = 0;
  
!             if (GL.hasExtension("GL_NV_vertex_program1_1")) {
!                flags |= VERTEX_PROGRAM;
              } else {
!                flags &= ~VERTEX_PROGRAM;
              }
              
        return createCulledPaperQuad(paper, x0, y0, x1, y1, 1, dicefactor, 
flags);
      }
      public static CulledPaperQuad createCulledPaperQuad(Paper paper, 
            float x0, float y0, float x1, float y1, float dicefactor, int 
flags) {
        return createCulledPaperQuad(paper, x0, y0, x1, y1, 1, dicefactor, 
flags);
      }
  
      public static gzz.vob.Vob createCallList(String s) {
-         // XXX Convert to if (dbg)...
-         //System.err.println(\"callist: \" + s );
        return createCallList(createDisplayList(s));
      }
      public static gzz.vob.Vob createCallListCoorded(String s) {
-         // XXX Convert to if (dbg)...
-         //System.err.println(\"callist: \" + s );
        return createCallListCoorded(createDisplayList(s));
      }
  
--- 1359,1426 ----
  
  public class GLRen extends GL {
  
!     private static boolean need_init = true;
!     private static boolean have_VP_1_1;
! 
!     public static final int PAPERQUAD_USE_VERTEX_PROGRAM = 0x0001;
! 
!     public static void init() {
!         if (GL.hasExtension("GL_NV_vertex_program1_1")) {
!             have_VP_1_1 = true;
!         } else {
!             have_VP_1_1 = false;
!         }
!         need_init = false;
!     }
  
  
      // ----  Shorthands.
      public static PaperQuad createPaperQuad(Paper paper, 
            float x0, float y0, float x1, float y1, float dicefactor) {
  
+             if (need_init) init();
              int flags = 0;
! 
!             if (have_VP_1_1) {
!                flags |= PAPERQUAD_USE_VERTEX_PROGRAM;
              } else {
!                flags &= ~PAPERQUAD_USE_VERTEX_PROGRAM;
              }
              
        return createPaperQuad(paper, x0, y0, x1, y1, 1, dicefactor, flags);
      }
+ 
      public static PaperQuad createPaperQuad(Paper paper, 
            float x0, float y0, float x1, float y1, float dicefactor, int 
flags) {
        return createPaperQuad(paper, x0, y0, x1, y1, 1, dicefactor, flags);
      }
  
+ 
      public static CulledPaperQuad createCulledPaperQuad(Paper paper, 
            float x0, float y0, float x1, float y1, float dicefactor) {
              
+             if (need_init) init();
              int flags = 0;
  
!             if (have_VP_1_1) {
!                flags |= PAPERQUAD_USE_VERTEX_PROGRAM;
              } else {
!                flags &= ~PAPERQUAD_USE_VERTEX_PROGRAM;
              }
              
        return createCulledPaperQuad(paper, x0, y0, x1, y1, 1, dicefactor, 
flags);
      }
+ 
      public static CulledPaperQuad createCulledPaperQuad(Paper paper, 
            float x0, float y0, float x1, float y1, float dicefactor, int 
flags) {
        return createCulledPaperQuad(paper, x0, y0, x1, y1, 1, dicefactor, 
flags);
      }
  
+ 
      public static gzz.vob.Vob createCallList(String s) {
        return createCallList(createDisplayList(s));
      }
      public static gzz.vob.Vob createCallListCoorded(String s) {
        return createCallListCoorded(createDisplayList(s));
      }
  




reply via email to

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