PDA

View Full Version : Texture 2D or 3D?



hellox
09-10-2002, 02:39 AM
hi, iam trying to do this:

glTexGeni(GL_S,GL_TEXTURE_GEN_MODE,GL_OBJECT_LINEA R);
glTexGeni(GL_T,GL_TEXTURE_GEN_MODE,GL_OBJECT_LINEA R);

glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL _CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL _CLAMP_TO_EDGE);

glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R,GL_NEAREST);
glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_RE PLACE);

glBindTexture(GL_TEXTURE_2D,NAMEtext);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glEnable(GL_TEXTURE_2D);

but i have a problem, the texture is for a Sphere made with glutSolidSphere altered with Scale along the Z_axis, and i get it done, but the texture is not disperserd into the z_axis. It does not get the aspect i want, am i giving some bad arguments or is it supposed to happen?

thanks u've been great =)

nexusone
09-10-2002, 04:21 AM
glut primitives like sphere do not generate texture cordinates.

If you want a textured sphere you have to use gluSphere with the texture feature turned on. "gluQuadricTexture"




GLint list[1]; //make globle

void draw_sphere()
{
GLUtriangulatorObj *sphere; // local

glNewList(list[0], GL_COMPILE);
sphere = gluNewQuadric();
gluQuadricOrientation( sphere, GLU_OUTSIDE);
gluQuadricDrawStyle( sphere, GLU_FILL);
gluQuadricNormals( sphere, GLU_SMOOTH);
gluQuadricTexture( sphere, GL_TRUE);
gluSphere( sphere, 8, 4, 4);
glEndList();
gluDeleteQuadric( sphere );
}



Originally posted by hellox:

hi, iam trying to do this:

glTexGeni(GL_S,GL_TEXTURE_GEN_MODE,GL_OBJECT_LINEA R);
glTexGeni(GL_T,GL_TEXTURE_GEN_MODE,GL_OBJECT_LINEA R);

glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL _CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL _CLAMP_TO_EDGE);

glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R,GL_NEAREST);
glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_RE PLACE);

glBindTexture(GL_TEXTURE_2D,NAMEtext);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glEnable(GL_TEXTURE_2D);

but i have a problem, the texture is for a Sphere made with glutSolidSphere altered with Scale along the Z_axis, and i get it done, but the texture is not disperserd into the z_axis. It does not get the aspect i want, am i giving some bad arguments or is it supposed to happen?

thanks u've been great =)