ofPixels to ofTexture doesn't work?

The following really simple application fails for me in the simulator:

void testApp::setup(){	  
	// register touch events  
	// initialize the accelerometer  
	//iPhoneAlerts will be sent to this.  
	//If you want a landscape oreintation   
	pix.allocate(320, 240, GL_RGB);  
	tex.allocate(320, 240, GL_RGB);  
	int i = 0;  
	while(i<pix.size()) {  
		pix[i] = 255;  
void testApp::update(){  
void testApp::draw(){  
	ofBackground(0, 0, 0);  
	tex.draw(0, 0);  

In the console I see back:

[Session started at 2011-11-28 20:58:32 +0100.]
2011-11-28 20:58:34.331 emptyExample[1429:207] Creating OpenGL ES2 Renderer
2011-11-28 20:58:34.358 emptyExample[1429:207] Failed to load vertex shader
2011-11-28 20:58:34.358 emptyExample[1429:207] Failed to compile vertex shader
2011-11-28 20:58:34.359 emptyExample[1429:207] OpenGL ES2 failed
2011-11-28 20:58:34.359 emptyExample[1429:207] Creating OpenGL ES1 Renderer
2011-11-28 20:58:39.171 emptyExample[1429:207] layoutSubviews

Can anyone shed some light on why something so simple wouldn’t work in iOS while it works fine in an OSX app? Much appreciated

Hey Joshua, did you ever work this out? It seems that maybe the ES2 Renderer isn’t finished? It always says it fails for me.

I had to do this:

	img.allocate(320, 480, OF_IMAGE_COLOR); // ofImage instance  
	int i = 0;  
	while( i<img.getPixelsRef().size() ) {  
		img.getPixelsRef()[i] = 255;  

not sure why to be honest and I was just doing it to demonstrate something for a friend who was playing with iOS development so I didn’t dig too deeply into it.

Ok cool. I was just curious. Nice to still see what you did to fix the drawing. :slight_smile: