Sign in to follow this  
CyberSlag5k

Display list GL_LINE_STRIPs always white (solved)

Recommended Posts

I have some GL_LINE_STRPs that offer a visual representation of some surface/vertex normals for a simple mesh. I store them inside of a display list. However I can't seem to change their color. They are always white. Calling glColor3f(1.0f, 0.0f, 0.0f) seems to have no affect, whether it is called before the display list is called, before the geometry is loaded into the display list, or even between the glBegin/glEnd calls to actually create the strips. Here's the code that creates the display list:
void Terrain::CreateVertexNormalsDisplaylist()
{
	if(m_VertexNormalsDisplaylist != NULL)
		glDeleteLists(m_VertexNormalsDisplaylist, 1);

	m_VertexNormalsDisplaylist = glGenLists(1);

	if(glIsList(m_VertexNormalsDisplaylist) == GL_FALSE)
	{
		Log::Write("CreateVertexNormalsDisplayList", "Vertex normals display list failed to be created");
		return;
	}


	glNewList(m_VertexNormalsDisplaylist, GL_COMPILE);
	glPushMatrix();

	glDisable(GL_TEXTURE_2D);
	glColor3f(1.0f, 0.0f, 0.0f);


	for(int i = 0; i < m_MapWidth; i++)
		for(int j = 0; j < m_MapLength; j++)
		{
			glPushMatrix();
			glTranslatef(m_Vertices[i][j].pos.GetX(), m_Vertices[i][j].pos.GetY(), m_Vertices[i][j].pos.GetZ());
			glBegin(GL_LINE_STRIP);
				glColor3f(1.0f, 0.0f, 0.0f);
				glNormal3f(-m_Vertices[i][j].normal.GetX(), -m_Vertices[i][j].normal.GetY(), -m_Vertices[i][j].normal.GetZ());
				glVertex3f(-m_Vertices[i][j].normal.GetX(), -m_Vertices[i][j].normal.GetY(), -m_Vertices[i][j].normal.GetZ());

				glNormal3f(m_Vertices[i][j].normal.GetX(), m_Vertices[i][j].normal.GetY(), m_Vertices[i][j].normal.GetZ());
				glVertex3f(m_Vertices[i][j].normal.GetX(), m_Vertices[i][j].normal.GetY(), m_Vertices[i][j].normal.GetZ());
			glEnd();
			glPopMatrix();
		}

	glPopMatrix();
	glEndList();
}

and I can post anything else if it'll help but I really just call glCallList in my render method, so I don't really think there's much more to see. I can't really explain this one. I've eliminated any and all glErrors, the entire program funs to completion without any being thrown. Can anyone suggest some things to look at? Thanks.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this