[GEM-dev] pix_texture2 does not respect upsidedown flag

Henning Haaland Kulander hennikul at ifi.uio.no
Thu Dec 4 18:11:15 CET 2003


Hi!

While working on the filmFFMPEG.cpp file I have had problems getting the 
image to be displayed the correct way. I tried playing with the upsidedown 
flag in imageStruct, but it wouldn't work. I was using 05.film.pd for 
testing. When replacing pix_texture2 with pix_texture, I finally got it 
working. 

The problem with pix_texture2 is that the flipping is hardcoded using 
#ifdefs checking for the apple platform. This #ifdef is also done in line 
108 in GemPixUtil.h, and will set upsidedown on all imageStructs on apple. 

I created a patch for pix_texture2 which does the test in runtime as it is 
done in pix_texture. This fixes my problem, but can possibly cause other 
problems.. :) Is there a reason for hardcoding this?


Regards,
Henning Kulander
-------------- next part --------------
Index: src/Pixes/pix_texture2.cpp
===================================================================
RCS file: /cvsroot/pd-gem/Gem/src/Pixes/pix_texture2.cpp,v
retrieving revision 1.11
diff -u -r1.11 pix_texture2.cpp
--- src/Pixes/pix_texture2.cpp	14 Sep 2003 22:26:11 -0000	1.11
+++ src/Pixes/pix_texture2.cpp	4 Dec 2003 17:01:40 -0000
@@ -164,7 +164,7 @@
 	
 	  float m_xRatio = (float)state->image->image.xsize / (float)x_2;
 	  float m_yRatio = (float)state->image->image.ysize / (float)y_2;
-#ifndef __APPLE__		
+	  if (!state->image->image.upsidedown) {
 	  m_coords[0].s = 0.f;
 	  m_coords[0].t = 0.f;
 	  
@@ -176,8 +176,9 @@
 	  
 	  m_coords[3].s = 0.f;
 	  m_coords[3].t = m_yRatio;
-#else
-	  m_coords[3].s = 0.f;		// switched the order of m_coords on __APPLE__
+	  } else {
+	  m_coords[3].s = 0.f; // switched the order of m_coords on
+	                       // __APPLE__, or if upsidedown == true
 	  m_coords[3].t = 0.f;		// otherwise we'd be upside down!
 	  
 	  m_coords[2].s = m_xRatio;
@@ -188,7 +189,7 @@
 		
 	  m_coords[0].s = 0.f;
 	  m_coords[0].t = m_yRatio;
-#endif
+	  }
 	}
       } else {				// tigital
 	if (state->image->image.xsize != m_buffer.xsize || state->image->image.ysize != m_buffer.ysize 


More information about the GEM-dev mailing list