More about this problem in detail:
for example, there is a texture as follows:
0 1 2 3
4 5 6 7
8 9 10 11
12 13 14 15
In ortho mode, I bind this texture to a square which vertices are(0,0),(4,0),(4,4),(0,4). If I set the texture parameters as follows, I can get the correct result from glReadPixel into an array which is same to the above texture data.
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexImage2D( GL_TEXTURE_2D, 0, 1, DimX, DimY, 0, GL_RED, GL_UNSIGNED_BYTE, TextureData );
But the problem is that, I want the array data like follows:
0 2
8 10
which mean I just take half data from the texture.
Here I shrink the square in both directions, but it comes up with what I don’t want.
Can anybody provide the outway? Thanks a lot.
[This message has been edited by foollove (edited 09-09-2003).]
[This message has been edited by foollove (edited 09-09-2003).]