I am trying to use menu in Glut library in Delphi. I’ve created the menus in following ways:
procedure right_menu(id:integer); stdcall;
begin
exit;
end;
…
glutCreateMenu(right_menu);
glutAddMenuEntry(‘quit’,1);
glutAttachMenu(GLUT_RIGHT_BUTTON);
When I right click, the menu appears. But, when I select the item, the program crashes with an ‘Access Violation’ error. Can anyone tell me, what is wrong here?
Any help, tip, suggestion will be greatly appreciated.
An error fueled by an access violation maybe issued by many craps in your code IMHO, personnally I verify all the ‘pointeurs’ (flag in english ???) that I use beacause they came from bad ‘pointeurs’ manipulation, or window setup declaration, it’s a huge problem when you don’t make your code to debug it easily !
I know my answer is not very complete concerning your prob but maybe another guy tell more about that
Anyway good luck, and take care to your ‘pointeurs’
Thanks for reply. I can say there is no problem with my code. Just, let’s take such a easy situation like given in example. There is no pointer is used. Procedure calls just only EXIT function. Even it can be empty. And the integration between menu and event function is done integrally by Glut. I just connected them by command glutCreateMenu(right_menu). So, what can you recommend me to do?
procedure right_menu(id:integer); stdcall;
begin
exit;
end;
…
glutCreateMenu(right_menu);
glutAddMenuEntry(‘quit’,1);
glutAttachMenu(GLUT_RIGHT_BUTTON);