PDA

View Full Version : Automatic Texturcoord generation



timbre
04-05-2006, 03:16 AM
Sorry for asking such a lame question again..

I have a problem with automatic texture generation. It basicly works as expected.
But I´d like to map only a fraction of a texture on the whole object. From 0 -> 0.7 instead of 0->1

Is there any way to limit S or T ( or R or Q) in i.e. 0.7 instead of using the full texture 1.

I played arround with :

glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);

GLfloat Splane[] = { 0.7, 0.f, 0.f, 0.f };
glTexGenfv(GL_S, GL_OBJECT_PLANE, Splane );

but it seems to be the wrong way.

I know that I can set Texcoords manualy by i.e. glTexCoord2f( 0, 0 ); but this does not work with Quadrics ...
maybe use matrix multiplication on the texture matrix ?

thx a lot

jide
04-05-2006, 08:33 AM
Yes using texture matrix is one of the few solutions I know to your problem. The other one would be to use shaders.

ZbuffeR
04-05-2006, 10:09 AM
a little glScale(1.0/0.7) on the texture matrix should do it.

timbre
04-06-2006, 02:32 AM
thanx a lot for your help,
i´ll try it out.

iris_raj
04-06-2006, 07:50 AM
Dear ZBuffer,

Do you mean say,

glMatrixMode( GL_TEXTURE );
glLoadIdentity();
glScalef(0.7/1,0.7/1.0);

/* Code for Texture coordinates */

Thanks in advance

Rajesh.R
IRIS, CAIR
Bangalore - 1

ZbuffeR
04-06-2006, 09:29 AM
to iris_raj : yes.