PDA

View Full Version : Toggle glPolygonMode( ..., GL_FILL/GL_LINE) [w/GLUT]


biorhythm
03-26-2012, 02:45 AM
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 ) ;
...
}

biorhythm
03-26-2012, 02:58 AM
Wait, jumped the gun on PEBKAC issue...

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

CGTalk Moderation
03-26-2012, 02:58 AM
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.