about texture coordinate

Hi,

now i puzzled with texture coordinate. There is an example about texture in s60 3rd shipped with opengl es . There are two pictures used as texture. They are mapped to a cube. The five faces of the cube are mapped one picture. The sixth face is mapped another picture.
There are the codes for input texture coordinate:

#define tex(u,v) (GLbyte)( (u) - 128 ) , (GLbyte)( (v) - 128 )
static const GLbyte nokTexCoords[24 * 2] =
{
    /* top, whole texture nasa_hubble.h */
    tex(0,0),
    tex(255,0),
    tex(255,255),
    tex(0,255),

/*	0,0,
	1,0,
	1,1,
	0,1,
*/
    /* front, spiral with tail */
    tex(0,255),
    tex(127,255),
    tex(127,127),
    tex(0,127),

/*	0,1,
	0.5,1,
	0.5,0.5,
	0,0.5,
*/	
	
    /* right, red nebulae */
    tex(127,255),
    tex(255,255),
    tex(255,127),
    tex(127,127),

/*	0.5,1,
	1,1,
	1,0.5,
	0.5,0.5,
*/	
    /* left, plasma cloud */
    tex(0,127),
    tex(127,127),
    tex(127,0),
    tex(0,0),

/*	0,0.5,
	0.5,0.5,
	0.5,0,
	0,0,
*/	
    /* back, 2 spirals */
   tex(127,127),
    tex(255,127),
    tex(255,0),
    tex(127,0),

/*	0.5,0.5,
	1.0,0.5,
	1,0,
	0.5,0,
*/	
    /* bottom, whole texture ogles.jpg */
    tex(255,255),
    tex(255,0),
    tex(0,0),
    tex(0,255)

	
/*	1,1,
	1,0,
	0,0,
	0,1
*/	
};

There are codes for texture transformation:


    glMatrixMode( GL_TEXTURE );
    glLoadIdentity();
    glScalef(     1.0f/255.0f, 1.0f/255.0f, 1.0f );
    glTranslatef( 128.0f,      128.0f,      0.0f );

Obviously, the final texture is set to [0,1]. My problem is that why not set the texture coordinate as [0,1] directly. If the nokTexCoords are set in [0,1] in declaration, we need
no transformation. But when i do like this, it works badly.

So i assume that the texture picture coordinate is set [0,255], so why not quit the macro defination and glTranslatef and scalef them directly? But when i do like this, it also works badly.

So why? Anyone can help me?
Looking forward to fast replying.

Mia

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.