Example #1
0
void MyGLCanvas::OnSize(wxSizeEvent& event)
{
    event.Skip();
    
    // If this window is not fully initialized, dismiss this event
    if ( !IsShownOnScreen() )
        return;
    
    if ( !m_oglManager )
    {
        //Now we have a context, retrieve pointers to OGL functions
        if ( !oglInit() )
            return;
        //Some GPUs need an additional forced paint event
        PostSizeEvent();
    }
    
    // This is normally only necessary if there is more than one wxGLCanvas
    // or more than one wxGLContext in the application.
    SetCurrent(*m_oglContext);
    
    // It's up to the application code to update the OpenGL viewport settings.
    m_winHeight = event.GetSize().y;
    m_oglManager->SetViewport(0, 0, event.GetSize().x, m_winHeight);
    
    // Generate paint event without erasing the background.
    Refresh(false);
}
Example #2
0
void GLAnimationCanvas::OnPaint( wxPaintEvent& WXUNUSED(event) )
{
    // must always be here
    wxPaintDC dc(this);

    SetCurrent(*m_pGLRC);

    // Initialize OpenGL
    if (!m_gldata.initialized)
    {
        InitGL();

        ResetProjectionMode();
        m_gldata.initialized = true;
    }


    static DWORD last = timeGetTime();
    DWORD curr = timeGetTime();
    DWORD delta = curr - last;
    last = curr;
    CAnimationManager::GetInstance()->Update((float)delta/1000);
    CRenderManager::GetInstance()->Render();
    SwapBuffers();
}
void cReplayList::RebuildList() {
        int nItems=playList->GetNIdx();
        MENUDEB("RebuildList nItems %d \n",nItems);

        cPlayListItem * Item;
        for (int i = 0; i < nItems; i++) {
		Item=playList->GetItemByIndex(i);
                if (!Item) {
                        printf("Error getting all files for list index %d\n",
                                        i);
                        continue;
                };
                
		MENUDEB("Add item %d (%p)  %s\n",
                                i,Item,Item->GetName());

                char ItemStr[100];
                PrintItemStr(ItemStr,100,Item);                
                Add(new cOsdItem(ItemStr,osUnknown),false);
        };
        lastListItemCount = playList->GetNIdx();
	playList->SetClean();
        SetCurrent(Get(playList->GetCurrIdx()));
        lastActivity=time(NULL)-600;
};
Example #4
0
void subPageSpells::Prev(unsigned int n)
{
	SetCurrent();

	std::vector<Spell*> *pSpells = &currentSchool->spells;

	if ( n > spellNumber )
	{
		spellItr = pSpells->begin();
		currentSpell = *spellItr;
		spellNumber = 1;
		return;
	}

	for ( ; n > 0; n-- )
	{
		spellNumber--;
		if ( spellItr == pSpells->begin() )
		{
			spellItr = pSpells->end();
			spellNumber = currentSchool->spells.size();
		}
		spellItr--;
		currentSpell = *spellItr;
	}

	GetCurrent();
}
Example #5
0
//---------------------------- PROTECTED        -----------------------------//
wxCoreGLCanvas::wxCoreGLCanvas(wxWindow *parent, wxWindowID id, 
							   const wxPoint& pos, const wxSize& size, 
							   long style, const wxString& name, 
							   wxInt32 *attrib)
