Integrating C++ OpenGL project with another C++ project -


i working project reads data file, performs calculations, , show results on standard output. later wanted give 3d graphical view results, made new opengl project shows data 3d object.

now problem is, can not figure out way integrate these 2 independent projects, because main() in opengl project goes in non terminating glutmainloop() loop, , unable figure out put loop in main() of first project !

/**** proj1 ****/ int main() {       while(esc key not pressed)     {         // read data file         // processing         // show results on standard output     } }   /**** proj2 ****/ int main() {     glutinit(&argc, argv);     init();     glutdisplayfunc(display);     glutkeyboardfunc(keyboard);     glutmousefunc(mouse);     glutidlefunc(idle);     glutmainloop(); } 

least mixing of codes between proj1 & proj2 requested. possible like:

/**** proj1 ****/ #include <filesfromproj2> int main() {     while(esc key not pressed)     {           // read data file           // processing           proj2.showresult(result)   // how ?     } } 

the simple solution ditch glut , use opengl windowing framework lets implement event loop. glfw immediate choice. instead of having opaque glutmainloop never returns instead call glfwpollevents beside your stdio processing.


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -