• Advertisement
Sign in to follow this  

Display list GL_LINE_STRIPs always white (solved)

This topic is 4031 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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[j].pos.GetX(), m_Vertices[j].pos.GetY(), m_Vertices[j].pos.GetZ());
			glBegin(GL_LINE_STRIP);
				glColor3f(1.0f, 0.0f, 0.0f);
				glNormal3f(-m_Vertices[j].normal.GetX(), -m_Vertices[j].normal.GetY(), -m_Vertices[j].normal.GetZ());
				glVertex3f(-m_Vertices[j].normal.GetX(), -m_Vertices[j].normal.GetY(), -m_Vertices[j].normal.GetZ());

				glNormal3f(m_Vertices[j].normal.GetX(), m_Vertices[j].normal.GetY(), m_Vertices[j].normal.GetZ());
				glVertex3f(m_Vertices[j].normal.GetX(), m_Vertices[j].normal.GetY(), m_Vertices[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
Advertisement
Bah, I've got lighting enabled without setting materials. Ignore this thread (but I'll leave it up in case any future readers make the same silly mistake).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement