Jump to content
  • Advertisement

Archived

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

mstein

glut mouse menu -- get a weird stack error

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

If you intended to correct an error in the post then please contact us.

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 . . .
    
/* MOUSE MENU */
void screen_menu(int status) {
	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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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 this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!