Simon Hui (shui++at++kid.asd.sgi.com)
Thu, 30 May 96 19:08:39 -0700
Ah, that explains it. The default ortho projection will be
(-0.5, 255.5, -0.5, 255.5); this is what's needed to get a one-to-one
mapping between eye coords and window coords, see manpage for ortho2.
Hence your square covers a 255x255 area, onto which you are drawing a
256x256 texture, so there is a slight minification.
> If I offset the texture coordinates of the square I draw by half the
> size of a texel, the window image stays the same - as expected.
Sure, it compensates for the 1-pixel difference. Using
(-0.5, 255.5, -0.5, 255.5) for the square should also work.
> I wonder if I should do the same in Opengl (haven't tried the opengl
> version yet).
No - in irisgl, pixel centers have *.5 coordinates, but in opengl they
have *.0 coordinates. So you'd this in opengl:
glOrtho2(0.0, w, 0.0, h, ...,...);
glBegin(GL_TRIANGLE_STRIP);
glVertex2f(0, 0);
glVertex2f(w, 0);
glVertex2f(0, h);
glVertex2f(w, h);
glEnd();
By the way, OpenGL sets the projection matrix to identity by default,
so you have to set it yourself. The viewport, however, is set to the
size of the window by default.
simon w. hui iris performer
shui++at++sgi.com advanced systems div
415.933.3244 silicon graphics inc
=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer.html
Submissions: info-performer++at++sgi.com
Admin. requests: info-performer-request++at++sgi.com
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:52:56 PDT