Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: OpenGL and AnyEvent

by Corion (Patriarch)
on May 29, 2014 at 11:21 UTC ( [id://1087784]=note: print w/replies, xml ) Need Help??


in reply to OpenGL and AnyEvent

From a quick googling, it seems that at least some GLUT implementations, freeglut and openglut implement glutMainLoopEvent(), which is supposed to be called periodically from your other mainloop.

A second alternative would be to detach OpenGL processing from the rest of your program by using a separate thread to handle OpenGL. But then you need to make sure that all OpenGL-related resources get allocated from that thread. At least, I remember some stories of debugging two threads going tag-team on OpenGL handles in the early days of consumer OpenGL.

Replies are listed 'Best First'.
Re^2: OpenGL and AnyEvent
by basiliscos (Pilgrim) on May 29, 2014 at 12:34 UTC

    Thank you, Corion!

    I've found that the main trick is to call glutPostRedisplay too, e.g. instead of glutMainLoop

    my $refresh_world = sub { glutMainLoopEvent; glutPostRedisplay; }; my $t; $t = AE::timer 0, 0.01, sub { $refresh_world->(); }; $refresh_world->(); AE::cv->recv;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1087784]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-04-23 18:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found