I have received some code that displays a height map. It has two modes two display colors for the heights. Transitions from black to a color and allows different colors at different height levels. The problem is when using the different colors it will not display different colors for each of the height gradients but will take the color that matches the heighest point for that vertices and go from black to the that color. What I need is to show for example black band, red band, yellow band, blue band etc up to the heightest color.
I am new at gl. I understand that concept of color blending on a surface but how do you get different colors that stack on each other to display. What would be the easiest way to incorporate what I need.
Is there a way to apply a band of color across an already existing 3D shape.
for( int j=0; j<m_p3D->nY-1; j++ )
for( int i=0; i<m_p3D->nX-1; i++ )
{
glBegin(GL_QUADS);
ColorLevel(m_p3D->m_XYZ.w[jm_p3D->nX+i]);
glVertex3f(m_p3D->m_XYZ.x[i], m_p3D->m_XYZ.y[j], m_p3D->m_XYZ.z[jm_p3D->nX+i]);
ColorLevel(m_p3D->m_XYZ.w[jm_p3D->nX+i+1]);
glVertex3f(m_p3D->m_XYZ.x[i+1], m_p3D->m_XYZ.y[j], m_p3D->m_XYZ.z[jm_p3D->nX+i+1]);
ColorLevel(m_p3D->m_XYZ.w[(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.w[(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();
}
}
Colorlevel uses glcolor3f to get the colors.