Color state problems

Hi,

I’m having problems with the color state.

The following code does not do what it’s supposed to do:


	gl.glColor3f(0.5f, 0.5f, 0.5f);
		gl.glLineWidth(3.0f);
		
		// should be grey and is
		gl.glBegin(GL.GL_LINES);
		gl.glVertex3f(-1.0f, 1.0f, 0.0f);
		gl.glVertex3f(0.0f, 1.0f, 0.0f);
		gl.glEnd();
		
		gl.glPushAttrib(GL.GL_COLOR_BUFFER_BIT);
		gl.glColor3f(1.0f, 0.0f, 0.0f);
		
		// should be red and is
		gl.glBegin(GL.GL_LINES);
		gl.glVertex3f(-1.0f, 2.0f, 0.0f);
		gl.glVertex3f(0.0f, 2.0f, 0.0f);
		gl.glEnd();
		
		gl.glPopAttrib();
		
		// should be grey but is red
		gl.glBegin(GL.GL_LINES);
		gl.glVertex3f(-1.0f, 3.0f, 0.0f);
		gl.glVertex3f(0.0f, 3.0f, 0.0f);
		gl.glEnd();

so, the color state is not restored properly.

Any ideas what causes that?

Cheers,

Alex

RTM.

::slight_smile:

ok - thanks a lot :slight_smile: I guess I interpreded that a little to much.