texture mapping on tessellated polygon

Hi, I would like to ask the method of mapping a 2D texture on a polygon drawn using tessellator. I have tried to use glTexGen, but it turns out the texture is screwed up and is changing when my camera position changes. Here is the code segment:


glColor3f(1.0f, 1.0f, 1.0f);
static GLfloat s[4] = { -690.0f, 0.0f, 880.0f, 0.0f };
static GLfloat t[4] = { 0.0f, -120.0f, 880.0f, 0.0f };
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGenfv(GL_S, GL_OBJECT_PLANE, s);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGenfv(GL_T, GL_OBJECT_PLANE, t);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);

GLdouble v[4][3];
gluTessBeginPolygon(tess, NULL);
	gluTessBeginContour(tess);
		v[0][0] = -690.0f;
		v[0][1] = -120.0f;
		v[0][2] = 880.0f;
		gluTessVertex(tess, v[0], v[0]);
		v[1][0] = -690.0f;
		v[1][1] = 120.0f;
		v[1][2] = 880.0f;
		gluTessVertex(tess, v[1], v[1]);
		v[2][0] = -820.0f;
		v[2][1] = 120.0f;
		v[2][2] = 880.0f;
		gluTessVertex(tess, v[2], v[2]);
		v[3][0] = -820.0f;
		v[3][1] = -120.0f;
		v[3][2] = 880.0f;
		gluTessVertex(tess, v[3], v[3]);
	gluTessEndContour(tess);
gluEndPolygon(tess);

glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);

My coordinate system is:
to the right: -X
away from you: +Z
upwards: +Y

I have struggled with it for weeks but still don’t find the answer, hope someone here can help me. THANKS!!!

Sorry I have made one mistake in the code, it should be:

static GLfloat s[4] = { 1.0f, 0.0f, 0.0f, 0.0f };
static GLfloat t[4] = { 0.0f, 1.0f, 0.0f, 0.0f };

THANKS!