: wxGLCanvas(parent, id, pos, size, style, name, attrib)
, mpTopLevelWindow(dynamic_cast<wxTopLevelWindow *>(parent))
, mDirty(true)
#ifdef __WXGTK__
, mPainted(false)
#endif
{
	if (GetContext())
    {
        SetCurrent();

		// Initialize glew extensions.
		GLenum err = glewInit();
		if(GLEW_OK != err)
		{
			wxLogError(
				wxT("No OpenGL extensions are available on this hardware."));
		}

		InitGL(this);
	}
}
Example #6
0
wxBitmap wxSettlersGLCanvas::ConvertGLtoWX(const DrawObjectPtr &object, 
										   const size_t width, 
										   const size_t height, 
										   const Vector &eye)
{
	wxASSERT(object);

	wxImage image;

	if( (FALSE != GetContext()) &&
		(0 < width) &&
		(0 < height))
	{
		SetCurrent();

		//try to use a 4x size image for creating the initial image, which will 
		//be scaled down to required size and then cropped if needed
		size_t dim = std::max(width, height);
		size_t size = (dim << 2);

		// If we're using pixel buffers, we have to stay within the render
		// buffer boundary size.
		if( (Pixelbuffer == mRenderToBitmapMode) &&
			(RENDER_TEXTURE_SIZE < size))
		{
			size >>= 1;

			// This should never happen, but be safe.
			if(RENDER_TEXTURE_SIZE < size)
			{
				size = dim;
				wxASSERT(RENDER_TEXTURE_SIZE >= size);
			}
		}
Example #7
0
void cCMDMove::Build(char *dir)
{
  MYDEBUG("Verzeichnis: Move: Erstelle Verzeichnisliste: %s", dir);
  if(!dir)
    dir = CurrentDir();

  Clear();

  cDirHandling *DirHand = new cDirHandling(this, this);
  SetCurrent(Get(DirHand->Build(dir, true)));
  delete(DirHand);

  if(Count())
  {
    cMainMenuItem *item = (cMainMenuItem*)First();
    while(item)
    {
      if(!strcasecmp(item->FileName(), File))
      {
        Del(item->Index());
        break;
      }
      item = (cMainMenuItem*)Next(item);
    }
  }

  Display();
  SetHelp();
}
Example #8
0
void CBINDInstallDlg::UnregisterMessages(BOOL uninstall) {
	BOOL rc = FALSE;
	HKEY hKey = NULL;

	while(1) {
		SetCurrent(IDS_UNREGISTER_MESSAGES);
		/* Open key for Application Event Log */
		if (RegOpenKey(HKEY_LOCAL_MACHINE, EVENTLOG_APP_SUBKEY, &hKey)
			!= ERROR_SUCCESS)
			break;

		/* Remove named from the list of messages sources */
		if (RegDeleteKey(hKey, BIND_MESSAGE_NAME) != ERROR_SUCCESS)
			break;

		rc = TRUE;
		break;
	}

	if (hKey)
		RegCloseKey(hKey);

	if (uninstall)
		SetItemStatus(IDC_REG_MESSAGE, rc);
}
Example #9
0
/*
 * User pressed the uninstall button.  Make it go.
 */
void CBINDInstallDlg::OnUninstall() {
	UpdateData();

	if (MsgBox(IDS_UNINSTALL, MB_YESNO) == IDYES) {
		if (CheckBINDService())
			StopBINDService();

		SC_HANDLE hSCManager = OpenSCManager(NULL, NULL,
					SC_MANAGER_ALL_ACCESS);
		if (!hSCManager) {
			MsgBox(IDS_ERR_OPEN_SCM, GetErrMessage());
			return;
		}

		SC_HANDLE hService = OpenService(hSCManager, BIND_SERVICE_NAME,
					      SERVICE_ALL_ACCESS);
		if (!hService && GetLastError() != ERROR_SERVICE_DOES_NOT_EXIST){
			MsgBox(IDS_ERR_OPEN_SERVICE, GetErrMessage());
			return;
		}

		SERVICE_STATUS ss;
		QueryServiceStatus(hService, &ss);
		if (ss.dwCurrentState == SERVICE_RUNNING) {
			BOOL rc = ControlService(hService,
						 SERVICE_CONTROL_STOP, &ss);
			if (rc == FALSE || ss.dwCurrentState != SERVICE_STOPPED) {
				MsgBox(IDS_ERR_STOP_SERVICE, GetErrMessage());
				return;
			}

		}
		CloseServiceHandle(hService);
		CloseServiceHandle(hSCManager);

		// Directories
		m_etcDir = m_targetDir + "\\etc";
		m_binDir = m_targetDir + "\\bin";

		UninstallTags();
		UnregisterMessages(TRUE);
		UnregisterService(TRUE);
		DeleteFiles(TRUE);
		if (m_keepFiles == FALSE)
			RemoveDirs(TRUE);
		else
			GetDlgItem(IDC_CREATE_DIR)->SetWindowText("Not Removed");


		// Delete registry keys for named
		RegDeleteKey(HKEY_LOCAL_MACHINE, BIND_SESSION_SUBKEY);
		RegDeleteKey(HKEY_LOCAL_MACHINE, BIND_SUBKEY);
		RegDeleteKey(HKEY_LOCAL_MACHINE, BIND_UNINSTALL_SUBKEY);

		ProgramGroup(FALSE);

		SetCurrent(IDS_UNINSTALL_DONE);
		MsgBox(IDS_UNINSTALL_DONE);
	}
}
Example #10
0
void cMenuBouquetsList::Setup(cChannel * channel)
{
    Clear();
    cChannel *currentChannel =
        channel ? channel : Channels.GetByNumber(cDevice::CurrentChannel());
    cMenuBouquetItem *currentItem = NULL;
    while (currentChannel && !currentChannel->GroupSep())
    {
        if (currentChannel->Prev())
            currentChannel = (cChannel *) currentChannel->Prev();
        else
            break;
    }
    for (cChannel * channel = (cChannel *) Channels.First(); channel;
         channel = (cChannel *) channel->Next())
    {
        //printf("##cMenuBouquetsList::Setup, channel->Name() = %s\n", channel->Name());
        if (channel->GroupSep() && !(FilteredBouquetIsEmpty(channel) && mode_ == 1))
        {
            cMenuBouquetItem *item = new cMenuBouquetItem(channel);
            Add(item);
            if (!currentItem && item->Bouquet() == currentChannel)
                currentItem = item;
        }
    }

    if (!currentItem)
        currentItem = (cMenuBouquetItem *) First();
    SetCurrent(currentItem);
    Options();
    Display();
}
Example #11
0
//=========================================================================================
void GAVisToolCanvas::SetupOpenGL( void )
{
	context = new wxGLContext( this );
	SetCurrent( *context );

	glClearColor( 1.f, 1.f, 1.f, 1.f );
	glLineWidth( 1.5f );
	glEnable( GL_LINE_SMOOTH );
	glEnable( GL_BLEND );
	glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
	glHint( GL_LINE_SMOOTH_HINT, GL_DONT_CARE );
	glShadeModel( GL_SMOOTH );

	GLfloat lightColor[] = { 1.f, 1.f, 1.f, 1.f };
	GLfloat lightPos[] = { 1000.f, 1000.f, 500.f };
	GLfloat lightSpec[] = { 0.3f, 0.3f, 0.3f, 0.3f };
	glEnable( GL_LIGHTING );
	glEnable( GL_LIGHT0 );
	glLightfv( GL_LIGHT0, GL_DIFFUSE, lightColor );
	glLightfv( GL_LIGHT0, GL_POSITION, lightPos );
	glLightfv( GL_LIGHT0, GL_SPECULAR, lightSpec );

	glMatrixMode( GL_MODELVIEW );
	glLoadIdentity();
	glMatrixMode( GL_PROJECTION );
	glLoadIdentity();
}
Example #12
0
eOSState cMenuBouquetsList::DeleteBouquet()
{
    if (Interface->Confirm(tr("Delete Bouquet?")))
    {
        cChannel *bouquet = GetBouquet(Current());
        cChannel *next = (cChannel *) bouquet->Next();
        /* Delete all channels up to the beginning */
        /* of the next bouquet */
        while (next && !next->GroupSep())
        {
            cChannel *p = next;
            next = (cChannel *) next->Next();
            Channels.Del(p);
        }
        /* Delete the bouquet itself */
        Channels.Del(bouquet);
        /* Remove the OSD-item */
        cOsdMenu::Del(Current());
        Propagate();
        if (Current() < -1)
            SetCurrent(0);
        return osContinue;
    }
    return osContinue;
}
Example #13
0
int	CoroutineMgr::Yield(int coid )
{
    Coroutine * cur = GetCurrent();
    if(!cur)
    {
		LOG_FATAL("current co is null !");
        return -1;
    }
	Coroutine * co = Find(coid);
	if(0 == coid)
	{
		//switch to prev
		co = cur->from;
	}
    if(!co)
    {
		LOG_FATAL("current from co is null !");
        return -1;
    }
	if(cur->bState == Coroutine::COROUTINE_STATUS_RUNNING)
	{
		cur->bState = Coroutine::COROUTINE_STATUS_SUSPEND;
	}
	co->bState = Coroutine::COROUTINE_STATUS_RUNNING;
    SetCurrent(co);
	LOG_INFO("co = %d is yield schedule next = %d for = %d",cur->iID,co->iID,coid);
    swapcontext(&(cur->ctx),&(co->ctx));
    return retval;
}
Example #14
0
cMenuEpgTimers::cMenuEpgTimers(void)
    :cOsdMenu(tr("Timers"), 2, CHNUMWIDTH, 10, 6, 6), SwitchTimersLock(&SwitchTimers)
{

  if (strcmp(Skins.Current()->Name(), "Reel") == 0)
#if APIVERSNUM < 10700
      SetCols(3, 10, 6, 10, 6);
#else

#if REELVDR && APIVERSNUM >= 10718
      SetCols(3, 12, 7, 6);
#else
      SetCols(3, 12, 7, 12, 7);
#endif /* REELVDR && APIVERSNUM >= 10718 */

#endif
#if REELVDR && APIVERSNUM >= 10718
  EnableSideNote(true);
#endif
  helpKeys = -1;
  Set();
  SetCurrent(First());
  SetHelpKeys();

  /* get timer state */
  TimerState_=0;
  Timers.Modified(TimerState_);
#ifdef USEMYSQL
  LastEventID_ = -1;
  LastEventID_ = Timers.GetLastEventID();
#endif


}
Example #15
0
void BaseCanvas::setup(const PartitionView *partitionView)
{
	m_partitionView = partitionView;

	SetCurrent();

	int width, height;
	GetSize(&width, &height);

	// Enable back-face culling.
	glCullFace(GL_BACK);
	glFrontFace(GL_CW);
	glEnable(GL_CULL_FACE);

	// Set up the z-buffer.
	glDepthFunc(GL_LEQUAL);
	glEnable(GL_DEPTH_TEST);

	// Set up alpha testing.
	glAlphaFunc(GL_NOTEQUAL, 0);
	glEnable(GL_ALPHA_TEST);

	glClearColor(0, 0, 0, 0);

	glViewport(0, 0, width, height);

	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();

	glOrtho(0, width, height, 0, 0.0, 2048.0);
}
Example #16
0
/*
 * Methods to do the work
 */
void CBINDInstallDlg::CreateDirs() {
	/* s'OK if the directories already exist */
	SetCurrent(IDS_CREATE_DIR, m_targetDir);
	if (!CreateDirectory(m_targetDir, NULL) && GetLastError() != ERROR_ALREADY_EXISTS)
		throw(Exception(IDS_ERR_CREATE_DIR, m_targetDir, GetErrMessage()));

	SetCurrent(IDS_CREATE_DIR, m_etcDir);
	if (!CreateDirectory(m_etcDir, NULL) && GetLastError() != ERROR_ALREADY_EXISTS)
		throw(Exception(IDS_ERR_CREATE_DIR, m_etcDir, GetErrMessage()));

	SetCurrent(IDS_CREATE_DIR, m_binDir);
	if (!CreateDirectory(m_binDir, NULL) && GetLastError() != ERROR_ALREADY_EXISTS)
		throw(Exception(IDS_ERR_CREATE_DIR, m_binDir, GetErrMessage()));

	SetItemStatus(IDC_CREATE_DIR);
}
Example #17
0
bool SpectraVisDataUploader::DoWork(void)
{
    if((current_row < row_count) && SetCurrent())
    {
        spectrum_data.Bind(oglplus::Buffer::Target::Texture);
        std::size_t n = rows_per_load;

        if(current_row+n > row_count)
            n = row_count - current_row;

        this->QuerySpectrumValues(
            data_buf.data(),
            data_buf.size(),
            current_row,
            current_row+n
        );

        spectrum_data.Bind(oglplus::Buffer::Target::Texture);
        oglplus::Buffer::SubData(
            oglplus::BufferTarget::Texture,
            oglplus::BufferSize::Of<GLfloat>(
                spectrum_size*current_row
            ),
            spectrum_size*n,
            data_buf.data()
        );

        current_row += n;
        return false;
    }
    return true;
}
Example #18
0
void CBINDInstallDlg::RegisterMessages() {
	HKEY hKey;
	DWORD dwData;
	char pszMsgDLL[MAX_PATH];

	sprintf(pszMsgDLL, "%s\\%s", (LPCTSTR)m_binDir, "bindevt.dll");

	SetCurrent(IDS_REGISTER_MESSAGES);
	/* Create a new key for named */
	if (RegCreateKey(HKEY_LOCAL_MACHINE, BIND_MESSAGE_SUBKEY, &hKey)
		!= ERROR_SUCCESS)
		throw(Exception(IDS_ERR_CREATE_KEY, GetErrMessage()));

	/* Add the Event-ID message-file name to the subkey. */
	if (RegSetValueEx(hKey, "EventMessageFile", 0, REG_EXPAND_SZ,
		(LPBYTE)pszMsgDLL, (DWORD)(strlen(pszMsgDLL) + 1)) != ERROR_SUCCESS)
		throw(Exception(IDS_ERR_SET_VALUE, GetErrMessage()));

	/* Set the supported types flags and addit to the subkey. */
	dwData = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE;
	if (RegSetValueEx(hKey, "TypesSupported", 0, REG_DWORD,
		(LPBYTE)&dwData, sizeof(DWORD)) != ERROR_SUCCESS)
		throw(Exception(IDS_ERR_SET_VALUE, GetErrMessage()));

	RegCloseKey(hKey);

	SetItemStatus(IDC_REG_MESSAGE);
}
Example #19
0
void TestGLCanvas::OnPaint( wxPaintEvent& WXUNUSED(event) )
{
    // must always be here
    wxPaintDC dc(this);

    SetCurrent(*m_glRC);

    // Initialize OpenGL
    if (!m_gldata.initialized)
    {
        InitGL();
        ResetProjectionMode();
        m_gldata.initialized = true;
    }

    // Clear
    glClearColor( 0.3f, 0.4f, 0.6f, 1.0f );
    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

    // Transformations
    glLoadIdentity();
    glTranslatef( 0.0f, 0.0f, -20.0f );
    GLfloat m[4][4];
    build_rotmatrix( m, m_gldata.quat );
    glMultMatrixf( &m[0][0] );

    m_renderer.Render();

    // Flush
    glFlush();

    // Swap
    SwapBuffers();
}
Example #20
0
void MyCanvas::OnSize(wxSizeEvent& event)
{
	//printf("OnSize\n");
	if (!IsShownOnScreen()) return;
	SetCurrent(*m_glRC);
	resize_callback(event.GetSize().x, event.GetSize().y);
}
Example #21
0
PathListWin::PathListWin(Win* parent, PathList& dataList)
    : VListWin(Win::WT_CHILD, WH_TABFOCUS | WH_CLICKFOCUS, 0, parent, VListWin::SINGLE_SELECT, VListWin::BORDER_3D, 0),
    m_dataList(dataList)
{
    wal::GC gc(this);
    gc.Set(GetFont());

    cpoint ts = gc.GetTextExtents(ABCString);
    const int fontH = ts.y + 2;
    this->SetItemSize((fontH > 16 ? fontH : 16) + 1, 100);

    LSize ls;
    ls.x.maximal = 10000;
    ls.x.ideal = 1000;
    ls.x.minimal = 600;

    ls.y.maximal = 10000;
    ls.y.ideal = 600;
    ls.y.minimal = 400;

    SetLSize(ls);

    if (m_dataList.GetCount() > 0)
    {
        SetCount(m_dataList.GetCount());
        SetCurrent(0);
    }
}
Example #22
0
void MyCanvas::InitGL()
{
	SetCurrent(*m_glRC);
	visualize_init();
	wxSizeEvent e = wxSizeEvent(GetSize());
	OnSize(e);
}
Example #23
0
void subPageSpells::Next(unsigned int n)
{
	SetCurrent();

	std::vector<Spell*> *pSpells = &currentSchool->spells;

	if ( n > (pSpells->size()-spellNumber) && n!=1 )
	{
		spellItr = pSpells->end();
		spellItr--;
		currentSpell = *spellItr;
		spellNumber = pSpells->size();
		return;
	}

	for ( ; n > 0; n-- )
	{
		spellItr++;
		spellNumber++;
		if ( spellItr == pSpells->end() )
		{
			spellItr = pSpells->begin();
			spellNumber = 1;
		}
		currentSpell = *spellItr;
	}

	GetCurrent();
}
Example #24
0
void cMenuDirSelect::Load()
{
    int current = Current();
    char* oldSelection = NULL; // save old selection for reselection
    if (current>-1)
	oldSelection = strdup(Get(current)->Text());
    Clear();

    CreateDirSet();
    std::set<string>::iterator it;
    for (it = directorySet.begin(); it != directorySet.end(); ++it)
	AddDistinct((*it).c_str());

    Sort();
    for(int i=0; i<Count(); i++)
    {
	const char* text = Get(i)->Text();
	if (oldSelection && strchr(text, '%') == NULL && strstr(text, oldSelection) == text) // skip entries with variables
	{
	    SetCurrent(Get(i));
	    break;
	}
    }
    if (oldSelection) free(oldSelection);

    if (yellow)
    {
	free(yellow);
	yellow = NULL;
    }
    msprintf(&yellow, "%s %d", tr("Button$Level"), (CurLevel==MaxLevel?1:CurLevel+1));
    SetHelp(NULL, NULL, MaxLevel==1?NULL:yellow, tr("Button$Select"));
    Display();
}
Example #25
0
void GLCanvas::Render()
{
	if ( GetParent()->IsShown() && mAttachedRenderBuffer != NULL )
	{
		SetCurrent();
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
		glClearColor( 0.0f, 0.0f, 0.0f, 1.0f);

		glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
		glDisable(GL_DITHER);

		int w = this->GetSize().GetWidth();
		int h = this->GetSize().GetHeight();

		int x = 256, y = 240;
		mAttachedRenderBuffer->GetBufferSize( x, y );

		glViewport(0, 0, (GLsizei)w, (GLsizei)h );

		glMatrixMode(GL_PROJECTION);
		glLoadIdentity();
		glOrtho( 0, w, 0, h, -1, 1 );

		glMatrixMode(GL_MODELVIEW);
		glLoadIdentity();
		glRasterPos2f( 0.0f, 0.0f );
		glPixelZoom( zoomx, zoomy );

		glDrawPixels( x, y, GL_RGB, GL_UNSIGNED_BYTE, mAttachedRenderBuffer->GetRGBBuffer( true ) );

		SwapBuffers();
	}
}
Example #26
0
View2D::View2D(wxWindow *parent, wxWindowID id,const wxPoint& pos, const wxSize& size, long style,    const wxString& name, int* gl_attrib)    : 
//wxGLCanvas(parent, id, pos, size, style, name, gl_attrib)
//wxGLCanvas(parent, MyApp::GLContext, id ,  pos, size ,  style, name,MyApp::gl_attributes)
  wxGLCanvas(parent, id,MyApp::gl_attributes, pos, size, style, name)
{
	mirror.set(1,1);
	txt2 = 0;
//	txt_reg = 0;

	to_show=0;
	gl_inited=0;
	scale = 1;
	cur_slice = 156;
	center = vec2(0);
	use_bicubic_filt=1;
	cur_action=V2D_ACTION_ARROW;
	sel_obj=-1;
	selected_obj=-1;

	if(parent)
		parent->Show(true);
	SetCurrent(*MyApp::GLContext);
	
	MyRefresh();

	
	GetClientSize(&width, &height);
}
Example #27
0
void CFCEditorGLWindow::OnTimer( wxTimerEvent& /*event*/ )
{
    if ( IsShownOnScreen() )
    {
        SetCurrent(*m_glRC);
    }
    FC_PERFORMDETECT_START(ePNT_Editor)
    CRenderManager::GetInstance()->SetCamera(m_pCamera);

    FC_PERFORMDETECT_START(ePNT_UpdateCamera)
    UpdateCamera();
    FC_PERFORMDETECT_STOP(ePNT_UpdateCamera)

    FC_PERFORMDETECT_STOP(ePNT_Editor)

    CEngineCenter::GetInstance()->Update();

    CEditorMainFrame* pWFrame = static_cast<CEngineEditor*>(wxApp::GetInstance())->GetMainFrame();
    if (pWFrame->GetPerformanceDialogPtr())
    {
        pWFrame->GetPerformanceDialogPtr()->UpdatePerformData();
    }
    FC_PERFORMDETECT_RESET();

    SwapBuffers();
}
Example #28
0
void CGraphCanvas::InitGL()
{
	SetCurrent();
	GLenum err = glewInit();
	if (GLEW_OK != err)
		wxLogError( "%s\n", glewGetErrorString(err) );

	if ( GLEW_ARB_vertex_buffer_object )
		wxLogMessage( "VBO extersion is supported!\n");
	if (GLEW_ARB_vertex_shader && GLEW_ARB_fragment_shader && GL_EXT_geometry_shader4)
		wxLogMessage("Ready for GLSL - vertex, fragment, and geometry units.\n");
	else {
		wxLogError("Not totally ready :( \n");
	}

	glClearColor( WHITE[0], WHITE[1], WHITE[2], WHITE[3] );
	glClearDepth(1.0);

    glEnable(GL_LINE_SMOOTH);
    glEnable(GL_BLEND);

    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glHint(GL_LINE_SMOOTH_HINT, GL_DONT_CARE);
    glDepthFunc(GL_LEQUAL);
    glEnable(GL_DEPTH_TEST);
 	glEnable(GL_NORMALIZE);


	HWND hWnd = (HWND) GetHandle();
	m_hDC = GetDC(hWnd);

	BuildFont();
}
void tui::LayoutCanvas::OnpaintGL(wxPaintEvent&) {
    wxPaintDC dc(this);
   #ifndef __WXMOTIF__
      if (!GetContext()) return;
   #endif
   SetCurrent();
   update_viewport();
   //@TODO !! Check somewhere that RGBA mode is available!?
   // CTM matrix stuff
   glLoadIdentity();
   glOrtho(lp_BL.x(),lp_TR.x(),lp_TR.y(),lp_BL.y(),-1.0,1.0);
   if (invalid_window || !(tmp_wnd || rubber_band)) {
      // invalid_window indicates zooming. If that is false and the rest two 
      // variables are not set, means that the system request repaint 
      // In both cases - the entire window is redrawn
      glClear(GL_COLOR_BUFFER_BIT);
      glEnable(GL_BLEND);
      glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
      glClear(GL_ACCUM_BUFFER_BIT);
      Properties->drawGrid();
      DATC->openGL_draw(Properties->drawprop());    // draw data
      glAccum(GL_LOAD, 1.0);
      if (rubber_band) rubber_paint();
      invalid_window = false;
   }
   else if (tmp_wnd) 
      // zooming using the mouse
      wnd_paint();
   else if (n_ScrMARKold != n_ScrMARK) 
      // the only reason to get to this point remains rubber_band == true
      // so the paint will be invoked only if we have something new to show on 
      //the screen
      rubber_paint();
   SwapBuffers();
}
Example #30
0
void GLCanvas::OnPaint(wxPaintEvent &event)
{
	wxPaintDC dc(this);

	if (!_GLRC)
    {
        return;
    }

	SetCurrent(*_GLRC);

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glLoadIdentity();

	if (_style & SINGLE_SENSOR_MODE)
    {
        renderSingleSensor();
    }
    else if (_style & SINGLE_JOINT_MODE)
    {
        renderSingleJoint();
    }
    else
    {
        renderSkeleton();
    }
	// _image.render();
	// glFlush();
	SwapBuffers();
	if (_showUI && !(_style & SELECTION_MODE))
    {
        drawUserInterface(dc);
    }
	event.Skip();
}