PDA

View Full Version : 1d texturing on a flat quad



terickso
10-18-2002, 09:03 AM
When I texture height the 1d texturing i do works, but when it does a quad with all four corners are the same height thus the value I give for the texcoord are all the same I first get the topmost color and then it also shows grey in it. Anyone know the reason for it.

if(!m_pDS->m_bAutoCr)glEnable(GL_TEXTURE_1D);
glBegin(GL_QUADS);
ColorLevel(m_p3D->m_XYZ.z[j*m_p3D->nX+i]);
glVertex3f(m_p3D->m_XYZ.x[i], m_p3D->m_XYZ.y[j], m_p3D->m_XYZ.z[j*m_p3D->nX+i]);

ColorLevel(m_p3D->m_XYZ.z[j*m_p3D->nX+i+1]);
glVertex3f(m_p3D->m_XYZ.x[i+1], m_p3D->m_XYZ.y[j], m_p3D->m_XYZ.z[j*m_p3D->nX+i+1]);

ColorLevel(m_p3D->m_XYZ.z[(j+1)*m_p3D->nX+i+1]);
glVertex3f(m_p3D->m_XYZ.x[i+1], m_p3D->m_XYZ.y[j+1], m_p3D->m_XYZ.z[(j+1)*m_p3D->nX+i+1]);

ColorLevel(m_p3D->m_XYZ.z[(j+1)*m_p3D->nX+i]);

glVertex3f(m_p3D->m_XYZ.x[i], m_p3D->m_XYZ.y[j+1], m_p3D->m_XYZ.z[(j+1)*m_p3D->nX+i]);
glEnd();
if(!m_pDS->m_bAutoCr)glDisable(GL_TEXTURE_1D);

Colorlevel just gets a gltexcoord1f value 0 to 1 based upon on height. There are 8 levels of color. It shows the topmost color even though the value is 0 for all points.