How to use GTK and oversaturated together?

I know that to write a GTK application I write a bunch of code that describes what fits in the main window, then I call:

gtk_main();

Any code statements after that are not executed.

Now suppose that I would like my GTK application to display something that I wrote in excess, which itself contains a bunch of statements about what kind of graphics you need to install, etc. Then the statement ends:

glutMainLoop();

Everything after that is not executed.

So my problem is that either of these two statements does not allow me to call the other.

  • Is there a way to execute the main redirect loop inside the GTK widget?
  • Is there any way to write code that could somehow simultaneously trigger both the main GTK cycle and the main overvoltage cycle (but called from the main program and displayed in a separate X window, and not inside the widget)? I have a feeling that this can be done using "threads" ...
+3
source share
2 answers

You use basic loops. gtk_main()starts before the call gtk_quit().

Starts the main loop before the call gtk_main_quit(). You can nest calls in gtk_main (). In this case, gtk_main_quit () will make the innermost call to the main loop.

In addition, it glutMainLoop()works the same; it forever processes GL events.

glutMainLoop () on OpenGL.org

glutMainLoop() GLUT. GLUT. . , .

, ( , , ), gtk_main_iteration() .

gtk_main_iteration() GTK.org

mainloop. GTK + , . gtk_main_iteration_do() , - gtk_events_pending(), .

.. GLUT gtk_main_iteration(), GLUT.

GLUT, gtk_main_iteration(), glutIdleFunc(void (*func)(void)), - glutIdleFunc()..

glutTimerFunc(unsigned int msecs, void (*func)(int value), value) gtk_main_iteration() 200 .

, , , glutIdleFunc() , .

GTK GL.

+3

. .

GLUT - OpenGL. GTK OpenGL. GTK, GLUT. - .

+4

All Articles