gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] libvob include/vob/vobs/Texture.hxx org/nongnu/...


From: Tuomas J. Lukka
Subject: [Gzz-commits] libvob include/vob/vobs/Texture.hxx org/nongnu/...
Date: Sat, 28 Jun 2003 10:35:40 -0400

CVSROOT:        /cvsroot/libvob
Module name:    libvob
Branch:         
Changes by:     Tuomas J. Lukka <address@hidden>        03/06/28 10:35:40

Modified files:
        include/vob/vobs: Texture.hxx 
        org/nongnu/libvob/gl: GL.java 
        src/jni        : Main.cxx 
        vob/demo/multifil: fillet3d.py 
        vob/fillet     : light3d.py 

Log message:
        Try rect

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/vobs/Texture.hxx.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/gl/GL.java.diff?tr1=1.19&tr2=1.20&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/jni/Main.cxx.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/vob/demo/multifil/fillet3d.py.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/vob/fillet/light3d.py.diff?tr1=1.14&tr2=1.15&r1=text&r2=text

Patches:
Index: libvob/include/vob/vobs/Texture.hxx
diff -u libvob/include/vob/vobs/Texture.hxx:1.2 
libvob/include/vob/vobs/Texture.hxx:1.3
--- libvob/include/vob/vobs/Texture.hxx:1.2     Fri Jun 27 05:11:47 2003
+++ libvob/include/vob/vobs/Texture.hxx Sat Jun 28 10:35:39 2003
@@ -36,6 +36,7 @@
 #include <vob/VecGL.hxx>
 
 #include <sstream>
+#include <vob/glerr.hxx>
 
 
 #ifndef VOB_DEFINED
@@ -70,6 +71,7 @@
        glCopyTexSubImage2D(target, level, x, y, 
                    (int)ras[0], (int)ras[1] - h,
                w, h);
+       GLERR
     }
 
 };
Index: libvob/org/nongnu/libvob/gl/GL.java
diff -u libvob/org/nongnu/libvob/gl/GL.java:1.19 
libvob/org/nongnu/libvob/gl/GL.java:1.20
--- libvob/org/nongnu/libvob/gl/GL.java:1.19    Mon Jun 23 10:19:17 2003
+++ libvob/org/nongnu/libvob/gl/GL.java Sat Jun 28 10:35:39 2003
@@ -472,10 +472,10 @@
        /** Load a NULL pointer to the texture, which clears the image
         * and sets the mip maps.
         */
