Index: Base/GemMan.cpp
===================================================================
RCS file: /cvsroot/pd-gem/Gem/src/Base/GemMan.cpp,v
retrieving revision 1.60
diff -u -r1.60 GemMan.cpp
--- Base/GemMan.cpp	24 Jul 2007 18:23:19 -0000	1.60
+++ Base/GemMan.cpp	21 Sep 2007 08:04:54 -0000
@@ -1174,17 +1174,19 @@
    * however, when it was run with nvidia-drivers, the openGL-extension was present
    * resulting in doing a lot of stupid things (like texturing black!)
    */
-#ifdef GL_EXT_texture_rectangle
-  if (texture_rectangle_supported
-      = OpenGLExtensionIsSupported("GL_EXT_texture_rectangle")){}
-  else
+#ifdef GL_ARB_texture_rectangle
+  if (OpenGLExtensionIsSupported("GL_ARB_texture_rectangle"))
+    {
+      texture_rectangle_supported=2;
+    } else
 #endif
-#ifdef GL_TEXTURE_RECTANGLE_NV
-    if ((texture_rectangle_supported
-	 =  OpenGLExtensionIsSupported("GL_NV_texture_rectangle"))){}
-    else
+#ifdef GL_EXT_texture_rectangle
+  if (OpenGLExtensionIsSupported("GL_EXT_texture_rectangle"))
+    {
+      texture_rectangle_supported=1;
+    } else
 #endif
-      texture_rectangle_supported = 0;
+    texture_rectangle_supported = 0;
 
     /*
         GL_APPLE_client_storage allows better performance when modifying
@@ -1196,7 +1198,6 @@
         needs it.  GL_APPLE_client_storage is supported on all video
         cards under __APPLE__ 10.1 and above.
     */
-
   client_storage_supported
 #ifdef GL_UNPACK_CLIENT_STORAGE_APPLE
     = OpenGLExtensionIsSupported("GL_APPLE_client_storage");
Index: Pixes/pix_movieNEW.h
===================================================================
RCS file: /cvsroot/pd-gem/Gem/src/Pixes/pix_movieNEW.h,v
retrieving revision 1.1
diff -u -r1.1 pix_movieNEW.h
--- Pixes/pix_movieNEW.h	8 Oct 2003 16:54:07 -0000	1.1
+++ Pixes/pix_movieNEW.h	21 Sep 2007 08:04:54 -0000
@@ -66,7 +66,7 @@
   // [in] type - if == 0, then GL_NEAREST, else GL_LINEAR
   void          textureQuality(int type){m_pixtexture.textureQuality(type);}
   void          repeatMess(int type){m_pixtexture.repeatMess(type);}
-  void          modeMess(int mode){m_pixtexture.m_mode=mode;}
+  void          modeMess(int mode){m_pixtexture.m_rectangle=mode;}
 
  protected:
 	
Index: Pixes/pix_texture.cpp
===================================================================
RCS file: /cvsroot/pd-gem/Gem/src/Pixes/pix_texture.cpp,v
retrieving revision 1.43
diff -u -r1.43 pix_texture.cpp
--- Pixes/pix_texture.cpp	7 Aug 2007 14:32:53 -0000	1.43
+++ Pixes/pix_texture.cpp	21 Sep 2007 08:04:55 -0000
@@ -53,7 +53,7 @@
     m_realTextureObj(0),
     m_oldTexCoords(NULL), m_oldNumCoords(0), m_oldTexture(0), 
     m_textureType( GL_TEXTURE_2D ),
-    m_mode(0), m_env(GL_MODULATE),
+    m_rectangle(0), m_env(GL_MODULATE),
     m_clientStorage(0), //have to do this due to texture corruption issues
     m_yuv(1),
 	m_texunit(0)
@@ -64,8 +64,7 @@
   
   //rectangle textures by default only for OSX since there are too many busted drivers in use on Windows and Linux
   #if defined(GL_TEXTURE_RECTANGLE_ARB) && __APPLE__
