gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz/gfx jni/GzzGL-jni.cxx libcallgl/callgl.cxx ...


From: Tuomas J. Lukka
Subject: [Gzz-commits] gzz/gfx jni/GzzGL-jni.cxx libcallgl/callgl.cxx ...
Date: Fri, 20 Sep 2002 06:27:03 -0400

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Tuomas J. Lukka <address@hidden>        02/09/20 06:27:03

Modified files:
        gfx/jni        : GzzGL-jni.cxx 
        gfx/libcallgl  : callgl.cxx callgl.hxx 
        gfx/librenderables: renderables.py 
Added files:
        gfx/demo/opengl: texform.py 

Log message:
        Test some texture sizes...

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/opengl/texform.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/jni/GzzGL-jni.cxx.diff?tr1=1.24&tr2=1.25&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libcallgl/callgl.cxx.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libcallgl/callgl.hxx.diff?tr1=1.16&tr2=1.17&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/renderables.py.diff?tr1=1.53&tr2=1.54&r1=text&r2=text

Patches:
Index: gzz/gfx/jni/GzzGL-jni.cxx
diff -c gzz/gfx/jni/GzzGL-jni.cxx:1.24 gzz/gfx/jni/GzzGL-jni.cxx:1.25
*** gzz/gfx/jni/GzzGL-jni.cxx:1.24      Wed Sep 18 08:19:08 2002
--- gzz/gfx/jni/GzzGL-jni.cxx   Fri Sep 20 06:27:03 2002
***************
*** 864,869 ****
--- 864,899 ----
        return result;
  }
  
+ JNIEXPORT jfloatArray JNICALL Java_gzz_gfx_gl_GZZGL_getGLTexParameterFloat
+   (JNIEnv *env, jclass, jstring target, jint tex, jstring name) {
+       const char *utf_target = env->GetStringUTFChars(target, 0);
+       const char *utf = env->GetStringUTFChars(name, 0);
+       vector<float> vec = CallGL::getTexParameterFloat(utf_target, tex, utf) ;
+       env->ReleaseStringUTFChars(name, utf);
+       env->ReleaseStringUTFChars(target, utf_target);
+       jfloatArray result = env->NewFloatArray(vec.size());
+       env->SetFloatArrayRegion(result, 0, vec.size(), &vec[0]);
+       return result;
+ }
+ 
+ JNIEXPORT jfloatArray JNICALL 
Java_gzz_gfx_gl_GZZGL_getGLTexLevelParameterFloat
+   (JNIEnv *env, jclass, jstring target, jint tex, jint level, jstring name) {
+       const char *utf_target = env->GetStringUTFChars(target, 0);
+       const char *utf = env->GetStringUTFChars(name, 0);
+       vector<float> vec = CallGL::getTexLevelParameterFloat(utf_target, tex, 
level, utf) ;
+       env->ReleaseStringUTFChars(name, utf);
+       env->ReleaseStringUTFChars(target, utf_target);
+       jfloatArray result = env->NewFloatArray(vec.size());
+       env->SetFloatArrayRegion(result, 0, vec.size(), &vec[0]);
+       return result;
+ }
+ 
+ JNIEXPORT jstring JNICALL Java_gzz_gfx_gl_GZZGL_getGLTokenString
+   (JNIEnv *env, jclass, jint value) {
+       const char *str = CallGL::getTokenString(value) ;
+       return env->NewStringUTF(str);
+ }
+ 
  GLuint buf[1600 * 1200];
  
  JNIEXPORT void JNICALL Java_gzz_gfx_gl_GZZGL_reallyClearStencilBuffer
Index: gzz/gfx/libcallgl/callgl.cxx
diff -c gzz/gfx/libcallgl/callgl.cxx:1.14 gzz/gfx/libcallgl/callgl.cxx:1.15
*** gzz/gfx/libcallgl/callgl.cxx:1.14   Tue Sep 17 11:11:07 2002
--- gzz/gfx/libcallgl/callgl.cxx        Fri Sep 20 06:27:03 2002
***************
*** 529,534 ****
--- 529,541 ----
        string s(str);
        return getToken(s);
      }
+     const char *getTokenString(GLenum value) {
+       for(int i=0; tokenarr[i].name != NULL; i++) {
+           if(tokenarr[i].value == value) 
+               return tokenarr[i].name;
+       }
+       return "unknown";
+     }
  
      double getTokenf(string tok) {
        const char *str = tok.c_str();
***************
*** 572,578 ****
          return (const char *)glGetString(getTokenValue(name)); 
      }
  
!     const vector<float> getFloat(const char *name) {
          static float vec0[100];
        static float vec1[100];
        static int init;
--- 579,585 ----
          return (const char *)glGetString(getTokenValue(name)); 
      }
  
!     template<class C>const vector<float> getFloat_impl(const char *name, C 
&c) {
          static float vec0[100];
        static float vec1[100];
        static int init;
***************
*** 593,600 ****
  
        int n = 0;
        vector<float> r;
!       glGetFloatv(e, vec0);
!       glGetFloatv(e, vec1);
  
        er = glGetError(); 
        if (er != GL_NO_ERROR) {
--- 600,607 ----
  
        int n = 0;
        vector<float> r;
!       c(e, vec0);
!       c(e, vec1);
  
        er = glGetError(); 
        if (er != GL_NO_ERROR) {
***************
*** 610,615 ****
--- 617,657 ----
        }
        
        return r;
+     }
+ 
+     const vector<float> getFloat(const char *name) {
+       return getFloat_impl(name, glGetFloatv);
+     }
+ 
+     struct X0 { GLuint target;
+       void operator()(GLenum e, float *vec) {
+           glGetTexParameterfv(target, e,vec);
+       }
+     } ;
+     const vector<float> getTexParameterFloat(const char *target, GLuint tex, 
const char *name) {
+       GLenum e = getTokenValue(target);
+       glBindTexture(e, tex);
+       X0 x;
+       x.target = e;
+       vector<float> res = getFloat_impl(name, x);
+       glBindTexture(e, 0);
+       return res;
+     }
+ 
+     struct X1 { GLuint target; GLuint level;
+       void operator()(GLenum e, float *vec) {
+           glGetTexLevelParameterfv(target, level, e, vec);
+       }
+     } ;
+     const vector<float> getTexLevelParameterFloat(const char *target, GLuint 
tex, GLuint level, const char *name) {
+       GLenum e = getTokenValue(target);
+       glBindTexture(e, tex);
+       X1 x;
+       x.target = e;
+       x.level = level;
+       vector<float> res = getFloat_impl(name, x);
+       glBindTexture(e, 0);
+       return res;
      }
  
  
Index: gzz/gfx/libcallgl/callgl.hxx
diff -c gzz/gfx/libcallgl/callgl.hxx:1.16 gzz/gfx/libcallgl/callgl.hxx:1.17
*** gzz/gfx/libcallgl/callgl.hxx:1.16   Tue Sep 17 11:11:07 2002
--- gzz/gfx/libcallgl/callgl.hxx        Fri Sep 20 06:27:03 2002
***************
*** 82,87 ****
--- 82,96 ----
       */
      GLenum getTokenValue(const char *string);
  
+     /** Get (if available) an OpenGL token name for the
+      * given value. Not all numbers have associated token
+      * values; the string "unknown" is returned in that case.
+      * The strings are static, and should not be modified
+      * by the user. This function is intended for producing
+      * human-readable strings from values returned by glGet.
+      */
+     const char *getTokenString(GLenum value);
+ 
      /** Get a string describing the current GL connection
       * @args name one of "VENDOR", "RENDERER", "VERSION", "EXTENSIONS"
       */
***************
*** 90,95 ****
--- 99,106 ----
      /** Get values of GL parameters 
       */
      const vector<float> getFloat(const char *pname);
+     const vector<float> getTexParameterFloat(const char *target, GLuint tex, 
const char *pname);
+     const vector<float> getTexLevelParameterFloat(const char *target, GLuint 
tex, GLuint level, const char *pname);
  
  
      /** A simple automatic display list object.
Index: gzz/gfx/librenderables/renderables.py
diff -c gzz/gfx/librenderables/renderables.py:1.53 
gzz/gfx/librenderables/renderables.py:1.54
*** gzz/gfx/librenderables/renderables.py:1.53  Thu Sep 19 09:01:28 2002
--- gzz/gfx/librenderables/renderables.py       Fri Sep 20 06:27:03 2002
***************
*** 1608,1613 ****
--- 1608,1616 ----
  
        public static native String getGLString(String name);
        public static native float[] getGLFloat(String name);
+       public static native float[] getGLTexParameterFloat(String target, int 
tex, String name);
+       public static native float[] getGLTexLevelParameterFloat(String target, 
int tex, int level, String name);
+       public static native String getGLTokenString(int value);
  
        // Clear stencil buffer: on some NVIDIA drivers, there
        // seems to be a bug.




reply via email to

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