So I’m designing an intelligent ground vehicle as part of my senior design project and I’m running into a Segmentation fault.
Basically we are running a multi-threaded C++ application that calls things like opencv and ncurses in addition to opengl.
Now my part of all this is the creation of a mapping software using opengl.
When I run this code independently it works fine, but when I integrate into the main code it gets the segfault.
The only part I have in main.cc is:
glutInit(&argc, argv); //initialize glut glutCreateWindow("2D map"); //window title glutDisplayFunc(drawScene);
I had to declare drawScene as a global function because I kept getting an error when I called glutDisplayFunc within the mapping class.
In mapping.cc I have:
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
glutInitWindowSize(400, 400); //set mapping window size
glutInitWindowPosition(600,1); //set screen location
glutSolidSphere(.025,15,15); //radius, slices,stacks
and I get a seg-fault… I have no idea why this is happening. Just this basic sphere image is giving me an error. I have tried to put the glutInit conditions in main() as well as the drawScene() function to no avail. I am really out of a ideas and any help would be greatly appreciated!