<div dir="ltr"><div><div><div>Thansk for your help. Yes, you are rigth, the problem was in the interaction between the wxwidgets main loop and the gl context.<br></div>For the Pd-dev list:<br></div>The solution is to write an Idle function, I made the following changes:<br></div>//on WxApp class<br><div><code>void MyApp::activateRenderLoop(bool on) {<br> if(on && !render_loop_on) {<br> Connect(wxID_ANY, wxEVT_IDLE, wxIdleEventHandler(MyApp::onIdle));<br> render_loop_on = true;<br> }<br> else if (!on && render_loop_on) {<br> Disconnect(wxEVT_IDLE, wxIdleEventHandler(MyApp::onIdle));<br> render_loop_on = false;<br> }<br>}<br><br></code><code>void MyApp::onIdle(wxIdleEvent &evt) {<br> activateRenderLoop(glPane->render_on);<br> if(render_loop_on) {<br> std::cout<<"MyApp on Idle, render_loop_on"<<std::endl;<br> glPane->paint_now();<br> evt.RequestMore();<br> }<br>}<br><br></code><code>//on event table:<br>EVT_PAINT(BasicGLPane::paint_rt)<br><br></code></div><div><code>//on WxGLCanvas class<br></code></div><div><code>void BasicGLPane::rightClick(wxMouseEvent& event) {<br> render_on = true;<br> manager->init();<br> SLEEP(2000);<br> manager->play();<br> wxGetApp().activateRenderLoop(true); <br>}<br><br>void BasicGLPane::paint_rt(wxPaintEvent &evt) {<br> wxPaintDC dc(this);<br> render_rt(dc);<br>}<br><br>void BasicGLPane::paint_now(){<br> wxClientDC dc(this);<br> std::cout<<"paint now() "<<std::endl;<br> render_rt(dc);<br>}<br><br>void BasicGLPane::render_rt(wxDC &dc) {<br> wxGLCanvas::SetCurrent(*m_context);<br> if(_object->getCounter()>=10) { <br> wxGetApp().activateRenderLoop(false);<br> manager->stop();<br> render_on = false;<br> }<br> else {<br> ctx = CGLGetCurrentContext();<br> err = CGLEnable( ctx, kCGLCEMPEngine);<br> std::cout<<"render_rt CGLError: "<<err<<std::endl;<br> if (err==0) {<br> glTranslatef(p3->x, p3->y, 0);<br> Refresh(false);<br> }<br><br> }<br>}</code><br><div><div><div><div class="gmail_extra">and the synchronisation works now.<br></div><div class="gmail_extra">Regards.<br></div><div class="gmail_extra">Luis<br></div><div class="gmail_extra"><br><div class="gmail_quote">2016-02-18 3:15 GMT+01:00 Dan Wilcox <span dir="ltr"><<a href="mailto:danomatika@gmail.com" target="_blank">danomatika@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word">That shouldn’t make a difference, but you could try it. People haven’t had problems with OpenGL + libpd using ofxPd in open frameworks, so it may be due to how the wx widget mainloop & gl context interact.<div><span class=""><br><div>
<div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word">--------<br>Dan Wilcox<br><a href="https://twitter.com/danomatika" target="_blank">@danomatika</a><br><a href="http://danomatika.com" target="_blank">danomatika.com</a><br><div><a href="http://robotcowboy.com" target="_blank">robotcowboy.com</a></div></div>
</div>
<br></span><span class=""><div><blockquote type="cite"><div>On Feb 17, 2016, at 7:12 PM, 0222445 <<a href="mailto:Luis.Valdivia@stud.sbg.ac.at" target="_blank">Luis.Valdivia@stud.sbg.ac.at</a>> wrote:</div><br><div><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">There is no context error in the OpenGL draw now (solved with the call wxGLCanvas::SetCurrent(*m_context) but the draw still doesn't works (the object is moved after the manager->stop() and not during the execution) . I still think RtAudio is owning the CPU and blocking the execution of other threads or process. It will be better to do it with PortAudio?</span></div></blockquote></div><br></span></div></div></blockquote></div><br></div></div></div></div></div></div>