View Full Version : renderfunc questions
apocalexiz
07-16-2003, 02:37 AM
hy there
i call my renderfunction as follows
glutDisplayFunc(renderfunc);
now i want to give me renderfunc some parameters
glutDisplayFunc(renderfunc(foo,bar));
but this wont work...how can i do a parametric function? w/o making variables global?
bye
apo
errno
07-16-2003, 04:36 AM
glut don't allow you to do that. to use parameters in the display function(or idle, reshape ...) you have to use global variables.
apocalexiz
07-16-2003, 06:54 AM
is there a good reason why this isnt implemented?
hmm...ive done it w/o globals http://www.opengl.org/discussion_boards/ubb/smile.gif, i used a "fake" render function http://www.opengl.org/discussion_boards/ubb/wink.gif that does only the following in my case...
void renderFunc(void)
{
displayCallback(32,32);
}
it works http://www.opengl.org/discussion_boards/ubb/smile.gif
bye
apo
errno
07-16-2003, 11:07 PM
the reason is ... there is probably no reason.
your solution works well but your parameters won't stay static. so you'll have to use global vars to access them.
maybe you should try another window "manager". try SDL.
SDL don't have an implemented main loop, you have to code it. it's you who call the display func so you can pass parameters to the callback.
apocalexiz
07-17-2003, 12:42 AM
i know...thats the reason why i wrote my fake func above the render func http://www.opengl.org/discussion_boards/ubb/wink.gif so u can see the relationship between this both http://www.opengl.org/discussion_boards/ubb/wink.gif
bye
apo
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.