-       public void loadNull2D(int level, 
+       public void loadNull2D(String target, int level, 
                        String internalFormat, int w, int h, 
                        int border, String format, String type) {
-           impl_Texture_loadNull2D(getId(), 
+           impl_Texture_loadNull2D(getId(), target,
                        level, internalFormat, w, h, border, format, type);
        }
 
@@ -531,7 +531,8 @@
                String shaderName, String[] params, 
                boolean shade_all_levels);
 
-    static private native void impl_Texture_loadNull2D(int id, int level, 
+    static private native void impl_Texture_loadNull2D(int id, String target, 
+                       int level, 
                        String internalFormat, int w, int h, 
                        int border, String format, String type) ;
     static private native void impl_Texture_texImage2D(int id, int level, 
Index: libvob/src/jni/Main.cxx
diff -u libvob/src/jni/Main.cxx:1.17 libvob/src/jni/Main.cxx:1.18
--- libvob/src/jni/Main.cxx:1.17        Mon Jun 16 12:16:30 2003
+++ libvob/src/jni/Main.cxx     Sat Jun 28 10:35:39 2003
@@ -418,17 +418,19 @@
 }
 
 jf(void, impl_1Texture_1loadNull2D)
-  (JNIEnv *env, jclass, jint id, jint level, jstring internalFormat_s,
+  (JNIEnv *env, jclass, jint id, 
+     jstring target_s, jint level, jstring internalFormat_s,
     jint w, jint h, jint border, jstring format_s, jstring type_s) {
+    int target = tokenFromJstring(env, target_s);
     int internalFormat = tokenFromJstring(env, internalFormat_s);
     int format = tokenFromJstring(env, format_s);
     int type = tokenFromJstring(env, type_s);
 
-    glBindTexture(GL_TEXTURE_2D, id);
+    glBindTexture(target, id);
     // Null = just set size and texture format. 
-    glTexImage2D(GL_TEXTURE_2D,
+    glTexImage2D(target,
                level, internalFormat, w, h, border, format, type, NULL);
-    glBindTexture(GL_TEXTURE_2D, 0);
+    glBindTexture(target, 0);
     GLERR
   }
 
Index: libvob/vob/demo/multifil/fillet3d.py
diff -u libvob/vob/demo/multifil/fillet3d.py:1.9 
libvob/vob/demo/multifil/fillet3d.py:1.10
--- libvob/vob/demo/multifil/fillet3d.py:1.9    Sat Jun 28 09:42:37 2003
+++ libvob/vob/demo/multifil/fillet3d.py        Sat Jun 28 10:35:39 2003
@@ -35,19 +35,27 @@
     "3D filleting"
     def __init__(self):
        self.depthTexture = GL.createTexture()
-       self.depthTexture.loadNull2D(0, "DEPTH_COMPONENT24",
-                   1024, 1024, 0, "DEPTH_COMPONENT", 
-                   "BYTE")
-       self.depthTexture.setTexParameter("TEXTURE_2D",
-                   "TEXTURE_MAX_LEVEL", 0)
-       self.depthTexture.setTexParameter("TEXTURE_2D",
-                   "DEPTH_TEXTURE_MODE", "ALPHA")
-       self.depthTexture.setTexParameter("TEXTURE_2D",
-                   "TEXTURE_BASE_LEVEL", 0)
-       self.depthTexture.setTexParameter("TEXTURE_2D",
-                   "TEXTURE_MIN_FILTER", "NEAREST")
-       self.depthTexture.setTexParameter("TEXTURE_2D",
-                   "TEXTURE_MAG_FILTER", "NEAREST")
+       rect = 1
+       targ = "TEXTURE_RECTANGLE_NV"
+       self.depthTexture.loadNull2D("TEXTURE_RECTANGLE_NV", 0, 
"DEPTH_COMPONENT24",
+                   1024, 768, 0, "DEPTH_COMPONENT", 
+                   "INT")
+       if not rect:
+           self.depthTexture.setTexParameter(targ,
+                       "TEXTURE_MAX_LEVEL", 0)
+           self.depthTexture.setTexParameter(targ,
+                       "TEXTURE_BASE_LEVEL", 0)
+           self.depthTexture.setTexParameter(targ,
+                       "TEXTURE_MIN_FILTER", "LINEAR")
+           self.depthTexture.setTexParameter(targ,
+                       "TEXTURE_MAG_FILTER", "LINEAR")
+       else:
+           self.depthTexture.setTexParameter(targ,
+                       "TEXTURE_MIN_FILTER", "LINEAR")
+           self.depthTexture.setTexParameter(targ,
+                       "TEXTURE_MAG_FILTER", "LINEAR")
+       #self.depthTexture.setTexParameter(targ,
+       #           "DEPTH_TEXTURE_MODE", "ALPHA")
        self.key = KeyPresses(
             self, 
            SlideLin("x", 200, 20, "x", "Left", "Right"),
@@ -119,25 +127,27 @@
        vs.put(getDListNocoords("""
             BindProgram VERTEX_PROGRAM_ARB 0
             Disable VERTEX_PROGRAM_ARB
-           BindTexture TEXTURE_2D %s
-           Enable TEXTURE_2D
+           BindTexture TEXTURE_RECTANGLE_NV %s
+           Enable TEXTURE_RECTANGLE_NV
        """ % self.depthTexture.getTexId()))
 
-       # Now, draw the edges
-       vs.put(GLRen.createCopyTexSubImage2D("TEXTURE_2D",
-           0, 0, 0, 1024, 1024), 0)
+
+           # Now, draw the edges
+       vs.put(GLRen.createCopyTexSubImage2D("TEXTURE_RECTANGLE_NV",
+           0, 0, 0, 1024, 768), 0)
+
 
        vs.put(getDListNocoords("""
            Color 1 1 1
-            BindProgram FRAGMENT_PROGRAM_NV %s
-            Enable FRAGMENT_PROGRAM_NV
+           BindProgram FRAGMENT_PROGRAM_NV %s
+           Enable FRAGMENT_PROGRAM_NV
            Enable BLEND
        """ % light3d.edgefp.getProgId()))
 
-       vs.put(quad(), vs.orthoCS(0, "A", -100, 0, 0, 1024,1024))
+       vs.put(quad(), vs.orthoCS(0, "A", -100, 0, 0, 1024,768))
 
        vs.put(getDListNocoords("""
-           BindTexture TEXTURE_2D 0
+           BindTexture TEXTURE_RECTANGLE_NV 0
             Disable FRAGMENT_PROGRAM_NV
            PopAttrib
        """))
Index: libvob/vob/fillet/light3d.py
diff -u libvob/vob/fillet/light3d.py:1.14 libvob/vob/fillet/light3d.py:1.15
--- libvob/vob/fillet/light3d.py:1.14   Sat Jun 28 09:42:37 2003
+++ libvob/vob/fillet/light3d.py        Sat Jun 28 10:35:39 2003
@@ -60,21 +60,23 @@
 void main(
     float4 incol: COLOR0,
     float4 qpos : TEXCOORD0,
-    uniform sampler2D tex0,
+    float4 wpos : WPOS,
+    uniform samplerRECT tex0,
     out float4 col : COLOR) {
     // float2 tc = wpos.xy / 1024.0;
     // tc.y = tc.y + 1 - 768 / 1024.0;
-    float2 tc = qpos.xy;
-    tc.y = 1-tc.y;
+    // float2 tc = qpos.xy;
+    // tc.y = 1-tc.y;
     // tc.y = tc.y * 768 / 1024;
     // tc.y += (1-768/1024.0);
+    float2 tc = wpos.xy;
 
-    float d = tex2D(tex0, tc).w;
-    float d1 = tex2D(tex0, tc + float2(0,2/1024.0)).x;
-    float d2 = tex2D(tex0, tc + float2(0,-2/1024.0)).x;
-    float d3 = tex2D(tex0, tc + float2(2/1024.0,0)).x;
-    float d4 = tex2D(tex0, tc + float2(-2/1024.0,0)).x;
-
+    float d = texRECT(tex0, tc).x;
+//    float d1 = tex2D(tex0, tc + float2(0,2/1024.0)).x;
+//    float d2 = tex2D(tex0, tc + float2(0,-2/1024.0)).x;
+//    float d3 = tex2D(tex0, tc + float2(2/1024.0,0)).x;
+//    float d4 = tex2D(tex0, tc + float2(-2/1024.0,0)).x;
+/*
     float4 color;
     float lim = .001;
     float diff = (
@@ -93,8 +95,12 @@
     color.w = diff > 0 ? 1 : 0;
     color.w = 1;
 
-    color.xyz = (d-.53) * 100 + .5;
+*/
+    float4 color;
+    color.xyz = d;
+    color.xyz = (d-.53) * 40 + .5;
     // 10000 *abs(d1-d);
+    /*
     float f = max(
        abs(d1-d),
        max(
@@ -102,12 +108,13 @@
            max( 
                abs(d3-d),
                abs(d4-d))));
+*/
+    color.w = 1;
 
     col = color;
 }
     
-""", "arbfp1"))
-
+""", "fp30"))
 
 commonkeys = [
            SlideLin("angle", 1, .05, "tan(meet angle)", "+", "-"),




reply via email to

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