Toggle glPolygonMode( ..., GL_FILL/GL_LINE) [w/GLUT]


#1

Hi,

Trying to toggle wireframe and flat shaded modes using glPolygonMode()

As per various online tutes/guides, I have this so far but all I get is seg. faults;
Thanks in advance.

Full code here --> http://pastebin.com/fSPvf1dQ

static GLenum fillMode = GL_FILL ;
...
void OnKeyboard( unsigned char key, int x, int y ) {
	switch( key ) {
		case 'w' :			/* Toggle wire-frame/flat-shade. */
			fillMode = !fillMode ;
      		        glPolygonMode (GL_FRONT_AND_BACK, fillMode ? GL_FILL : GL_LINE) ;
			break ;
                        ...
	}
    ...
}
...
int main( int argc, char** argv ) {
    ...
    glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ) ;
    ...
    glutKeyboardFunc( OnKeyboard ) ;
    ...
}

#2

Wait, jumped the gun on PEBKAC issue…

For those interested, full solution here --> http://pastebin.com/kwBndmFh


#3

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.