void MyFrame::OnIdle(wxIdleEvent& event){ if (mol.DoingAO()) { m_tb->UpdateGearsIcon(true); if (mol.PrepareAOstep()) { m_canvas->SceneChanged(); event.RequestMore(false); m_tb->UpdateGearsIcon(false); return; } else event.RequestMore(true); } else { event.RequestMore(false); if (hardSettings.STILL_QUALITY!=hardSettings.MOVING_QUALITY) if (!m_canvas->shownHQ) { m_canvas->shownHQ=true; mustDoHQ=true; m_canvas->Refresh(false); } m_tb->UpdateGearsIcon(false); } }
void drawFrame() { cgSettings.MakeShaders(); if (mol.DoingAO()) { // do at least one more step per rendering mol.PrepareAOstep(1); // continue until decent while (!mol.DecentAO()) mol.PrepareAOstep(1); } /*if (cgSettings.UseHalo()>0) { // write depth in HaloTexture glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, haloFrame); } else { // write depth in depthbuffer glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); }*/ mainCanvas.SetAsOutput(); if (cgSettings.doingAlphaSnapshot) glClearColor( cgSettings.P_halo_col, cgSettings.P_halo_col, cgSettings.P_halo_col, 0.0f); else glClearColor( cgSettings.P_bg_color_R, cgSettings.P_bg_color_G, cgSettings.P_bg_color_B, 0.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); Point3f lightDir; if ( cgSettings.P_sem_effect // fixed light dir sem effect // || mol.sticks // quick Hack: fixed light dir when bonds ) lightDir= Point3f(0,0,1); else lightDir=getDirFromTrackball(lightTrack); setLightDir( lightDir ); // gluLookAt(0,0,-3, 0,0,0, 0,1,0); original // gluLookAt(0,0,-3, 0,0,0, 0,1,0); ok for tra if (mol.hasDefaultView()) gluLookAt(0,0, 40, 0,0,0, 0,1,0); else gluLookAt(0,0,-40, 0,0,0, 0,1,0); if(MovingLightMode) drawLightDir(); glColor3f(1,1,1); if (mol.hasDefaultView()) { float angle, axisX, axisY, axisZ; mol.getDefaultViewRotation(&angle, &axisX, &axisY, &axisZ); glRotatef(angle, axisX, axisY, axisZ); } if (1) { //track.center=Point3f(0, 0, 0); //track.radius= 1; //setProjection(); if (aniStep>=0) // BH: Doesn't normally seem to be aniStep>=0 { double extraRot=360.0*aniStep; // set extra rotation for GIF animation: switch (hardSettings.GIF_ANIMATION_MODE) { default: case 0: glRotated(-hardSettings.GIF_ROT_SIDEVIEW_ANGLE,1,0,0); glRotated(extraRot,0,1,0); break; case 1: glRotated(-extraRot,0,0,1); glRotated(hardSettings.GIF_INSP_ANGLE,0,1,0); glRotated(extraRot,0,0,1); break; case 2:{ double substep[6]; for (int i=0; i<6; i++) { substep[i]=(aniStep*6-i)*90.0; if (substep[i]<0) substep[i]=0; if (substep[i]>90.0) substep[i]=90.0; } glRotated(-substep[5], 1,0,0); glRotated(-substep[4], 0,1,0); glRotated(-substep[3], 0,1,0); glRotated(-substep[2], 1,0,0); glRotated(-substep[1], 0,1,0); glRotated(-substep[0], 0,1,0); }break; } } setProjection( mainCanvas.GetVideoSize() ); track.GetView(); track.Apply(false); // Set to true to see the trackball itself. setProjection( mainCanvas.GetSoftRes() ); if (cgSettings.P_use_shadowmap()) { shadowmap.computeAsTexture( getGlLightPos() , cgSettings.do_use_doubleshadow(), shadowmapCanvas); //shadowmap.computeAsTexture( Point3f(0,1,0) ); } cgSettings.BindShaders(); glEnable(GL_TEXTURE_2D); //glBindTexture(GL_TEXTURE_2D, molTexture); glActiveTextureARB(GL_TEXTURE1_ARB); shadowmapCanvas.SetAsTexture(); mol.Draw(); // shadowmap.m.DrawShadowmap(false); glDisable(GL_VERTEX_PROGRAM_ARB); glDisable(GL_FRAGMENT_PROGRAM_ARB); glDisable(GL_BLEND); if (cgSettings.UseHalo()>0) mol.DrawHalos(); } }
void MyToolbar::UpdateGearsIcon(){ UpdateGearsIcon( mol.DoingAO() ); }