dcd

02-06-2003, 11:01 AM

How do I generate normals from the vertexes below?:

glBegin(GL_TRIANGLE_STRIP);

fVertexes[0][0] = (i+1-fSize/2)/2;

fVertexes[0][1] = m_fWater[i+1][j+1]-2;

fVertexes[0][2] = (j+1-fSize)/2;

fVertexes[1][0] = (i-fSize/2)/2;

fVertexes[1][1] = m_fWater[i][j+1]-2;

fVertexes[1][2] = (j+1-fSize)/2;

fVertexes[2][0] = (i+1-fSize/2)/2;

fVertexes[2][1] = m_fWater[i+1][j]-2;

fVertexes[2][2] = (j-fSize)/2;

fVertexes[3][0] = (i-fSize/2)/2;

fVertexes[3][1] = m_fWater[i][j]-2;

fVertexes[3][2] = (j-fSize)/2;

glTexCoord2f(m_fTransWaterX+tx+td, m_fTransWaterZ+ty+td);

glVertex3f(fVertexes[0][0],fVertexes[0][1],fVertexes[0][2]);

glTexCoord2f(m_fTransWaterX+tx, m_fTransWaterZ+ty+td);

glVertex3f(fVertexes[1][0],fVertexes[1][1],fVertexes[1][2]);

glTexCoord2f(m_fTransWaterX+tx+td, m_fTransWaterZ+ty);

glVertex3f(fVertexes[2][0],fVertexes[2][1],fVertexes[2][2]);

glTexCoord2f(m_fTransWaterX+tx, m_fTransWaterZ+ty);

glVertex3f(fVertexes[3][0],fVertexes[3][1],fVertexes[3][2]);

glEnd();

[This message has been edited by dcd (edited 02-06-2003).]

glBegin(GL_TRIANGLE_STRIP);

fVertexes[0][0] = (i+1-fSize/2)/2;

fVertexes[0][1] = m_fWater[i+1][j+1]-2;

fVertexes[0][2] = (j+1-fSize)/2;

fVertexes[1][0] = (i-fSize/2)/2;

fVertexes[1][1] = m_fWater[i][j+1]-2;

fVertexes[1][2] = (j+1-fSize)/2;

fVertexes[2][0] = (i+1-fSize/2)/2;

fVertexes[2][1] = m_fWater[i+1][j]-2;

fVertexes[2][2] = (j-fSize)/2;

fVertexes[3][0] = (i-fSize/2)/2;

fVertexes[3][1] = m_fWater[i][j]-2;

fVertexes[3][2] = (j-fSize)/2;

glTexCoord2f(m_fTransWaterX+tx+td, m_fTransWaterZ+ty+td);

glVertex3f(fVertexes[0][0],fVertexes[0][1],fVertexes[0][2]);

glTexCoord2f(m_fTransWaterX+tx, m_fTransWaterZ+ty+td);

glVertex3f(fVertexes[1][0],fVertexes[1][1],fVertexes[1][2]);

glTexCoord2f(m_fTransWaterX+tx+td, m_fTransWaterZ+ty);

glVertex3f(fVertexes[2][0],fVertexes[2][1],fVertexes[2][2]);

glTexCoord2f(m_fTransWaterX+tx, m_fTransWaterZ+ty);

glVertex3f(fVertexes[3][0],fVertexes[3][1],fVertexes[3][2]);

glEnd();

[This message has been edited by dcd (edited 02-06-2003).]