gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz/gzz/vob OvalBgVob.java


From: Asko Soukka
Subject: [Gzz-commits] gzz/gzz/vob OvalBgVob.java
Date: Mon, 21 Oct 2002 06:43:27 -0400

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Asko Soukka <address@hidden>    02/10/21 06:43:26

Modified files:
        gzz/vob        : OvalBgVob.java 

Log message:
        Uses now JVK:s circle.texture and mipmap's for constant size border.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/OvalBgVob.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text

Patches:
Index: gzz/gzz/vob/OvalBgVob.java
diff -u gzz/gzz/vob/OvalBgVob.java:1.3 gzz/gzz/vob/OvalBgVob.java:1.4
--- gzz/gzz/vob/OvalBgVob.java:1.3      Fri Oct 18 08:46:39 2002
+++ gzz/gzz/vob/OvalBgVob.java  Mon Oct 21 06:43:26 2002
@@ -1,4 +1,3 @@
-
 /*
 OvalBgVob.java
  *    
@@ -41,20 +40,20 @@
  */
 
 public class OvalBgVob extends Vob {
-public static final String rcsid = "$Id: OvalBgVob.java,v 1.3 2002/10/18 
12:46:39 humppake Exp $";
+public static final String rcsid = "$Id: OvalBgVob.java,v 1.4 2002/10/21 
10:43:26 humppake Exp $";
     public static boolean dbg = false;
     static final void p(String s) { if(dbg) System.out.println(s); }
     static final void pa(String s) { System.out.println(s); }
 
     static Rectangle rect = new Rectangle();
 
-    static private GL.Texture tex;
-    static private boolean texLoaded = false;
-    static private void loadTex() {
+    static protected GL.Texture tex;
+    static protected boolean texLoaded = false;
+    static protected void loadTex() {
        if (!texLoaded) {
-           String[] texparam = {"type", "8"};
+           String[] texparam = {"line_width", "2.0"};
            tex = GL.createTexture(); 
-           tex.shade(128, 128, 0, 1, "ALPHA", "ALPHA", "geometric", texparam);
+           tex.shade_all_levels(512, 512, 0, 4, "RGBA", "RGBA", "circle", 
texparam);
            texLoaded = true;
        }
     }
@@ -76,14 +75,6 @@
        int mx = rect.x, my=rect.y,
            mw = rect.width, mh = rect.height;
 
-       /** Origo and radius for circle.
-        * Irrelevant, when using drawOval ad fillOval.
-         Point co = new Point(mx+mw/2, my+h/2);
-         int cr;
-         if (mw < mh) cr = mw;
-         else cr = mh;
-       */
-
        Color oldfg = g.getColor();
 
        // Draw a rectangle in the background color, wiping out
@@ -96,6 +87,7 @@
            g.setColor(bg);
            g.fillOval(mx, my, mw, mh);
        } else {
+           // Draws multiple background colours as sectors
            int arc = 360 / nsolids;
            for(int i=0; i<nsolids; i++) {
                g.setColor(solids[i]);
@@ -119,10 +111,12 @@
                                int coordsys2) {
         if(dbg) pa("Addtolistgl rectbg "+coordsys1);
        if(glList == null) {
+           /** In OpenGL the oval shape is done by drawing
+            * a quad stript with an oval texture inside it.
+            */
            if (!texLoaded) loadTex();
            String bgcall = "";
            if(nsolids > 0) {
-               double arc = (2*Math.PI) / nsolids;
                double w = 1.0 / nsolids;
                for(int i=0; i<nsolids; i++) {
                    double x1 = i*w;
@@ -151,29 +145,18 @@
                    "TexCoord 0 0\nVertex 0 0\n"+
                    "End\n");
            }
-
+                   
            glList = GLRen.createCallListCoorded(
-                "PushAttrib ENABLE_BIT\n"+
+               "PushAttrib ENABLE_BIT\n"+
                "BindTexture TEXTURE_2D "+tex.getTexId()+"\n"+
-               "Enable TEXTURE_2D\n"+
-              
-               /** Draws border. */
-               "Color 0 0 0 1\n" +
-               "Begin QUAD_STRIP\n"+
-               /** XXX Border width probably should NOT be 
-                * relative to vob's size as below.
-                */ 
-               "TexCoord 1 1\nVertex 1.05 1.05\n"+
-               "TexCoord 1 0\nVertex 1.05 -0.05\n"+
-               "TexCoord 0 1\nVertex -0.05 1.05\n"+
-               "TexCoord 0 0\nVertex -0.05 -0.05\n"+
-               "End\n" +
-
-               /** Draws filled oval using circular texture. */
-               bgcall +
-
-                "PopAttrib\n"
-                   );
+               "TexParameter TEXTURE_2D TEXTURE_MIN_FILTER 
LINEAR_MIPMAP_NEAREST\n"+
+               "TexParameter TEXTURE_2D TEXTURE_MAG_FILTER LINEAR\n"+
+               "Enable BLEND\n"+
+               "BlendFunc SRC_ALPHA ONE_MINUS_SRC_ALPHA\n"+
+               "Enable TEXTURE_2D\n"+
+               bgcall +
+               "PopAttrib\n"
+               );
        }
        curs = glList.addToListGL(win, list, curs, coordsys1, coordsys2);
        return curs;
@@ -197,6 +180,10 @@
      */
     public Color[] getSolidColors() { return solids; }
 }
+
+
+
+
 
 
 




reply via email to

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