Texture Coordinate Generation (Was: accessing depth texture in GLSL (NV 36))

Texture Coordinate Generation (Was: accessing depth texture in GLSL (NV 36))

Post by fuenfzi » Wed, 07 Mar 2007 00:15:23


Hi,

I have to come back on this one. Accessing the depth texture in GLSL
just works fine. The problem is in the texture coordinates generated
by
GL_TEXTURE_GEN_S/GL_TEXTURE_GEN_T.
I changed the GL_EYE_PLANE coefficients

// use texture unit 0
glActiveTexture(GL_TEXTURE0);

float size = 5.0f;
GLfloat paramS[4] = {
0.5f/size*GLfloat(m_width), 0.0f, 0.0f, 0.5f*GLfloat(m_width)
};
glTexGeni (GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
glTexGenfv(GL_S, GL_EYE_PLANE, paramS);
GLfloat paramT[4] = {
0.0f, 0.5f/size*GLfloat(m_height), 0.0f, 0.5f*GLfloat(m_height)
};
glTexGeni (GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
glTexGenfv(GL_T, GL_EYE_PLANE, paramT);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);

// bind texture object to texture unit 0
// enable GLSL program

// render model 2

which should reproduce the x,y-window coordinates, generated by an
orthographic projection
of size [-5, 5]*[-5, 5] onto a window of size m_width*m_height.
For testing I render the near plane quad of the view frustum, textured
with the generated texture coordinates.
But there are views, where nothing of the original rendering can be
seen.
I don't know where I messed up the texture coordinate generation...
(wrong interpretation/format of GL_EYE_PLANE coefficients?, wrong
MODELVIEW matrix?,
texture coordinates for texture unit 0?)

Any hints on this, are really appreciated,
Thanks,
Christoph



fuenfzig schrieb: