#### Archived

This topic is now archived and is closed to further replies.

# glut mouse menu -- get a weird stack error

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

## Recommended Posts

this is weird: look at the below code. whenever i invoke case 'w' -- through a right click mouse menu that pops up using GLUT -- i get an error message from VC.Net saying stack corrupted around 'm'. I assume the 'm' they mean is that variable i have right there. Any ideas . . .

int m = -1;
switch(status) {
case 'w':
glGetIntegerv(GL_POLYGON_MODE, &m);
if(m == GL_LINE)
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
else glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);

break;

[edited by - mstein on March 5, 2003 1:47:12 AM]

##### Share on other sites
For GL_POLYGON_MODE, glGetIntegerv() actually returns two values - the front-facing polygon mode and back-facing polygon mode. So, your single int isn''t big enough to hold the results, thus stomping the stack. ''m'' needs to be an array of 2 ints for this call. I''m not sure which value is returned in which element, though. Anyone?

##### Share on other sites
thanks so much, i think with that information and a little look in the blue book or red book I can figure out the rest. I thought I was using glGetIntegerv properly in the first place. Thanks for the heads up.

-also it took me like 10 tries to reply to this topic, i kept getting server 500 errors, is this on my side or gamedev''s???

##### Share on other sites

I had the same problem replying. It seems to be on the GameDev side (and pretty common).