incorrect aliased rendering

i’ve been having some weird issues with perfect aliased rendering recently.

yesterday i had to render a 1280x720 texture at 1278x718 or i was getting weird artifacts.

i dug into it a little more and posted this issue https://github.com/openframeworks/openFrameworks/issues/798

just now i thought it might have something to do with different video cards, so i did a test on my ati and on an older nvidia. i used the code below:

  
  
void ofApp::setup() {  
	fbo.allocate(512, 256);  
}  
  
void ofApp::update() {  
}  
  
void ofApp::drawGrid() {  
	ofPushMatrix();  
	ofTranslate(mouseX, 0);  
	if(ofGetMousePressed()) {  
		ofTranslate(.5, .5);  
	}  
	for(int i = 0; i < 256; i += 2) {  
		ofLine(i, 0, i, 256);  
		ofLine(0, i, 256, i);  
	}  
	ofPopMatrix();  
}  
  
void ofApp::draw() {  
	ofSetColor(255);  
	  
	ofClear(0, 255);  
	drawGrid();  
	  
	fbo.begin();  
	ofClear(0, 255);  
	drawGrid();  
	fbo.end();  
	fbo.draw(0, 256);  
}  
  

and got the results attached.

my only conclusion is that nvidia treats the pixel grid as being starting on 0,0, and ati treats it as being aligned to .5,.5 (the pixel center).

i just found this post http://www.gamedev.net/topic/564153-pixel-perfect-texture-mapping-problem-nvidia-vs-ati/ which describes a solution for this case:

1 ofSetupScreenOrtho(512, 512, OF_ORIENTATION_DEFAULT, true); at the top of draw()
2 ofSetupScreenOrtho(512, 256, OF_ORIENTATION_DEFAULT, false); just after fbo.begin()

then it’s exactly the same on ati as the original on nvidia.

but i don’t understand why it would make such a huge difference in the no-click ati case above. something seems very wrong to me.