PDA

View Full Version : how to change the symbolic constant in glBegin()



godhand
04-15-2004, 08:25 PM
Hi, just wondering how I can change the constant in glBegin(GL_POLYGON) to glBegin(GL_LINE_LOOP) if the user presss a key event. thanks

plasmonster
04-15-2004, 08:29 PM
glPolygonMode( GL_FRONT_AND_BACK, mode ), where mode is GL_FILL or GL_LINE.

04-16-2004, 12:07 AM
glPolygonMode? Eh?

No, what you want is just to save the mode in a variable, and glBegin the variable instead. Something like:


// Initialisation:
int mode = GL_POLYGON;

// On key event:
if(mode == GL_POLYGON)
mode = GL_LINE_LOOP;
else
mode = GL_POLYGON;

// Drawing:
glBegin(mode);
...