unfiltered texture

hey all

i’ve got a texture which is a lower resolution that the screen i want to output it to
(e.g. 128x128 texture, 1400x1050 resolution)
if i render the texture to the screen, i get bilinear filtering (it seems)
is it possible to turn filtering off? so that i get nearest neighbour filtering?
basically i want it to render blocky, otherwise my app wont work

is there a way?
other than resampling the texture by hand :(?

yes, in 0.061 we’ve added a function for that called:

setTextureMinMagFilter(…)

an example:

  
  
  
in the .h file:   
  
ofTexture tex;  
  
in .cpp :   
  
//--------------------------------------------------------------  
void testApp::setup(){  
  
	tex.allocate(10,10,GL_LUMINANCE);  
	unsigned char pix[10*10];  
	for (int i = 0; i < 10*10; i++){  
		pix[i] = ofRandom(0,255);	  
	}  
	tex.loadData(pix, 10, 10, GL_LUMINANCE);  
	tex.setTextureMinMagFilter(GL_NEAREST, GL_NEAREST);  
}  
  
//--------------------------------------------------------------  
void testApp::update(){  
  
}  
  
//--------------------------------------------------------------  
void testApp::draw(){  
	ofSetColor(255, 255, 255);  
	tex.draw(0,0,ofGetWidth(), ofGetHeight());  
}  

hope that helps!

take care,
zach

![](http://forum.openframeworks.cc/uploads/default/542/Picture 13.png)

thanks zach

will upgrade to 061 then…