-  //|| defined(GL_NV_TEXTURE_RECTANGLE)
-  m_mode = 1;  //default to the fastest mode for systems that support it
+  m_rectangle = 1;  //default to the fastest mode for systems that support it
   m_textureType = GL_TEXTURE_RECTANGLE_ARB;
   #endif
   
@@ -98,8 +97,8 @@
 /////////////////////////////////////////////////////////
 void pix_texture :: setUpTextureState() {
 #ifdef GL_TEXTURE_RECTANGLE_ARB
-  if (m_mode && GemMan::texture_rectangle_supported){
-    if ( m_textureType ==  GL_TEXTURE_RECTANGLE_ARB)
+  if (m_rectangle && GemMan::texture_rectangle_supported){
+    if ( m_textureType ==  GL_TEXTURE_RECTANGLE_ARB || m_textureType == GL_TEXTURE_RECTANGLE_EXT)
 	{
       glTexParameterf(m_textureType, GL_TEXTURE_PRIORITY, 0.0f);
     // JMZ: disabled the following, as rectangle-textures are clamped anyhow
@@ -139,13 +138,7 @@
   glTexParameterf(m_textureType, GL_TEXTURE_MAG_FILTER, m_textureQuality);
   glTexParameterf(m_textureType, GL_TEXTURE_WRAP_S, m_repeat);
   glTexParameterf(m_textureType, GL_TEXTURE_WRAP_T, m_repeat);
-  
-/*
-#ifdef GL_TEXTURE_RECTANGLE_ARB
-  if (m_mode)
-    if ( m_textureType !=  GL_TEXTURE_RECTANGLE_ARB)
-#endif //GL_TEXTURE_RECTANGLE_ARB
-*/
+
   glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, m_env);
 }
 
@@ -197,6 +190,7 @@
   int x_2, y_2;
   GLboolean useExternalTexture=false;
   GLfloat xTex=1., yTex=1.;
+  int rectangle = (m_rectangle)?GemMan::texture_rectangle_supported:0;
 
   if (!state->image || !state->image->image.data){
     if(m_extTextureObj>0) {
@@ -238,22 +232,27 @@
 
 #ifdef GL_VERSION_1_1
   if(!useExternalTexture){
+    switch(rectangle) {
 # ifdef GL_TEXTURE_RECTANGLE_ARB
-    if (m_mode){
-      if (GemMan::texture_rectangle_supported ){
-	m_textureType = GL_TEXTURE_RECTANGLE_ARB;
-	debug("using mode 1:GL_TEXTURE_RECTANGLE_ARB");
-	normalized = 0;
-      }
-    } else 
-
-#endif // GL_TEXTURE_RECTANGLE_ARB
-
-      {
-	m_textureType = GL_TEXTURE_2D;
-	debug("using mode 0:GL_TEXTURE_2D");
-	normalized = 0;
-      }
+    case 2:
+      m_textureType = GL_TEXTURE_RECTANGLE_ARB;
+      debug("using mode 1:GL_TEXTURE_RECTANGLE_ARB");
+      normalized = 0;
+      break;
+# endif
+# ifdef GL_TEXTURE_RECTANGLE_EXT
+    case 1:
+      m_textureType = GL_TEXTURE_RECTANGLE_EXT;
+      debug("using mode 1:GL_TEXTURE_RECTANGLE_EXT");
+      normalized = 0;
+      break;
+# endif
+    default:
+      m_textureType = GL_TEXTURE_2D;
+      debug("using mode 0:GL_TEXTURE_2D");
+      normalized = 0;
+      break;
+    }
   }
   if (m_textureType!=texType){
     debug("texType != m_textureType");
@@ -268,7 +267,6 @@
   if ((!useExternalTexture)&&state->image->newfilm ){
       //  tigital:  shouldn't we also allow TEXTURE_2D here?
       if ( GemMan::texture_range_supported ){
-        //	if ( GemMan::texture_range_supported && GemMan::texture_rectangle_supported && m_mode){
         glTextureRangeAPPLE( m_textureType, 
                              m_imagebuf.xsize * m_imagebuf.ysize * m_imagebuf.csize, 
                              m_imagebuf.data );
@@ -342,7 +340,7 @@
 	} else { // !normalized
 	    m_xRatio = (float)m_imagebuf.xsize;
 	    m_yRatio = (float)m_imagebuf.ysize;
-	    if ( !GemMan::texture_rectangle_supported || !m_mode ) {
+	    if ( !rectangle ) {
 		m_xRatio /= (float)x_2;
 		m_yRatio /= (float)y_2;
 		m_buffer.xsize = x_2;
@@ -367,10 +365,10 @@
 		m_dataSize[2] = m_buffer.ysize; 
      
             
-		if (m_buffer.format == GL_YUV422_GEM && !m_mode)m_buffer.setBlack();
+		if (m_buffer.format == GL_YUV422_GEM && !m_rectangle)m_buffer.setBlack();
 
 	    //this is for dealing with power of 2 textures which need a buffer that's 2^n
-	    if ( !GemMan::texture_rectangle_supported || !m_mode ) {            
+	    if ( !rectangle ) {            
 		glTexImage2D(	m_textureType, 0,
 				//m_buffer.csize,
 				GL_RGBA,
@@ -445,6 +443,11 @@
   // (this is important for things like [pix_coordinate]
   if(m_textureType==GL_TEXTURE_RECTANGLE_ARB)state->texture=2;
 #endif
+#ifdef GL_TEXTURE_RECTANGLE_EXT
+  // if we are using rectangle textures, this is a way to inform the downstream objects 
+  // (this is important for things like [pix_coordinate]
+  if(m_textureType==GL_TEXTURE_RECTANGLE_EXT)state->texture=2;
+#endif
 
   m_didTexture=1;
   
@@ -561,6 +564,21 @@
   }
   setModified();
 }
+
+/////////////////////////////////////////////////////////
+// textureQuality
+//
+/////////////////////////////////////////////////////////
+void pix_texture :: textureRectangle(int rect)
+{
+  m_rectangle=rect;
+  if (m_rectangle)
+    post("using mode 1: TEXTURE_RECTANGLE");
+  else
+    post("using mode 0: TEXTURE_2D");
+  m_rebuildList=1;
+}
+
 /////////////////////////////////////////////////////////
 // texture repeat message
 //
@@ -662,14 +680,9 @@
 {
   GetMyClass(data)->envMess((int) num);
 }
-void pix_texture :: modeCallback(void *data, t_floatarg quality)
+void pix_texture :: modeCallback(void *data, t_floatarg rectangle)
 {
-  GetMyClass(data)->m_mode=((int)quality);
-  if (quality)
-    GetMyClass(data)->post("using mode 1:GL_TEXTURE_RECTANGLE_ARB");
-  else
-    GetMyClass(data)->post("using mode 0:GL_TEXTURE_2D");
-  GetMyClass(data)->m_rebuildList=1;
+  GetMyClass(data)->textureRectangle((int)rectangle);
 }
 
 void pix_texture :: clientStorageCallback(void *data, t_floatarg quality)
Index: Pixes/pix_texture.h
===================================================================
RCS file: /cvsroot/pd-gem/Gem/src/Pixes/pix_texture.h,v
retrieving revision 1.18
diff -u -r1.18 pix_texture.h
--- Pixes/pix_texture.h	3 Nov 2006 08:26:19 -0000	1.18
+++ Pixes/pix_texture.h	21 Sep 2007 08:04:55 -0000
@@ -138,14 +138,14 @@
 		TexCoord       *m_oldTexCoords;
 		int             m_oldNumCoords;
 		int             m_oldTexture;
-	
 
 		int             m_textureType; // GL_TEXTURE_2D, GL_TEXTURE_RECTANGLE_EXT
 		bool            m_normalized;  // whether the image is power of 2
 
 		GLfloat         m_xRatio, m_yRatio; // x- and y-size if texture
 
-		int		m_mode; //rectangle or power of 2
+		void            textureRectangle(int mode);
+		int		m_rectangle; //rectangle or power of 2
 		
 		//////////
 		// texture envirnoment mode
