PDA

View Full Version : Texture mapping questions



autumn
08-06-2003, 03:10 AM
I want to render one origin texture to a new texture whose dimension is half of the origin texture.
if the origin texture is (5*5):
a1 a2 a3 a4 a5
b1 b2 b3 b4 b5
c1 c2 c3 c4 c5
d1 d2 d3 d4 d5
e1 e2 e3 e4 e5
the result texture should be (3 * 3):
a1 a3 a5
c1 c3 c5
e1 e3 e5

I have used the pbuffer to do it, as below

m_pbuffer_dest ->Activate();

glActiveTextureARB(GL_TEXTURE0_ARB);
glBindTexture(GL_TEXTURE_RECTANGLE_NV, m_tex_pbuffer_orgin);
m_pbuffer_orgin ->Bind(WGL_FRONT_LEFT_ARB);

glBegin(GL_QUADS);
glTexCoord2f(0, 0); glVertex2f(0, 0);
glTexCoord2f(5 , 0); glVertex2f(3 , 0);
glTexCoord2f(5 , 5 ); glVertex2f( 3 , 3);
glTexCoord2f(0, 5); glVertex2f(0, 3);
glEnd();


m_pbuffer_orgin ->Release(WGL_FRONT_LEFT_ARB);

m_pbuffer_dest ->Deactivate();

I run it and got the result which is exactly correct.

and I change the origin texture (18 * 17) is :
a1 a2 a3 a4 a5 .... a18
b1 b2 b3 b4 b5 .... b18
c1 c2 c3 c4 c5 .... c18
d1 d2 d3 d4 d5 .... d18
e1 e2 e3 e4 e5 .... e18
...
r1 r2 r3 r4 r5 .....r18

the reulst should be (9 * 9):
a1 a3 a5 .... a17
c1 c3 c5 .... c17
e1 e3 e5 .... e17
...
r1 r3 r5 .....r17

but result I got is (9 * 9):
a2 a4 .... a18
c2 c4 .... c18
e2 e4 .... e18
...
r2 r4 .....r18

but if I changed the origin texture to 10 * 9 and the result texture(5 * 5) is correct!!

It mazed me , why ? I need your hlep.

For I'm in china , I maybe be sleeping when you read this topic because of time difference and I can not discuss with you
you can give mail me at chqiu@bbi.edu.cn

thank you.

[This message has been edited by autumn (edited 08-06-2003).]